public override Image GetStockIcon(string id) { return(ApplicationContext.Toolkit.WrapImage(Util.ToGtkStock(id))); }
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(); }