public virtual override void SetContent(string label, bool useMnemonic, Xwt.Backends.ImageDescription image, Xwt.ContentPosition imagePosition) { }
protected virtual void SetContent(Xwt.ContentPosition position) { var label = this.Label; if (label != null && label.Length == 0) { label = null; } if (ButtonType == Xwt.ButtonType.Disclosure) { this.Label = null; this.ContentWidget = new Gtk.Arrow(Gtk.ArrowType.Down, Gtk.ShadowType.Out); this.ContentWidget.ShowAll(); return; } Gtk.Widget contentWidget = null; if (label != null && Image == null) { contentWidget = new Gtk.Label(label) { UseUnderline = this.UseUnderline }; } else if (label == null && Image != null) { contentWidget = AllocEventBox(ImageWidget, true); contentWidget.AddEvents((int)Gdk.EventMask.ButtonPressMask); contentWidget.ButtonPressEvent -= this.ButtonPressed; contentWidget.ButtonPressEvent += this.ButtonPressed; Gdk.Color?background = null; contentWidget.FocusInEvent += (s, e) => { var w = s as Gtk.Widget; }; contentWidget.EnterNotifyEvent += (s, e) => { var w = s as Gtk.Widget; if (background == null) { background = w.Style.Background(Gtk.StateType.Normal); } w.ModifyBg(Gtk.StateType.Normal, Notifycolor); w.QueueDraw(); }; contentWidget.LeaveNotifyEvent += (s, e) => { var w = s as Gtk.Widget; w.ModifyBg(Gtk.StateType.Normal, background.Value); w.QueueDraw(); }; } else if (label != null && Image != null) { var box = position == Xwt.ContentPosition.Left || position == Xwt.ContentPosition.Right ? (Gtk.Box) new Gtk.HBox(false, 3) : (Gtk.Box) new Gtk.VBox(false, 3); var lab = new Gtk.Label(label) { UseUnderline = this.UseUnderline }; if (position == Xwt.ContentPosition.Left || position == Xwt.ContentPosition.Top) { box.PackStart(ImageWidget, false, false, 0); box.PackStart(lab, false, false, 0); } else { box.PackStart(lab, false, false, 0); box.PackStart(ImageWidget, false, false, 0); } contentWidget = box; } if (ButtonType == Xwt.ButtonType.DropDown) { Gtk.Widget dropDownArrow = new Gtk.Arrow(Gtk.ArrowType.Down, Gtk.ShadowType.Out); dropDownArrow = AllocEventBox(dropDownArrow); dropDownArrow.AddEvents((int)Gdk.EventMask.ButtonPressMask); dropDownArrow.ButtonPressEvent += this.DropDownPressed; dropDownArrow.ModifyBg(Gtk.StateType.Normal, Widget.Style.Background(Gtk.StateType.Normal)); if (contentWidget != null) { var box = new Gtk.HBox(false, 3); box.PackStart(contentWidget, true, true, 3); //box.PackStart (new Gtk.VSeparator (), true, true, 0); box.PackStart(dropDownArrow, false, false, 0); contentWidget = box; } else { contentWidget = dropDownArrow; } } if (contentWidget != null) { contentWidget.ShowAll(); this.ContentWidget = contentWidget; } else { this.Label = null; } }