public static ToggleButton create_togglebutton_stock_image(String stockid,String tooltip){ ToggleButton tb = new ToggleButton(stockid); tb.Remove(tb.Child); VBox v = new VBox(); v.Add(new Gtk.Image(tb.RenderIcon(stockid,IconSize.SmallToolbar,tooltip))); tb.Add(v); tb.WidthRequest = 30; tb.CanFocus = false; tb.TooltipText = tooltip; tb.HasTooltip = true; return tb; }
// Makes sure everything is in place before showing the widget public new void ShowAll() { if (Children.Length == 2) { ToggleButton = (ToggleButton) Children [0]; ToggleButton.Remove (ToggleButton.Child); } else { ToggleButton = new ToggleButton (); ToggleButton.Relief = ReliefStyle.None; ToggleButton.Clicked += ToggleView; PackStart (ToggleButton, false, false, 6); } HBox layout_horizontal = new HBox (false, 12); layout_horizontal.BorderWidth = 6; TreeIter iter; Store.GetIter (out iter, new TreePath (GetSelected ().ToString())); string text = (string) Store.GetValue (iter, 1); Gdk.Pixbuf pixbuf = (Gdk.Pixbuf) Store.GetValue (iter, 0); Label label = new Label (text.Replace (SelectedTextColor, SecondaryTextColor)); label.UseMarkup = true; Arrow arrow_down = new Arrow (ArrowType.Down, ShadowType.None); layout_horizontal.PackStart (new Image (pixbuf), false, false, 0); layout_horizontal.PackStart (label, false, false, 0); layout_horizontal.PackStart (new Label (""), true, true, 0); layout_horizontal.PackStart (arrow_down, false, false, 0); ToggleButton.Add (layout_horizontal); ReorderChild (ToggleButton, 0); TreePath path = new TreePath (Selected.ToString()); IconView.SelectPath (path); base.ShowAll (); }