public Gtk.Widget AllocEventBox(Gtk.Widget widget, bool visibleWindow = false) { // Wraps the widget with an event box. Required for some // widgets such as Label which doesn't have its own gdk window if (widget is Gtk.EventBox) { ((Gtk.EventBox)widget).VisibleWindow = true; return(widget); } if (widget.IsNoWindow) { var eventBox = new Gtk.EventBox(); eventBox.Visible = widget.Visible; eventBox.Sensitive = widget.Sensitive; eventBox.VisibleWindow = visibleWindow; GtkEngine.ReplaceChild(widget, eventBox); eventBox.Add(widget); return(eventBox); } return(widget); }
public Gtk.Widget WrapWithButton(Gtk.Widget widget) { if (widget is Gtk.Button) { return(widget); } var button = new Gtk.Button() { Image = widget, Label = this.Label, Visible = widget.Visible, Sensitive = widget.Sensitive, UseUnderline = this.UseUnderline }; button.AddEvents((int)Gdk.EventMask.ButtonPressMask); button.ButtonPressEvent += this.ButtonPressed; button.Clicked += this.OnClick; GtkEngine.ReplaceChild(widget, button); return(button); }