private void Build() { // Set up our notebook VBox.Homogeneous = false; VBox.Spacing = 3; VBox.PackStart(_nb, true, true, 0); _nb.InsertPage(_general, new Label("General"), -1); _nb.InsertPage(_accounts, new Label("Accounts"), -1); _nb.InsertPage(_recognition, new Label("Recognition"), -1); _nb.InsertPage(_torrents, new Label("Torrents"), -1); // Lets add our buttons that go on the bottom ActionArea.PackEnd(_hAlign, false, false, 0); _hAlign.SetPadding(0, 5, 0, 5); _hAlign.Add(_buttons); _buttons.Add(_ok); _ok.Clicked += delegate { Apply(); Respond(ResponseType.Accept); }; _ok.GrabDefault(); _ok.SetSizeRequest(70, 30); _buttons.Add(_cancel); _cancel.Clicked += delegate { Respond(ResponseType.Cancel); }; _buttons.Add(_apply); _apply.Clicked += delegate { Apply(); }; // General tab _general.Add(_onTop); }
public MessageDialogUrl(string[] labelButtons, string primaryLabel, string secondaryLabel, string secondaryUrl, MessageType messageType) { InicializeComponent(); TransientFor = MainClass.MainWindow; Buttons = buttons; PrimaryText = primaryLabel; linkBtn.Label = secondaryLabel; linkBtn.LinkUrl = secondaryUrl; MessageType = messageType; Widget[] oldButtons = ActionArea.Children; foreach (Widget w in oldButtons) { ActionArea.Remove(w); } int i = 1; foreach (string s in labelButtons) { AddButton(s, -i); i++; } }
public ProgressDialog(MonoDevelop.Components.Window parent, bool allowCancel, bool showDetails) { MonoDevelop.Components.IdeTheme.ApplyTheme(this); this.Build(); this.Title = BrandingService.ApplicationName; HasSeparator = false; ActionArea.Hide(); DefaultHeight = 5; TransientFor = parent; btnCancel.Visible = allowCancel; expander.Visible = showDetails; buffer = detailsTextView.Buffer; detailsTextView.Editable = false; bold = new TextTag("bold"); bold.Weight = Pango.Weight.Bold; buffer.TagTable.Add(bold); tag = new TextTag("0"); tag.Indent = 10; buffer.TagTable.Add(tag); tags.Add(tag); }
void InsertFilterEntry() { filterEntry = new SearchEntry(); filterEntry.Entry.SetSizeRequest(200, filterEntry.Entry.SizeRequest().Height); filterEntry.SizeAllocated += (o, args) => { RepositionFilter(); }; ActionArea.PackEnd(filterEntry); var btnCloseBoxChild = ((Box.BoxChild)(ActionArea [btnClose])); btnCloseBoxChild.Position = 2; filterEntry.Show(); notebook.SizeAllocated += delegate { RepositionFilter(); }; filterEntry.TextChanged += delegate { tree.SetFilter(filterEntry.Text); galleryTree.SetFilter(filterEntry.Text); updatesTree.SetFilter(filterEntry.Text); LoadAll(); addinTree.ExpandAll(); galleryTreeView.ExpandAll(); }; RepositionFilter(); }
public ExceptionCaughtDialog(ExceptionInfo val, ExceptionCaughtMessage msg) { Title = GettextCatalog.GetString("Exception Caught"); ex = val; widget = new ExceptionCaughtWidget(val); this.msg = msg; VBox box = new VBox(); box.Spacing = 6; box.PackStart(widget, true, true, 0); HButtonBox buttonBox = new HButtonBox(); buttonBox.BorderWidth = 6; var copy = new Gtk.Button(GettextCatalog.GetString("Copy to Clipboard")); buttonBox.PackStart(copy, false, false, 0); copy.Clicked += HandleCopyClicked; var close = new Gtk.Button(GettextCatalog.GetString("Close")); buttonBox.PackStart(close, false, false, 0); close.Clicked += (sender, e) => msg.Close(); close.Activated += (sender, e) => msg.Close(); box.PackStart(buttonBox, false, false, 0); VBox.Add(box); DefaultWidth = 500; DefaultHeight = 350; box.ShowAll(); ActionArea.Hide(); }
public ProgressDialog(Window parent, bool allowCancel, bool showDetails) { this.Build(); HasSeparator = false; ActionArea.Hide(); DefaultHeight = 5; TransientFor = parent; btnCancel.Visible = allowCancel; expander.Visible = showDetails; buffer = detailsTextView.Buffer; detailsTextView.Editable = false; bold = new TextTag("bold"); bold.Weight = Pango.Weight.Bold; buffer.TagTable.Add(bold); tag = new TextTag("0"); tag.Indent = 10; buffer.TagTable.Add(tag); tags.Add(tag); }
private void Build() { EpisodeCounter = new HBox(false, 0); // Put a SpinButton for episodes in here if needed HeaderTable = new Table(0, 0, false); // set column and row counts based on specific needs Header = BuildHeader(); Nb = new Notebook(); ListWindow = new ScrolledWindow(); ViewWindow = new ScrolledWindow(); ListTable = BuildListTable(); //Make the notebook ListWindow.Add(new Viewport() { ListTable }); ViewWindow.Add(new Viewport() { ViewTable }); if (Original.ListStatus != ApiEntry.ListStatuses.NotInList) { Nb.AppendPage(ListWindow, new Label("List")); } Nb.AppendPage(ViewWindow, new Label("Details")); // Pack everything VBox.PackStart(Header, false, false, 5); VBox.Add(Nb); ActionArea.PackEnd(BuildButtons()); }
public MessageDialog(string[] labelButtons, string primaryLabel, string secondaryLabel, MessageType messageType, Gtk.Window parent) { InicializeComponent(); if (parent != null) { TransientFor = parent; } else { TransientFor = MainClass.MainWindow; } Buttons = buttons; PrimaryText = primaryLabel; SecondaryText = secondaryLabel; MessageType = messageType; Widget[] oldButtons = ActionArea.Children; foreach (Widget w in oldButtons) { ActionArea.Remove(w); } int i = 1; foreach (string s in labelButtons) { AddButton(s, -i); i++; } }
public AddinInstallDialog(SetupService service) { Build(); this.service = service; wizardNotebook.ShowTabs = false; ActionArea.Hide(); tree = new InstallAddinTreeWidget(addinTree); tree.AllowSelection = true; tree.SelectionChanged += new EventHandler(OnAddinSelectionChanged); repoStore = new ListStore(typeof(string), typeof(string)); repoCombo.Model = repoStore; CellRendererText crt = new CellRendererText(); repoCombo.PackStart(crt, true); repoCombo.AddAttribute(crt, "text", 0); filterComboBox.Active = 1; imageInstall.Stock = "md-software-update"; imageInstall.IconSize = (int)IconSize.Dialog; FillRepos(); repoCombo.Active = 0; LoadAddins(); FillAddinInfo(); OnPageChanged(); }
private void Build() { BorderWidth = 10; _pinEntry = new Entry(); _ok = new Button("OK"); _cancel = new Button("Cancel"); VBox.PackStart( new Label("To continue, please log into AniList and paste the authorization pin here.") { Justify = Justification.Center }, false, false, 10); VBox.Add(_pinEntry); // Buttons _ok.SetSizeRequest(70, 30); ActionArea.Homogeneous = true; ActionArea.PackEnd(_ok, false, false, 5); ActionArea.PackEnd(_cancel, false, false, 0); //Events DestroyEvent += OnCancel; _ok.Clicked += OnOk; _cancel.Clicked += OnCancel; }
public ErrorMessageView(ErrorMessageViewModel viewModel) { ViewModel = viewModel ?? throw new ArgumentNullException(nameof(viewModel)); this.Build(); this.SetPosition(WindowPosition.CenterOnParent); ActionArea.ChildVisible = false; ActionArea.SetSizeRequest(0, 0); ConfigureDlg(); }
private Game.ExecutionEvent FinishedCallbackFor(ActionArea data, Game.ExecutionEvent onExecutionFinished) { return(_ => { if (onExecutionFinished != null) { onExecutionFinished(data.action); } }); }
public CommonAboutDialog() { Name = "wizard_dialog"; Title = string.Format(GettextCatalog.GetString("About {0}"), BrandingService.ApplicationLongName); TransientFor = IdeApp.Workbench.RootWindow; AllowGrow = false; HasSeparator = false; BorderWidth = 0; var notebook = new Notebook(); notebook.ShowTabs = false; notebook.ShowBorder = false; notebook.BorderWidth = 0; notebook.AppendPage(new AboutMonoDevelopTabPage(), new Label(Title)); notebook.AppendPage(new VersionInformationTabPage(), new Label(GettextCatalog.GetString("Version Information"))); VBox.PackStart(notebook, true, true, 0); var copyButton = new Button() { Label = GettextCatalog.GetString("Copy Information") }; copyButton.Clicked += (sender, e) => CopyBufferToClipboard(); ActionArea.PackEnd(copyButton, false, false, 0); copyButton.NoShowAll = true; var backButton = new Button() { Label = GettextCatalog.GetString("Show Details") }; ActionArea.PackEnd(backButton, false, false, 0); backButton.Clicked += (sender, e) => { if (notebook.Page == 0) { backButton.Label = GettextCatalog.GetString("Hide Details"); copyButton.Show(); notebook.Page = 1; } else { backButton.Label = GettextCatalog.GetString("Show Details"); copyButton.Hide(); notebook.Page = 0; } }; AddButton(Gtk.Stock.Close, (int)ResponseType.Close); ShowAll(); }
/// <summary>Crea una instancia de la clase.</summary> /// <param name="parent">La ventana padre de este diálogo.</param> private DialogoConfiguracion(Gtk.Window parent) : base("", parent, Gtk.DialogFlags.DestroyWithParent) { Title = Ventana.GetText("DialogoConfiguracion_Title"); TransientFor = parent; Modal = true; Resizable = false; DeleteEvent += new DeleteEventHandler(Ventana.OcultarVentana); Resize(300, 300); BorderWidth = 10; HasSeparator = true; VBox.Add(this.CrearNotebook()); ActionArea.Add(this.CrearPanelInferior()); }
private void Build() { var hbox = new HBox(); hbox.Spacing = 6; hbox.BorderWidth = 12; var error_icon = new Image(); error_icon.Pixbuf = PintaCore.Resources.GetIcon(Stock.DialogError, 32); error_icon.Yalign = 0; hbox.PackStart(error_icon, false, false, 0); var vbox = new VBox(); vbox.Spacing = 6; description_label = new Label(); description_label.Wrap = true; description_label.Xalign = 0; vbox.PackStart(description_label, false, false, 0); expander = new Expander(Catalog.GetString("Details")); details_text = new TextView(); var scroll = new ScrolledWindow(); scroll.Add(details_text); scroll.HeightRequest = 250; expander.Add(scroll); vbox.Add(expander); hbox.Add(vbox); this.VBox.Add(hbox); bug_report_button = new Button(Catalog.GetString("Report Bug....")); bug_report_button.CanFocus = false; ActionArea.Add(bug_report_button); var ok_button = new Button(Gtk.Stock.Ok); ok_button.CanDefault = true; AddActionWidget(ok_button, ResponseType.Ok); DefaultWidth = 600; DefaultHeight = 142; ShowAll(); }
void Build() { Title = GettextCatalog.GetString("Exception Caught"); DefaultHeight = 500; DefaultWidth = 600; VBox.Spacing = 0; VBox.PackStart(CreateExceptionHeader(), false, true, 0); var paned = new VPaned(); paned.Add1(CreateExceptionValueTreeView()); paned.Add2(CreateStackTraceTreeView()); paned.Show(); var vbox = new VBox(false, 0); vbox.PackStart(CreateSeparator(), false, true, 0); vbox.PackStart(paned, true, true, 0); vbox.PackStart(CreateSeparator(), false, true, 0); vbox.Show(); VBox.PackStart(vbox, true, true, 0); var actionArea = new HBox(false, 12) { BorderWidth = 6 }; OnlyShowMyCodeCheckbox = new CheckButton(GettextCatalog.GetString("_Only show my code.")); OnlyShowMyCodeCheckbox.Toggled += OnlyShowMyCodeToggled; OnlyShowMyCodeCheckbox.Show(); OnlyShowMyCodeCheckbox.Active = DebuggingService.GetUserOptions().ProjectAssembliesOnly; var alignment = new Alignment(0.0f, 0.5f, 0.0f, 0.0f) { Child = OnlyShowMyCodeCheckbox }; alignment.Show(); actionArea.PackStart(alignment, true, true, 0); actionArea.PackStart(CreateButtonBox(), false, true, 0); actionArea.Show(); VBox.PackStart(actionArea, false, true, 0); ActionArea.Hide(); }
public TouchDialog(string msg, Window parent, string[] buttons) : base(string.Empty, parent, DialogFlags.DestroyWithParent) { ModifyBg(StateType.Normal, TouchColor.NewGtkColor("grey0")); KeepAbove = true; #if RPI_BUILD Decorated = false; ExposeEvent += (o, args) => { using (Context cr = Gdk.CairoHelper.Create(GdkWindow)) { cr.MoveTo(Allocation.Left, Allocation.Top); cr.LineTo(Allocation.Right, Allocation.Top); cr.LineTo(Allocation.Right, Allocation.Bottom); cr.LineTo(Allocation.Left, Allocation.Bottom); cr.ClosePath(); cr.LineWidth = 1.8; TouchColor.SetSource(cr, "grey4"); cr.Stroke(); } }; #endif foreach (var button in buttons) { try { var response = (ResponseType)Enum.Parse(typeof(ResponseType), button); var btn = new TouchButton(); btn.text = button; btn.HeightRequest = 30; btn.ButtonReleaseEvent += (o, args) => Respond(response); ActionArea.Add(btn); } catch { // } } var label = new Label(); label.LineWrap = true; label.Text = msg; label.ModifyFg(StateType.Normal, TouchColor.NewGtkColor("white")); label.ModifyFont(Pango.FontDescription.FromString("Sans 11")); VBox.Add(label); label.Show(); }
public LogViewerDialog(TextBuffer buffer) : base() { this.Title = Mono.Unix.Catalog.GetString("MonoVS Log Viewer"); this.Icon = new Pixbuf(Assembly.GetExecutingAssembly(), "monotools.png"); this.SetDefaultSize(750, 350); view = new TextView(buffer); view.Editable = false; view.CursorVisible = true; view.Buffer.Changed += OnTextChanged; ScrolledWindow sw = new ScrolledWindow(); sw.HscrollbarPolicy = PolicyType.Automatic; sw.VscrollbarPolicy = PolicyType.Automatic; sw.ShadowType = ShadowType.In; sw.BorderWidth = 6; sw.Add(view); VBox.PackStart(sw); Button button_clear = new Gtk.Button(); button_clear.CanDefault = true; button_clear.CanFocus = true; button_clear.Name = "buttonOk"; button_clear.UseStock = true; button_clear.UseUnderline = true; button_clear.Label = "gtk-clear"; button_clear.Clicked += new System.EventHandler(OnButtonClearClicked); ActionArea.Add(button_clear); Button button_close = new Gtk.Button(); button_close.CanDefault = true; button_close.CanFocus = true; button_close.Name = "buttonOk"; button_close.UseStock = true; button_close.UseUnderline = true; button_close.Label = "gtk-close"; AddActionWidget(button_close, ResponseType.Close); this.ShowAll(); }
public GtkErrorDialog(Window parent) { this.Build(); this.Title = BrandingService.ApplicationName; TransientFor = parent; descriptionLabel.ModifyBg(StateType.Normal, new Gdk.Color(255, 0, 0)); tagNoWrap = new TextTag("nowrap"); tagNoWrap.WrapMode = WrapMode.None; detailsTextView.Buffer.TagTable.Add(tagNoWrap); tagWrap = new TextTag("wrap"); tagWrap.WrapMode = WrapMode.Word; detailsTextView.Buffer.TagTable.Add(tagWrap); expander.Visible = false; ActionArea.Homogeneous = true; ActionArea.Remove(okButton); }
public ProfileConfigurationDialog(Profile profile) : base() { this.profile = profile; HasSeparator = false; BorderWidth = 5; AccelGroup accel_group = new AccelGroup(); AddAccelGroup(accel_group); Button button = new Button(Stock.Close); button.CanDefault = true; button.Show(); if (ApplicationContext.Debugging) { Button test_button = new Button("Test S-Expr"); test_button.Show(); test_button.Clicked += delegate { if (sexpr_results != null) { sexpr_results.Buffer.Text = profile.Pipeline.GetDefaultProcess(); } }; ActionArea.PackStart(test_button, true, true, 0); sexpr_results = new TextView(); } AddActionWidget(button, ResponseType.Close); DefaultResponse = ResponseType.Close; button.AddAccelerator("activate", accel_group, (uint)Gdk.Key.Return, 0, AccelFlags.Visible); BuildContents(); LoadProfile(); }
private void AddNavigationButtons() { if (TrackCount <= 1) { return; } nav_backward_button = new Button(Stock.GoBack); nav_backward_button.UseStock = true; nav_backward_button.Clicked += delegate { NavigateBackward(); }; nav_backward_button.Show(); TooltipSetter.Set(tooltip_host, nav_backward_button, Catalog.GetString("Show the previous track")); nav_forward_button = new Button(Stock.GoForward); nav_forward_button.UseStock = true; nav_forward_button.Clicked += delegate { NavigateForward(); }; nav_forward_button.Show(); TooltipSetter.Set(tooltip_host, nav_forward_button, Catalog.GetString("Show the next track")); ActionArea.PackStart(nav_backward_button, false, false, 0); ActionArea.PackStart(nav_forward_button, false, false, 0); ActionArea.SetChildSecondary(nav_backward_button, true); ActionArea.SetChildSecondary(nav_forward_button, true); }
// FIXME: The total parameter makes sense, but doesn't seem to ever be used? public ThreadProgressDialog(Thread thread, int total) { /* * if (parent_window) * this.TransientFor = parent_window; * */ Title = thread.Name; this.thread = thread; HasSeparator = false; BorderWidth = 6; SetDefaultSize(300, -1); message_label = new Gtk.Label(string.Empty); VBox.PackStart(message_label, true, true, 12); progress_bar = new Gtk.ProgressBar(); VBox.PackStart(progress_bar, true, true, 6); retry_button = new Gtk.Button(Catalog.GetString("Retry")); retry_button.Clicked += HandleRetryClicked; skip_button = new Gtk.Button(Catalog.GetString("Skip")); skip_button.Clicked += HandleSkipClicked; ActionArea.Add(retry_button); ActionArea.Add(skip_button); button_label = Gtk.Stock.Cancel; button = (Gtk.Button)AddButton(button_label, (int)Gtk.ResponseType.Cancel); //delay = new DelayedOperation (new GLib.IdleHandler (HandleUpdate)); Response += HandleResponse; Destroyed += HandleDestroy; }
private void BuildUI() { d_notebook = new Notebook(); d_notebook.Show(); d_notebook.BorderWidth = 6; Label lbl; lbl = new Label("Show"); lbl.Show(); d_notebook.AppendPage(PageAlignment(BuildShowPage()), lbl); lbl = new Label("Colors"); lbl.Show(); d_notebook.AppendPage(PageAlignment(BuildColorsPage()), lbl); VBox.PackStart(d_notebook, true, true, 0); Button revert = new Button(Gtk.Stock.RevertToSaved); revert.Show(); ActionArea.PackStart(revert, false, false, 0); ActionArea.ReorderChild(revert, 0); revert.TooltipText = "Revert to original settings"; revert.Clicked += delegate { d_updating = true; d_settings.Revert(); d_update(this, new EventArgs()); d_updating = false; }; }
public override GuiWidget AddChild(GuiWidget childToAdd, int indexInChildrenList = -1) { return(ActionArea.AddChild(childToAdd, indexInChildrenList)); }
public LevelsDialog(LevelsData effectData) : base(Catalog.GetString("Levels Adjustment"), PintaCore.Chrome.MainWindow, DialogFlags.Modal) { this.Build(); EffectData = effectData; mask = new bool[] { true, true, true }; this.HasSeparator = false; //hack allowing adding hbox with rgb checkboxes into dialog action area VBox.Remove(hboxBottom); foreach (Widget widget in hboxBottom) { hboxBottom.Remove(widget); if (widget == buttonOk) { AddActionWidget(widget, ResponseType.Ok); } else { ActionArea.PackEnd(widget); } } UpdateInputHistogram(); Reset(); UpdateLevels(); checkRed.Toggled += HandleCheckRedToggled; checkGreen.Toggled += HandleCheckGreenToggled; checkBlue.Toggled += HandleCheckBlueToggled; buttonReset.Clicked += HandleButtonResetClicked; buttonAuto.Clicked += HandleButtonAutoClicked; buttonCancel.Clicked += HandleButtonCancelClicked; buttonOk.Clicked += HandleButtonOkClicked; spinInLow.ValueChanged += HandleSpinInLowValueChanged; spinInHigh.ValueChanged += HandleSpinInHighValueChanged; spinOutLow.ValueChanged += HandleSpinOutLowValueChanged; spinOutGamma.ValueChanged += HandleSpinOutGammaValueChanged; spinOutHigh.ValueChanged += HandleSpinOutHighValueChanged; gradientInput.ValueChanged += HandleGradientInputValueChanged; gradientOutput.ValueChanged += HandleGradientOutputValueChanged; gradientInput.ButtonReleaseEvent += HandleGradientButtonReleaseEvent; gradientOutput.ButtonReleaseEvent += HandleGradientButtonReleaseEvent; gradientInput.ButtonPressEvent += HandleGradientButtonPressEvent; gradientOutput.ButtonPressEvent += HandleGradientButtonPressEvent; colorpanelInLow.ButtonPressEvent += HandleColorPanelButtonPressEvent; colorpanelInHigh.ButtonPressEvent += HandleColorPanelButtonPressEvent; colorpanelOutLow.ButtonPressEvent += HandleColorPanelButtonPressEvent; colorpanelOutHigh.ButtonPressEvent += HandleColorPanelButtonPressEvent; if (Gtk.Global.AlternativeDialogButtonOrder(this.Screen)) { hboxBottom.ReorderChild(buttonCancel, 0); } buttonOk.CanDefault = true; DefaultResponse = ResponseType.Ok; spinInLow.ActivatesDefault = true; spinInHigh.ActivatesDefault = true; spinOutGamma.ActivatesDefault = true; spinOutLow.ActivatesDefault = true; spinOutHigh.ActivatesDefault = true; }
public GtkAlertDialog(MessageDescription message) { Init(); this.buttons = message.Buttons.ToArray(); string primaryText; string secondaryText; if (string.IsNullOrEmpty(message.SecondaryText)) { secondaryText = message.Text; primaryText = null; } else { primaryText = message.Text; secondaryText = message.SecondaryText; } image.SetFromStock(Util.ToGtkStock(message.Icon), Gtk.IconSize.Dialog); StringBuilder markup = new StringBuilder(@"<span weight=""bold"" size=""larger"">"); markup.Append(GLib.Markup.EscapeText(primaryText)); markup.Append("</span>"); if (!String.IsNullOrEmpty(secondaryText)) { if (!String.IsNullOrEmpty(primaryText)) { markup.AppendLine(); markup.AppendLine(); } markup.Append(GLib.Markup.EscapeText(secondaryText)); } label.Markup = markup.ToString(); label.Selectable = true; label.CanFocus = false; foreach (Command button in message.Buttons) { Gtk.Button newButton = new Gtk.Button(); newButton.Label = button.Label; newButton.UseUnderline = true; newButton.UseStock = button.IsStockButton; if (!String.IsNullOrEmpty(button.Icon)) { newButton.Image = new Gtk.Image(Util.ToGtkStock(button.Icon), Gtk.IconSize.Button); } newButton.Clicked += ButtonClicked; ActionArea.Add(newButton); } foreach (var op in message.Options) { CheckButton check = new CheckButton(op.Text); check.Active = op.Value; labelsBox.PackStart(check, false, false, 0); check.Toggled += delegate { message.SetOptionValue(op.Id, check.Active); }; } if (message.AllowApplyToAll) { CheckButton check = new CheckButton("Apply to all"); labelsBox.PackStart(check, false, false, 0); check.Toggled += delegate { ApplyToAll = check.Active; }; } //don't show this yet, let the consumer decide when this.Child.ShowAll(); }
public override void AddChild(GuiWidget childToAdd, int indexInChildrenList = -1) { ActionArea.AddChild(childToAdd, indexInChildrenList); }
public GtkAlertDialog(MessageDescription message) { Init(); this.buttons = message.Buttons.ToArray(); this.message = message; Modal = true; string primaryText; string secondaryText; if (string.IsNullOrEmpty(message.SecondaryText)) { secondaryText = message.Text; primaryText = null; } else { primaryText = message.Text; secondaryText = message.SecondaryText; } if (!message.UseMarkup) { primaryText = GLib.Markup.EscapeText(primaryText); secondaryText = GLib.Markup.EscapeText(secondaryText); } if (!string.IsNullOrEmpty(message.Icon)) { image = new ImageView(); image.Yalign = 0.00f; image.Image = ImageService.GetIcon(message.Icon, IconSize.Dialog); hbox.PackStart(image, false, false, 0); hbox.ReorderChild(image, 0); } StringBuilder markup = new StringBuilder(@"<span weight=""bold"" size=""larger"">"); markup.Append(primaryText); markup.Append("</span>"); if (!String.IsNullOrEmpty(secondaryText)) { if (!String.IsNullOrEmpty(primaryText)) { markup.AppendLine(); markup.AppendLine(); } markup.Append(secondaryText); } label.Markup = markup.ToString(); label.Selectable = true; label.CanFocus = false; foreach (AlertButton button in message.Buttons) { Button newButton = new Button(); newButton.Label = button.Label; newButton.UseUnderline = true; newButton.UseStock = button.IsStockButton; if (!String.IsNullOrEmpty(button.Icon)) { newButton.Image = new ImageView(button.Icon, IconSize.Button); } newButton.Clicked += ButtonClicked; ActionArea.Add(newButton); } foreach (var op in message.Options) { CheckButton check = new CheckButton(op.Text); check.Active = op.Value; labelsBox.PackStart(check, false, false, 0); check.Toggled += delegate { message.SetOptionValue(op.Id, check.Active); }; } if (message.AllowApplyToAll) { CheckButton check = new CheckButton(GettextCatalog.GetString("Apply to all")); labelsBox.PackStart(check, false, false, 0); check.Toggled += delegate { ApplyToAll = check.Active; }; } //don't show this yet, let the consumer decide when this.Child.ShowAll(); }
public AlertDialog(MessageDescription message) { Init(); this.buttons = message.buttons.ToArray(); string primaryText; string secondaryText; if (string.IsNullOrEmpty(message.SecondaryText)) { secondaryText = message.Text; primaryText = null; } else { primaryText = message.Text; secondaryText = message.SecondaryText; } image.Pixbuf = ImageService.GetPixbuf(message.Icon, IconSize.Dialog); StringBuilder markup = new StringBuilder(@"<span weight=""bold"" size=""larger"">"); markup.Append(GLib.Markup.EscapeText(primaryText)); markup.Append("</span>"); if (!String.IsNullOrEmpty(secondaryText)) { if (!String.IsNullOrEmpty(primaryText)) { markup.AppendLine(); markup.AppendLine(); } markup.Append(GLib.Markup.EscapeText(secondaryText)); } label.Markup = markup.ToString(); label.Selectable = true; foreach (AlertButton button in message.buttons) { Button newButton = new Button(); newButton.Label = button.Label; newButton.UseUnderline = true; newButton.UseStock = button.IsStockButton; if (!String.IsNullOrEmpty(button.Icon)) { newButton.Image = new Image(button.Icon, IconSize.Button); } newButton.Clicked += ButtonClicked; ActionArea.Add(newButton); } foreach (MessageDescription.Option op in message.Options) { CheckButton check = new CheckButton(op.Text); check.Active = op.Value; labelsBox.PackStart(check, false, false, 0); check.Toggled += delegate { message.SetOptionValue(op.Id, check.Active); }; } if (message.AllowApplyToAll) { CheckButton check = new CheckButton(GettextCatalog.GetString("Apply to all")); labelsBox.PackStart(check, false, false, 0); check.Toggled += delegate { ApplyToAll = check.Active; }; } this.ShowAll(); }
private void Build() { _type = new ComboBox(_options); _type.Changed += OnProviderChange; _userLabel = new Label("Username"); _username = new Entry(); _username.Changed += OnTextChange; _passLabel = new Label("Password"); _password = new Entry() { Visibility = false }; _password.Changed += OnTextChange; _defAnimeCheck = new CheckButton("Use this account for managing anime") { Name = "defAnime", Sensitive = false }; _defAnimeCheck.Toggled += OnToggle; _defMangaCheck = new CheckButton("Use this account for managing manga") { Name = "defManga", Sensitive = false }; _defMangaCheck.Toggled += OnToggle; _okButton = new Button("OK"); _okButton.SetSizeRequest(70, 30); _okButton.CanDefault = true; _okButton.Clicked += OnOkButton; _okButton.Sensitive = false; _cancelButton = new Button("Cancel"); _cancelButton.SetSizeRequest(70, 30); _cancelButton.Clicked += delegate { Respond(ResponseType.Cancel); }; var hb1 = new HBox(); hb1.PackStart(_userLabel, false, false, 7); hb1.Add(_username); VBox.Add(hb1); var hb2 = new HBox(); hb2.PackStart(_passLabel, false, true, 7); hb2.Add(_password); VBox.Add(hb2); var bb = new VButtonBox { _defAnimeCheck, _defMangaCheck }; VBox.Add(bb); var hb3 = new HBox(); hb3.PackStart(new Label("Type"), false, false, 7); hb3.Add(_type); VBox.Add(hb3); ActionArea.Add(_okButton); _okButton.GrabDefault(); // Activates when you hit enter ActionArea.Add(_cancelButton); ShowAll(); }