private void Tab_SizeAllocated(object o, Gtk.SizeAllocatedArgs args) { var imagewidth = (gtkimage != null) ? gtkimage.Allocation.Width : 0; var closewidth = (closeButton.Visible) ? closeButton.Allocation.Width : 0; var width = (float)label.Allocation.Width / (label.Allocation.Width - Math.Abs(closewidth - imagewidth)); if (imagewidth >= closewidth) { label.SetAlignment(1 - width / 2, 0.5f); } else { label.SetAlignment(width / 2, 0.5f); } }
public DocumentPageHandler() { Control = new Gtk.VBox(); tab = new Gtk.HBox(); closeButton = new Gtk.Button(); closeButton.Relief = Gtk.ReliefStyle.None; closeButton.CanFocus = false; #if GTK3 tab.Expand = true; closeButton.Image = new Gtk.Image(Gtk.IconTheme.Default.LoadIcon("window-close", 12, Gtk.IconLookupFlags.ForceSize)); #else closeButton.Image = new Gtk.Image(Gtk.IconTheme.Default.LoadIcon("window-close", 12, 0)); #endif tab.PackEnd(closeButton, false, true, 0); label = new Gtk.Label(); label.SetAlignment(0.5f, 0.5f); tab.PackEnd(label, true, true, 0); tab.SizeAllocated += Tab_SizeAllocated; tab.ShowAll(); closeButton.Clicked += (o, args) => Parent?.ClosePage(ContainerControl, Widget); tab.ButtonPressEvent += (o, args) => { if (args.Event.Button == 2 && Closable) { Parent?.ClosePage(ContainerControl, Widget); } }; }
private void Build() { var vBox = new Gtk.VBox(false, 5); var Titulo = new Gtk.Label("<b>CALENDARIO</b>"); Titulo.UseMarkup = true; var MiCalendario = new Gtk.Calendar(); //MiCalendario.DragDrop (); //boRRAR DRAG var H1 = new Gtk.Label("<b>EJERCICIO</b>"); H1.UseMarkup = true; EjercicioDia = new Gtk.Label(); EjercicioDia.SetAlignment(0, 0); MarcarMes(MiCalendario); MiCalendario.DaySelected += OnDaySelected; MiCalendario.MonthChanged += OnMonthChanged; vBox.PackStart(Titulo, true, false, 10); vBox.PackStart(MiCalendario, true, true, 10); vBox.PackStart(H1, true, false, 5); vBox.PackStart(EjercicioDia, true, true, 5); this.Add(vBox); }
public Gtk.Label AddTitleLabel(string text) { Gtk.Label label = AddBoldLabel(text, current_row++, 1); label.SetAlignment(0.0f, 0.0f); label.Selectable = true; return(label); }
public static Gtk.Label NewLabel () { Gtk.Label label = new Gtk.Label (); label.SetAlignment (0.0f, 0.5f); label.Selectable = true; return label; }
public GtkSharpLabel(Widget shellobject, string caption) : base(shellobject) { label = new Gtk.Label(caption); GtkSharpDriver.InitWidget(label, shellobject); label.Show(); label.SetAlignment(0.0f, 0.5f); }
private Gtk.Label AddGrayLabel(string text, uint row, uint column) { Gtk.Label label = WidgetFu.NewGrayLabel(text); label.SetAlignment(1.0f, 0.0f); label.Show(); Attach(label, column, column + 1, row, row + 1, fill, fill, 0, 0); maximized = false; return(label); }
private Gtk.Label AddBoldLabel(string text, uint row, uint column) { Gtk.Label label = WidgetFu.NewBoldLabel(text); label.SetAlignment(0.0f, 0.0f); WidgetFu.EllipsizeLabel(label); label.Show(); Attach(label, column, column + 1, row, row + 1, expand, fill, 0, 0); maximized = false; return(label); }
public Gtk.Label AddSnippet() { AddNewLine(); snippet = WidgetFu.NewLabel(); snippet.SetAlignment(0.0f, 0.0f); snippet.Selectable = true; WidgetFu.EllipsizeLabel(snippet); snippet.Show(); Attach(snippet, 1, 2, current_row, ++current_row, expand, fill, 0, 0); maximized = false; snippet_tip = new Gtk.Tooltips(); return(snippet); }
ConfigTab(Gtk.Builder builder, IntPtr handle) : base(builder, handle) { int n = 100; foreach (var plugin in BooruApp.BooruApplication.PluginLoader.LoadedPlugins) { Gtk.Label label = new Gtk.Label("<b>" + plugin.Name + "</b>"); label.SetAlignment(0.0f, 0.5f); label.UseMarkup = true; label.MarginTop = 32; ConfigGrid.Attach(label, 0, n, 5, 1); n++; Gtk.HSeparator sep = new Gtk.HSeparator(); sep.MarginBottom = 16; ConfigGrid.Attach(sep, 0, n, 5, 1); n++; label = new Gtk.Label(plugin.ConfigDesc); label.SetAlignment(0.0f, 0.5f); label.UseMarkup = true; ConfigGrid.Attach(label, 0, n, 5, 1); n++; foreach (var configDef in plugin.ConfigEntryDefinitions) { Gtk.Label configLabel = new Gtk.Label(configDef.Label); configLabel.Name = configDef.Name; configLabel.TooltipMarkup = configDef.Tooltip; configLabel.SetAlignment(0.0f, 0.5f); ConfigGrid.Attach(configLabel, 0, n, 1, 1); n++; } } this.ConnectAllChildren(this); this.ShowAll(); this.Sensitive = false; BooruApp.BooruApplication.EventCenter.DatabaseLoadStarted += OnDatabaseUnloaded; BooruApp.BooruApplication.EventCenter.DatabaseLoadFailed += OnDatabaseUnloaded; BooruApp.BooruApplication.EventCenter.DatabaseLoadSucceeded += OnDatabaseLoaded; }
public Header(string text) : base() { base.SetSizeRequest (-1, 30); Gtk.Alignment alignment = new Gtk.Alignment (0, 0, 1, 1); alignment.TopPadding = 1; alignment.LeftPadding = 5; alignment.RightPadding = 0; alignment.BottomPadding = 1; base.Add (alignment); //Select (); Gtk.HBox box = new Gtk.HBox (); alignment.Add (box); label = new Gtk.Label (); label.Ypad = 3; // label.Xpad = 3; //base.Add (label); box.PackStart (label, true, true, 0); label.SetAlignment (0f, 0.5f); label.Justify = Gtk.Justification.Left; label.Markup = "<b>" + text + "</b>"; closeButton = new Gtk.Button (); closeButton.Add (new Gtk.Image ("gtk-close", Gtk.IconSize.Menu)); closeButton.Relief = Gtk.ReliefStyle.None; box.PackEnd (closeButton, false, false, 0); closeButton.ShowAll (); label.Show (); box.Show (); alignment.Show (); closeButton.Clicked += closeButton_Clicked; }
public MessageDialog () { Resizable = false; HasSeparator = false; BorderWidth = 12; label = new Gtk.Label (); label.LineWrap = true; label.Selectable = true; label.UseMarkup = true; label.SetAlignment (0.0f, 0.0f); secondaryLabel = new Gtk.Label (); secondaryLabel.LineWrap = true; secondaryLabel.Selectable = true; secondaryLabel.UseMarkup = true; secondaryLabel.SetAlignment (0.0f, 0.0f); icon = new Gtk.Image (Gtk.Stock.DialogInfo, Gtk.IconSize.Dialog); icon.SetAlignment (0.5f, 0.0f); Gtk.StockItem item = Gtk.Stock.Lookup (icon.Stock); Title = item.Label; Gtk.HBox hbox = new Gtk.HBox (false, 12); Gtk.VBox vbox = new Gtk.VBox (false, 12); vbox.PackStart (label, false, false, 0); vbox.PackStart (secondaryLabel, true, true, 0); hbox.PackStart (icon, false, false, 0); hbox.PackStart (vbox, true, true, 0); VBox.PackStart (hbox, false, false, 0); hbox.ShowAll (); Buttons = Gtk.ButtonsType.OkCancel; }
public Header(string text) : base() { base.SetSizeRequest(-1, 30); Gtk.Alignment alignment = new Gtk.Alignment(0, 0, 1, 1); alignment.TopPadding = 1; alignment.LeftPadding = 5; alignment.RightPadding = 0; alignment.BottomPadding = 1; base.Add(alignment); //Select (); Gtk.HBox box = new Gtk.HBox(); alignment.Add(box); label = new Gtk.Label(); label.Ypad = 3; // label.Xpad = 3; //base.Add (label); box.PackStart(label, true, true, 0); label.SetAlignment(0f, 0.5f); label.Justify = Gtk.Justification.Left; label.Markup = "<b>" + text + "</b>"; closeButton = new Gtk.Button(); closeButton.Add(new Gtk.Image("gtk-close", Gtk.IconSize.Menu)); closeButton.Relief = Gtk.ReliefStyle.None; box.PackEnd(closeButton, false, false, 0); closeButton.ShowAll(); label.Show(); box.Show(); alignment.Show(); closeButton.Clicked += closeButton_Clicked; }
public MessageDialog() { Resizable = false; HasSeparator = false; BorderWidth = 12; label = new Gtk.Label(); label.LineWrap = true; label.Selectable = true; label.UseMarkup = true; label.SetAlignment(0.0f, 0.0f); secondaryLabel = new Gtk.Label(); secondaryLabel.LineWrap = true; secondaryLabel.Selectable = true; secondaryLabel.UseMarkup = true; secondaryLabel.SetAlignment(0.0f, 0.0f); icon = new Gtk.Image(Gtk.Stock.DialogInfo, Gtk.IconSize.Dialog); icon.SetAlignment(0.5f, 0.0f); Gtk.StockItem item = Gtk.Stock.Lookup(icon.Stock); Title = item.Label; Gtk.HBox hbox = new Gtk.HBox(false, 12); Gtk.VBox vbox = new Gtk.VBox(false, 12); vbox.PackStart(label, false, false, 0); vbox.PackStart(secondaryLabel, true, true, 0); hbox.PackStart(icon, false, false, 0); hbox.PackStart(vbox, true, true, 0); VBox.PackStart(hbox, false, false, 0); hbox.ShowAll(); Buttons = Gtk.ButtonsType.OkCancel; }
void InitializeWidget() { _viewModel.Init(); // one row per option and one per group tblContainer.NRows = (uint)(_viewModel.GroupedOptions.Sum(x => x.Count()) + _viewModel.GroupedOptions.Count()) + 1; tblContainer.NColumns = 2; tblContainer.RowSpacing = 0; tblContainer.ColumnSpacing = 0; tblContainer.BorderWidth = 0; uint r = 0; var btn = new Gtk.Button(); btn.Label = "Reset to defaults"; btn.WidthRequest = 150; btn.Clicked += (sender, e) => { _viewModel.ResetToDefaults(); foreach (var item in tblContainer.Children) { item.Destroy(); } InitializeWidget(); }; tblContainer.Attach(btn, 0, 2, r, r + 1, Gtk.AttachOptions.Fill, Gtk.AttachOptions.Fill, 0, 0); r++; foreach (var optionGroup in _viewModel.GroupedOptions) { // group label var grouplbl = new Gtk.Label(); grouplbl.SetAlignment(0f, 0.5f); grouplbl.HeightRequest = 40; grouplbl.Markup = $"<b> {optionGroup.Key}</b>"; var box = new Gtk.EventBox(); box.ModifyBg(Gtk.StateType.Normal, _groupHeaderColor); box.Add(grouplbl); tblContainer.Attach(box, 0, 2, r, r + 1, Gtk.AttachOptions.Fill, Gtk.AttachOptions.Fill, 0, 0); r++; foreach (var option in optionGroup) { // name label var lbl = new Gtk.Label(option.Name) { TooltipText = option.Description }; lbl.SetAlignment(0f, 0.5f); lbl.HeightRequest = 30; AddToTable(r, 0, lbl); var type = option.PropertyType; if (type == typeof(bool)) { var chk = new Gtk.CheckButton { Active = (bool)option.Property.GetValue(_viewModel.Options) }; chk.Clicked += (sender, e) => { option.Property.SetValue(_viewModel.Options, chk.Active); _viewModel.IsDirty = true; }; AddToTable(r, 1, chk); } else if (type == typeof(int)) { var val = (int)option.Property.GetValue(_viewModel.Options); var spin = new Gtk.SpinButton(0, 10, 1) { Value = val, WidthChars = 3 }; spin.ValueChanged += (sender, e) => { option.Property.SetValue(_viewModel.Options, (int)spin.Value); _viewModel.IsDirty = true; }; AddToTable(r, 1, spin); } else if (type == typeof(byte)) { var val = (byte)option.Property.GetValue(_viewModel.Options); var spin = new Gtk.SpinButton(0, 10, 1) { Value = val, WidthChars = 3 }; spin.ValueChanged += (sender, e) => { option.Property.SetValue(_viewModel.Options, (byte)spin.Value); _viewModel.IsDirty = true; }; AddToTable(r, 1, spin); } else if (type == typeof(string)) { var val = (string)option.Property.GetValue(_viewModel.Options); var txt = new Gtk.Entry(val); txt.Alignment = 0; txt.Changed += (sender, e) => { option.Property.SetValue(_viewModel.Options, txt.Text); _viewModel.IsDirty = true; }; AddToTable(r, 1, txt); } else if (type == typeof(string[])) { var vals = (string[])option.Property.GetValue(_viewModel.Options); var val = string.Join(Environment.NewLine, vals); var txt = new Gtk.TextView(new Gtk.TextBuffer(new Gtk.TextTagTable())); txt.LeftMargin = 5; txt.RightMargin = 5; txt.BorderWidth = 1; txt.SetSizeRequest(320, 150); txt.Buffer.Text = val; txt.Buffer.Changed += (sender, e) => { var newVals = txt.Buffer.Text.Split(Environment.NewLine.ToCharArray()); option.Property.SetValue(_viewModel.Options, newVals); _viewModel.IsDirty = true; }; var frame = new Gtk.Frame(); frame.Shadow = Gtk.ShadowType.In; frame.BorderWidth = 5; frame.Child = txt; AddToTable(r, 1, frame); } else if (type.IsEnum) { var val = option.Property.GetValue(_viewModel.Options); var values = Enum.GetNames(type); var cmb = new Gtk.ComboBox(values); cmb.Active = Array.IndexOf(values, val.ToString()); cmb.Changed += (sender, e) => { option.Property.SetValue(_viewModel.Options, Enum.Parse(type, cmb.ActiveText)); _viewModel.IsDirty = true; }; AddToTable(r, 1, cmb); } r++; } } alContainer.ShowAll(); }
public HigMessageDialog(Gtk.Window parent, Gtk.DialogFlags flags, Gtk.MessageType type, Gtk.ButtonsType buttons, string header, string msg) : base() { BorderWidth = 5; Resizable = false; Title = ""; SkipTaskbarHint = true; ContentArea.Spacing = 12; ActionArea.Layout = Gtk.ButtonBoxStyle.End; Gtk.HBox hbox = new Gtk.HBox(false, 12); hbox.BorderWidth = 5; hbox.Show(); ContentArea.PackStart(hbox, false, false, 0); image = null; switch (type) { case Gtk.MessageType.Error: image = new Gtk.Image(Gtk.Stock.DialogError, Gtk.IconSize.Dialog); break; case Gtk.MessageType.Question: image = new Gtk.Image(Gtk.Stock.DialogQuestion, Gtk.IconSize.Dialog); break; case Gtk.MessageType.Info: image = new Gtk.Image(Gtk.Stock.DialogInfo, Gtk.IconSize.Dialog); break; case Gtk.MessageType.Warning: image = new Gtk.Image(Gtk.Stock.DialogWarning, Gtk.IconSize.Dialog); break; } image.Yalign = 0.1f; image.Show(); hbox.PackStart(image, false, false, 0); inner_vbox = new Gtk.VBox(false, 12); inner_vbox.Show(); hbox.PackStart(inner_vbox, true, true, 0); label_vbox = new Gtk.VBox(false, 0); label_vbox.Show(); inner_vbox.PackStart(label_vbox, true, true, 0); string title = String.Format("<span weight='bold' size='larger'>{0}" + "</span>\n", GLib.Markup.EscapeText(header)); Gtk.Label label; label = new Gtk.Label(title); label.UseMarkup = true; label.Justify = Gtk.Justification.Left; label.LineWrap = true; label.SetAlignment(0.0f, 0.5f); label.Show(); label_vbox.PackStart(label, false, false, 0); message_label = label = new Gtk.Label(); label.Text = msg; label.Justify = Gtk.Justification.Left; label.LineWrap = true; label.SetAlignment(0.0f, 0.5f); label.Show(); label_vbox.PackStart(label, false, false, 0); switch (buttons) { case Gtk.ButtonsType.None: break; case Gtk.ButtonsType.Ok: AddButton(Gtk.Stock.Ok, Gtk.ResponseType.Ok, true); break; case Gtk.ButtonsType.Close: AddButton(Gtk.Stock.Close, Gtk.ResponseType.Close, true); break; case Gtk.ButtonsType.Cancel: AddButton(Gtk.Stock.Cancel, Gtk.ResponseType.Cancel, true); break; case Gtk.ButtonsType.YesNo: AddButton(Gtk.Stock.No, Gtk.ResponseType.No, false); AddButton(Gtk.Stock.Yes, Gtk.ResponseType.Yes, true); break; case Gtk.ButtonsType.OkCancel: AddButton(Gtk.Stock.Cancel, Gtk.ResponseType.Cancel, false); AddButton(Gtk.Stock.Ok, Gtk.ResponseType.Ok, true); break; } if (parent != null) { TransientFor = parent; } if ((int)(flags & Gtk.DialogFlags.Modal) != 0) { Modal = true; } if ((int)(flags & Gtk.DialogFlags.DestroyWithParent) != 0) { DestroyWithParent = true; } }
public HIGMessageDialog(Gtk.Window parent, Gtk.DialogFlags flags, Gtk.MessageType type, Gtk.ButtonsType buttons, string header, string msg) : base() { HasSeparator = false; BorderWidth = 5; Resizable = false; Title = ""; VBox.Spacing = 12; ActionArea.Layout = Gtk.ButtonBoxStyle.End; accel_group = new Gtk.AccelGroup(); AddAccelGroup(accel_group); Gtk.HBox hbox = new Gtk.HBox(false, 12); hbox.BorderWidth = 5; hbox.Show(); VBox.PackStart(hbox, false, false, 0); switch (type) { case Gtk.MessageType.Error: image = new Gtk.Image(Gtk.Stock.DialogError, Gtk.IconSize.Dialog); break; case Gtk.MessageType.Question: image = new Gtk.Image(Gtk.Stock.DialogQuestion, Gtk.IconSize.Dialog); break; case Gtk.MessageType.Info: image = new Gtk.Image(Gtk.Stock.DialogInfo, Gtk.IconSize.Dialog); break; case Gtk.MessageType.Warning: image = new Gtk.Image(Gtk.Stock.DialogWarning, Gtk.IconSize.Dialog); break; default: image = new Gtk.Image(); break; } if (image != null) { image.Show(); image.Yalign = 0; hbox.PackStart(image, false, false, 0); } Gtk.VBox label_vbox = new Gtk.VBox(false, 0); label_vbox.Show(); hbox.PackStart(label_vbox, true, true, 0); string title = String.Format("<span weight='bold' size='larger'>{0}" + "</span>\n", header); Gtk.Label label; label = new Gtk.Label(title); label.UseMarkup = true; label.UseUnderline = false; label.Justify = Gtk.Justification.Left; label.LineWrap = true; label.SetAlignment(0.0f, 0.5f); label.Show(); label_vbox.PackStart(label, false, false, 0); label = new Gtk.Label(msg); label.UseMarkup = true; label.UseUnderline = false; label.Justify = Gtk.Justification.Left; label.LineWrap = true; label.SetAlignment(0.0f, 0.5f); label.Show(); label_vbox.PackStart(label, false, false, 0); extra_widget_vbox = new Gtk.VBox(false, 0); extra_widget_vbox.Show(); label_vbox.PackStart(extra_widget_vbox, true, true, 12); switch (buttons) { case Gtk.ButtonsType.None: break; case Gtk.ButtonsType.Ok: AddButton(Gtk.Stock.Ok, Gtk.ResponseType.Ok, true); break; case Gtk.ButtonsType.Close: AddButton(Gtk.Stock.Close, Gtk.ResponseType.Close, true); break; case Gtk.ButtonsType.Cancel: AddButton(Gtk.Stock.Cancel, Gtk.ResponseType.Cancel, true); break; case Gtk.ButtonsType.YesNo: AddButton(Gtk.Stock.No, Gtk.ResponseType.No, false); AddButton(Gtk.Stock.Yes, Gtk.ResponseType.Yes, true); break; case Gtk.ButtonsType.OkCancel: AddButton(Gtk.Stock.Cancel, Gtk.ResponseType.Cancel, false); AddButton(Gtk.Stock.Ok, Gtk.ResponseType.Ok, true); break; } if (parent != null) { TransientFor = parent; } if ((int)(flags & Gtk.DialogFlags.Modal) != 0) { Modal = true; } if ((int)(flags & Gtk.DialogFlags.DestroyWithParent) != 0) { DestroyWithParent = true; } }
private void Rebuild(Gtk.Table table, uint[][][] positions, GedcomIndividualRecord activePerson, GedcomFamilyLink[] lst) { foreach (Gtk.Widget child in table.Children) { child.Destroy(); } table.Resize(1,1); uint xmax = 0; uint ymax = 0; for (int i = 0; i < positions.Length; i ++) { uint x = positions[i][0][0] + 1; uint y = positions[i][0][1] + 1; uint w = positions[i][0][2]; uint h = positions[i][0][3]; GedcomFamilyLink famLink = (GedcomFamilyLink)lst[i]; if (famLink == null) { PedigreeBox pw = new PedigreeBox(null, 0, null); if (i > 0 && lst[((i+1)/2)-1] != null) { GedcomFamilyLink missingFamLink = (GedcomFamilyLink)lst[((i+1)/2)-1]; // missing parent button pw.ForceMouseOver = true; } // FIXME: both conditions do the same thing, double checking // the gramps code it doesn't appear to be a mistake in porting if (positions[i][0][2] > 1) { table.Attach(pw,x, x+w, y, y+h, Gtk.AttachOptions.Fill, Gtk.AttachOptions.Fill, 0, 0); } else { table.Attach(pw,x, x+w, y, y+h, Gtk.AttachOptions.Fill, Gtk.AttachOptions.Fill, 0, 0); } xmax = (uint)Math.Max(xmax, x + w); ymax = (uint)Math.Max(ymax, y + h); } else { GedcomIndividualRecord indi = (GedcomIndividualRecord)_database[famLink.Indi]; if (_showImages && i < ((positions.Length - 1) / 2) && positions[i][0][3] > 1) { } PedigreeBox pw = new PedigreeBox(indi, positions[i][0][3], null); pw.SelectIndividual += PedigreeBox_SelectIndividual; if (positions[i][0][3] < 7) { pw.TooltipMarkup = pw.FormatPerson(11, true); } if (positions[i][0][2] > 1) { table.Attach(pw, x, x+w, y, y+h, Gtk.AttachOptions.Expand | Gtk.AttachOptions.Fill, Gtk.AttachOptions.Expand | Gtk.AttachOptions.Fill, 0, 0); } else { table.Attach(pw, x, x+w, y, y+h, Gtk.AttachOptions.Fill, Gtk.AttachOptions.Fill, 0, 0); } xmax = (uint)Math.Max(xmax, x + w); ymax = (uint)Math.Max(ymax, y + h); } // connection lines if (positions[i].Length > 1) { // separate boxes for father and mother x = positions[i][1][0] + 1; y = positions[i][1][1] + 1; w = 1; h = positions[i][1][2]; Gtk.DrawingArea line = new Gtk.DrawingArea(); line.ExposeEvent += Line_Expose; bool rela = false; if (famLink != null && (famLink.Pedigree == PedegreeLinkageType.Birth || famLink.Pedigree == PedegreeLinkageType.Unknown)) { line.AddEvents((int)Gdk.EventMask.ButtonPressMask); rela = true; } Utility.Pair<int, bool> lineData = new Pair<int,bool>(); lineData.First = i * 2 + 1; lineData.Second = rela; _lines[line] = lineData; table.Attach(line, x, x + w, y, y + h, Gtk.AttachOptions.Fill, Gtk.AttachOptions.Fill, 0, 0); xmax = (uint)Math.Max(xmax, x + w); ymax = (uint)Math.Max(ymax, y + h); x = positions[i][2][0] + 1; y = positions[i][2][1] + 1; w = 1; h = positions[i][2][2]; line = new Gtk.DrawingArea(); line.ExposeEvent += Line_Expose; rela = false; if (famLink != null && (famLink.Pedigree == PedegreeLinkageType.Birth || famLink.Pedigree == PedegreeLinkageType.Unknown)) { line.AddEvents((int)Gdk.EventMask.ButtonPressMask); rela = true; } lineData = new Pair<int,bool>(); lineData.First = i * 2 + 2; lineData.Second = rela; _lines[line] = lineData; table.Attach(line, x, x + w, y, y + h, Gtk.AttachOptions.Fill, Gtk.AttachOptions.Fill, 0, 0); xmax = (uint)Math.Max(xmax, x + w); ymax = (uint)Math.Max(ymax, y + h); } // marriage data if (_showMarriageData && positions[i].Length > 3) { string text = string.Empty; if (famLink != null && (famLink.Pedigree == PedegreeLinkageType.Birth || famLink.Pedigree == PedegreeLinkageType.Unknown)) { text = "foo"; } Gtk.Label label = new Gtk.Label(text); label.Justify = Gtk.Justification.Left; label.LineWrap = true; label.SetAlignment(0.1F, 0.5F); x = positions[i][3][0] + 1; y = positions[i][3][1] + 1; w = positions[i][3][2]; h = positions[i][3][3]; table.Attach(label, x, x + w, y, y + h, Gtk.AttachOptions.Fill, Gtk.AttachOptions.Fill, 0, 0); } } // nav arrows if (lst[0] != null) { Gtk.Button arrowButton = new Gtk.Button(); arrowButton.Add(new Gtk.Arrow(Gtk.ArrowType.Left, Gtk.ShadowType.In)); arrowButton.Sensitive = (_dummyFam.Children.Count > 0); arrowButton.Clicked += ArrowButton_Click; if (arrowButton.Sensitive) { arrowButton.TooltipText = "Jump to child..."; } uint ymid = (uint)Math.Floor(ymax / 2.0F); table.Attach(arrowButton, 0, 1, ymid, ymid + 1, 0, 0, 0, 0); // father arrowButton = new Gtk.Button(); arrowButton.Add(new Gtk.Arrow(Gtk.ArrowType.Right, Gtk.ShadowType.In)); arrowButton.Sensitive = (lst[1] != null); arrowButton.Clicked += FatherButton_Click; if (arrowButton.Sensitive) { arrowButton.TooltipText = "Jump to father"; } ymid = (uint)Math.Floor(ymax / 4.0F); table.Attach(arrowButton, xmax, xmax + 1, ymid - 1, ymid + 2, 0, 0, 0, 0); // mother arrowButton = new Gtk.Button(); arrowButton.Add(new Gtk.Arrow(Gtk.ArrowType.Right, Gtk.ShadowType.In)); arrowButton.Sensitive = (lst[2] != null); arrowButton.Clicked += MotherButton_Click; if (arrowButton.Sensitive) { arrowButton.TooltipText = "Jump to mother"; } ymid = (uint)Math.Floor(ymax / 4.0F * 3); table.Attach(arrowButton, xmax, xmax + 1, ymid - 1, ymid + 2, 0, 0, 0, 0); // dummy widgets to allow pedigree to be centred Gtk.Label l = new Gtk.Label(string.Empty); table.Attach(l, 0, 1, 0, 1, Gtk.AttachOptions.Expand | Gtk.AttachOptions.Fill, Gtk.AttachOptions.Expand | Gtk.AttachOptions.Fill, 0, 0); l = new Gtk.Label(string.Empty); table.Attach(l, xmax, xmax + 1, ymax, ymax + 1, Gtk.AttachOptions.Expand | Gtk.AttachOptions.Fill, Gtk.AttachOptions.Expand | Gtk.AttachOptions.Fill, 0, 0); table.ShowAll(); } }
public EditBlog(string default_label, string default_url, string default_username, string default_password) : base() { HasSeparator = false; BorderWidth = 5; Resizable = false; Title = ""; VBox.Spacing = 12; ActionArea.Layout = Gtk.ButtonBoxStyle.End; Gtk.Button button = new Gtk.Button (Gtk.Stock.Cancel); AddActionWidget (button, Gtk.ResponseType.Cancel); button = new Gtk.Button (Gtk.Stock.Close); AddActionWidget (button, Gtk.ResponseType.Ok); Gtk.HBox hbox = new Gtk.HBox (false, 12); hbox.BorderWidth = 5; VBox.PackStart(hbox, false, false, 0); Gtk.Image image = new Gtk.Image(Gtk.Stock.DialogQuestion, Gtk.IconSize.Dialog); image.Yalign = 0; hbox.PackStart (image, false, false, 0); Gtk.VBox content_vbox = new Gtk.VBox (false, 12); hbox.PackStart (content_vbox, true, true, 0); string title = String.Format ("<span weight='bold' size='larger'>{0}</span>\n", Catalog.GetString("Account information")); Gtk.Label l = new Gtk.Label(title); l.UseMarkup = true; l.Justify = Gtk.Justification.Left; l.LineWrap = true; l.SetAlignment (0.0f, 0.5f); content_vbox.PackStart(l, false, false, 0); l = new Gtk.Label(Catalog.GetString("Enter the information for your blog in the corresponding fields")); l.Justify = Gtk.Justification.Left; l.LineWrap = true; l.SetAlignment (0.0f, 0.5f); content_vbox.PackStart(l, false, false, 0); hbox = new Gtk.HBox(); content_vbox.PackStart(hbox, false, false, 0); l = new Gtk.Label(Catalog.GetString("Label for this blog (only used internally)")); l.Justify = Gtk.Justification.Left; l.LineWrap = true; l.SetAlignment (0.0f, 0.5f); hbox.PackStart(l, false, false, 0); this.label = new Gtk.Entry(default_label); hbox.PackStart(this.label, false, false, 0); hbox = new Gtk.HBox(); content_vbox.PackStart(hbox, false, false, 0); l = new Gtk.Label(Catalog.GetString("URL to Atom Publishing Service or Collection document")); l.Justify = Gtk.Justification.Left; l.LineWrap = true; l.SetAlignment (0.0f, 0.5f); hbox.PackStart(l, false, false, 0); this.url = new Gtk.Entry(default_url); hbox.PackStart(this.url, false, false, 0); hbox = new Gtk.HBox(); content_vbox.PackStart(hbox, false, false, 0); l = new Gtk.Label(Catalog.GetString("Username")); l.Justify = Gtk.Justification.Left; l.LineWrap = true; l.SetAlignment (0.0f, 0.5f); hbox.PackStart(l, false, false, 0); this.username = new Gtk.Entry(default_username); hbox.PackStart(this.username, false, false, 0); hbox = new Gtk.HBox(); content_vbox.PackStart(hbox, false, false, 0); l = new Gtk.Label(Catalog.GetString("Password (optional. Will not be encrypted, just scrambled)")); l.Justify = Gtk.Justification.Left; l.LineWrap = true; l.SetAlignment (0.0f, 0.5f); hbox.PackStart(l, false, false, 0); this.password = new Gtk.Entry(default_password); this.password.Visibility = false; hbox.PackStart(this.password, false, false, 0); ShowAll (); }
public HigMessageDialog (Gtk.Window parent, Gtk.DialogFlags flags, Gtk.MessageType type, Gtk.ButtonsType buttons, string header, string msg) : base () { HasSeparator = false; BorderWidth = 5; Resizable = false; Title = ""; VBox.Spacing = 12; ActionArea.Layout = Gtk.ButtonBoxStyle.End; accel_group = new Gtk.AccelGroup (); AddAccelGroup (accel_group); Gtk.HBox hbox = new Gtk.HBox (false, 12); hbox.BorderWidth = 5; hbox.Show (); VBox.PackStart (hbox, false, false, 0); Gtk.Image image = null; switch (type) { case Gtk.MessageType.Error: image = new Gtk.Image (Gtk.Stock.DialogError, Gtk.IconSize.Dialog); break; case Gtk.MessageType.Question: image = new Gtk.Image (Gtk.Stock.DialogQuestion, Gtk.IconSize.Dialog); break; case Gtk.MessageType.Info: image = new Gtk.Image (Gtk.Stock.DialogInfo, Gtk.IconSize.Dialog); break; case Gtk.MessageType.Warning: image = new Gtk.Image (Gtk.Stock.DialogWarning, Gtk.IconSize.Dialog); break; } image.Show (); hbox.PackStart (image, false, false, 0); Gtk.VBox label_vbox = new Gtk.VBox (false, 0); label_vbox.Show (); hbox.PackStart (label_vbox, true, true, 0); string title = String.Format ("<span weight='bold' size='larger'>{0}" + "</span>\n", header); Gtk.Label label; label = new Gtk.Label (title); label.UseMarkup = true; label.Justify = Gtk.Justification.Left; label.LineWrap = true; label.SetAlignment (0.0f, 0.5f); label.Show (); label_vbox.PackStart (label, false, false, 0); label = new Gtk.Label (msg); label.UseMarkup = true; label.Justify = Gtk.Justification.Left; label.LineWrap = true; label.SetAlignment (0.0f, 0.5f); label.Show (); label_vbox.PackStart (label, false, false, 0); switch (buttons) { case Gtk.ButtonsType.None: break; case Gtk.ButtonsType.Ok: AddButton (Gtk.Stock.Ok, Gtk.ResponseType.Ok, true); break; case Gtk.ButtonsType.Close: AddButton (Gtk.Stock.Close, Gtk.ResponseType.Close, true); break; case Gtk.ButtonsType.Cancel: AddButton (Gtk.Stock.Cancel, Gtk.ResponseType.Cancel, true); break; case Gtk.ButtonsType.YesNo: AddButton (Gtk.Stock.No, Gtk.ResponseType.No, false); AddButton (Gtk.Stock.Yes, Gtk.ResponseType.Yes, true); break; case Gtk.ButtonsType.OkCancel: AddButton (Gtk.Stock.Cancel, Gtk.ResponseType.Cancel, false); AddButton (Gtk.Stock.Ok, Gtk.ResponseType.Ok, true); break; } if (parent != null) TransientFor = parent; if ((int) (flags & Gtk.DialogFlags.Modal) != 0) Modal = true; if ((int) (flags & Gtk.DialogFlags.DestroyWithParent) != 0) DestroyWithParent = true; }
// Utilities... static Gtk.Label MakeLabel (string label_text, params object[] args) { if (args.Length > 0) label_text = String.Format (label_text, args); Gtk.Label label = new Gtk.Label (label_text); label.UseMarkup = true; label.Justify = Gtk.Justification.Left; label.SetAlignment (0.0f, 0.5f); label.Show (); return label; }
public BlogListView(XmlNodeList elements) : base() { HasSeparator = false; BorderWidth = 5; Resizable = false; Title = ""; VBox.Spacing = 12; ActionArea.Layout = Gtk.ButtonBoxStyle.End; Gtk.Button button = new Gtk.Button (Gtk.Stock.Cancel); AddActionWidget (button, Gtk.ResponseType.Cancel); button = new Gtk.Button (Gtk.Stock.Ok); AddActionWidget (button, Gtk.ResponseType.Ok); Gtk.HBox hbox = new Gtk.HBox (false, 12); hbox.BorderWidth = 5; VBox.PackStart(hbox, false, false, 0); Gtk.Image image = new Gtk.Image(Gtk.Stock.DialogQuestion, Gtk.IconSize.Dialog); image.Yalign = 0; hbox.PackStart (image, false, false, 0); Gtk.VBox content_vbox = new Gtk.VBox (false, 12); hbox.PackStart (content_vbox, true, true, 0); string title = String.Format ("<span weight='bold' size='larger'>{0}</span>\n", Catalog.GetString("Multiple blogs")); Gtk.Label l = new Gtk.Label(title); l.UseMarkup = true; l.Justify = Gtk.Justification.Left; l.LineWrap = true; l.SetAlignment (0.0f, 0.5f); content_vbox.PackStart(l, false, false, 0); l = new Gtk.Label(Catalog.GetString("I found serveral blogs. Please chose which one you would like to send your post to.")); l.UseMarkup = true; l.Justify = Gtk.Justification.Left; l.LineWrap = true; l.SetAlignment (0.0f, 0.5f); content_vbox.PackStart(l, false, false, 0); item_list = Gtk.ComboBox.NewText(); name_to_node = new Hashtable(); foreach (XmlNode node in elements) { string text = node.SelectSingleNode ("label/text()").Value; item_list.AppendText (text); name_to_node[text] = node; } content_vbox.PackStart (item_list, false, false, 0); ShowAll (); }
public AskForLoginData(string label, string username, string password) { HasSeparator = false; BorderWidth = 5; Resizable = false; Title = ""; VBox.Spacing = 12; ActionArea.Layout = Gtk.ButtonBoxStyle.End; Gtk.Button button = new Gtk.Button (Gtk.Stock.Cancel); AddActionWidget (button, Gtk.ResponseType.Cancel); button = new Gtk.Button (Gtk.Stock.Ok); AddActionWidget (button, Gtk.ResponseType.Ok); Gtk.HBox hbox = new Gtk.HBox (false, 12); hbox.BorderWidth = 5; VBox.PackStart(hbox, false, false, 0); Gtk.Image image = new Gtk.Image(Gtk.Stock.DialogQuestion, Gtk.IconSize.Dialog); image.Yalign = 0; hbox.PackStart (image, false, false, 0); Gtk.VBox content_vbox = new Gtk.VBox (false, 12); hbox.PackStart (content_vbox, true, true, 0); string title = String.Format ("<span weight='bold' size='larger'>{0} {1}</span>\n", Catalog.GetString("Login to"), label); Gtk.Label l = new Gtk.Label(title); l.UseMarkup = true; l.Justify = Gtk.Justification.Left; l.LineWrap = true; l.SetAlignment (0.0f, 0.5f); content_vbox.PackStart(l, false, false, 0); l = new Gtk.Label(Catalog.GetString("Username:"******"Password:"******"Save info"); _save.Active = false; content_vbox.PackStart (_save, false, false, 0); ShowAll (); }
public Gtk.Label AddSnippet () { AddNewLine (); snippet = WidgetFu.NewLabel (); snippet.SetAlignment (0.0f, 0.0f); snippet.Selectable = true; WidgetFu.EllipsizeLabel (snippet); snippet.Show (); Attach (snippet, 1, 2, current_row, ++current_row, expand, fill, 0, 0); maximized = false; snippet_tip = new Gtk.Tooltips (); return snippet; }