public void AddTab (Gtk.Widget page, Gdk.Pixbuf icon, string label) { Tab tab = new Tab (); tab.SetLabel (page, icon, label); tab.ShowAll (); box.PackStart (tab, true, true, 0); if (currentTab == -1) CurrentTab = box.Children.Length - 1; else { tab.Active = false; page.Hide (); } tab.ButtonPressEvent += OnTabPress; }
void UpdateButton(DialogButton btn, Gtk.Button b) { if (!string.IsNullOrEmpty (btn.Label) && btn.Image == null) { b.Label = btn.Label; } else if (string.IsNullOrEmpty (btn.Label) && btn.Image != null) { var pix = btn.Image.ToImageDescription (); b.Image = new ImageBox (ApplicationContext, pix); } else if (!string.IsNullOrEmpty (btn.Label)) { Gtk.Box box = new Gtk.HBox (false, 3); var pix = btn.Image.ToImageDescription (); box.PackStart (new ImageBox (ApplicationContext, pix), false, false, 0); box.PackStart (new Gtk.Label (btn.Label), true, true, 0); b.Image = box; } if (btn.Visible) b.ShowAll (); else b.Hide (); b.Sensitive = btn.Sensitive; UpdateActionAreaVisibility (); }
void UpdateButton(DialogButton btn, Gtk.Button b) { if (!string.IsNullOrEmpty (btn.Label) && btn.Image == null) { b.Label = btn.Label; } else if (string.IsNullOrEmpty (btn.Label) && btn.Image != null) { var pix = (Gdk.Pixbuf) Toolkit.GetBackend (btn.Image); b.Image = new Gtk.Image (pix); } else if (!string.IsNullOrEmpty (btn.Label)) { Gtk.Box box = new Gtk.HBox (false, 3); var pix = (Gdk.Pixbuf) Toolkit.GetBackend (btn.Image); box.PackStart (new Gtk.Image (pix), false, false, 0); box.PackStart (new Gtk.Label (btn.Label), true, true, 0); b.Image = box; } if (btn.Visible) b.ShowAll (); else b.Hide (); b.Sensitive = btn.Sensitive; UpdateActionAreaVisibility (); }
public ExceptionWindow(String name, Exception exp, Gtk.Window winToHide) : base("Exception Caught: " + name + " Must Close") { //e.Message //e.StackTrace //GLib.Markup.EscapeText(error) exception = exp; Gtk.VBox box = new Gtk.VBox(false, 5); box.PackStart(new Gtk.Label(name + " has thrown an exception and must close.\n" + "This window contains exception information to\n" + "assist the developer in fixing this bug.")); //Style.LookupIconSet("Error") Gtk.TextView messageView = new Gtk.TextView (); messageView.Buffer.Text = exception.Message; Gtk.ScrolledWindow messageViewSW = new Gtk.ScrolledWindow(); messageViewSW.HscrollbarPolicy = Gtk.PolicyType.Automatic; messageViewSW.VscrollbarPolicy = Gtk.PolicyType.Automatic; messageViewSW.ShadowType = Gtk.ShadowType.In; messageViewSW.Add(messageView); Gtk.TextView traceView = new Gtk.TextView (); traceView.Buffer.Text = exception.StackTrace; Gtk.ScrolledWindow traceViewSW = new Gtk.ScrolledWindow(); traceViewSW.HscrollbarPolicy = Gtk.PolicyType.Automatic; traceViewSW.VscrollbarPolicy = Gtk.PolicyType.Automatic; traceViewSW.ShadowType = Gtk.ShadowType.In; traceViewSW.Add(traceView); box.PackStart(messageViewSW); box.PackStart(new Gtk.HSeparator()); box.PackStart(traceViewSW); Gtk.HBox buttonbox = new Gtk.HBox(); Gtk.Button close = new Gtk.Button(Gtk.Stock.Close); close.UseStock = true; close.Clicked += onClose; Gtk.Button save = new Gtk.Button(Gtk.Stock.Save); save.UseStock = true; save.Clicked += onSave; save.Sensitive = false; buttonbox.PackStart(save); buttonbox.PackStart(close); box.PackStart(buttonbox); this.Add(box); this.Modal = true; if (winToHide != null) { winToHide.Hide(); } this.SetSizeRequest(600,450); this.ShowAll(); Application.Run(); }