public NotebookTabLabel(string title, string path = "/") { Text = title; Path = path; Button button = new Button(); button.Image = new Gtk.Image(Stock.Close, IconSize.SmallToolbar); button.TooltipText = "Close"; button.Relief = ReliefStyle.None; RcStyle rcStyle = new RcStyle(); rcStyle.Xthickness = 0; rcStyle.Ythickness = 0; button.ModifyStyle(rcStyle); button.FocusOnClick = false; button.Clicked += OnCloseClicked; button.Show(); Label label = new Label(title); label.UseMarkup = false; label.UseUnderline = false; label.Show(); HBox hbox = new HBox(false, 0); hbox.Spacing = 0; hbox.Add(button); hbox.Add(label); hbox.Show(); this.Add(hbox); }
private void CreateUi(string name) { Caption = new Label(name + " "); Close = new Button { Image = new Image(Stock.Close, IconSize.Menu), TooltipText = "Close Tab", Relief = ReliefStyle.None }; var rcStyle = new RcStyle { Xthickness = 0, Ythickness = 0, }; Close.ModifyStyle(rcStyle); PackStart(Caption); PackStart(Close); ShowAll(); //Close.Hide(); }
private void RebuildTemplateWidgets() { if (d_object == null) { return; } Wrappers.Wrapper[] templates = d_object.AppliedTemplates; Widget[] children = d_templateParent.Children; for (int i = 0; i < children.Length; ++i) { d_templateParent.Remove(children[i]); } for (int i = 0; i < templates.Length; ++i) { Wrappers.Wrapper template = templates[i]; if (i != 0) { Label comma = new Label(", "); comma.Show(); d_templateParent.PackStart(comma, false, false, 0); } Label temp = new Label(); temp.Markup = String.Format("<span underline=\"single\">{0}</span>", System.Security.SecurityElement.Escape(template.FullId)); EventBox box = new EventBox(); box.Show(); box.Add(temp); temp.StyleSet += HandleTemplateLabelStyleSet; box.Realized += delegate(object sender, EventArgs e) { box.GdkWindow.Cursor = new Gdk.Cursor(Gdk.CursorType.Hand1); }; temp.Show(); d_templateParent.PackStart(box, false, false, 0); box.ButtonPressEvent += delegate(object o, ButtonPressEventArgs args) { TemplateActivated(this, template); }; } if (templates.Length == 0) { Label lbl = new Label("<i>none</i>"); lbl.UseMarkup = true; lbl.Show(); d_templateParent.PackStart(lbl, false, false, 0); } Alignment align = new Alignment(0, 0, 1, 1); align.LeftPadding = 3; align.Show(); Button but = new Button(); but.Relief = ReliefStyle.None; Image img = new Image(Gtk.Stock.Add, IconSize.Menu); img.Show(); RcStyle style = new RcStyle(); style.Xthickness = 0; style.Ythickness = 0; but.ModifyStyle(style); but.Add(img); but.Show(); align.Add(but); but.Clicked += AddTemplateClicked; d_templateParent.PackStart(align, false, false, 0); }