protected override void OnPressed() { //base.OnPressed (); Gtk.Menu menu = new Gtk.Menu(); if (menu.Children.Length > 0) { Gtk.SeparatorMenuItem sep = new Gtk.SeparatorMenuItem(); sep.Show(); menu.Insert(sep, -1); } Gtk.RadioMenuItem grp = new Gtk.RadioMenuItem(""); foreach (ComboItem ci in items) { Gtk.RadioMenuItem mi = new Gtk.RadioMenuItem(grp, ci.Label.Replace("_", "__")); if (ci.Item == items.CurrentItem || ci.Item.Equals(items.CurrentItem)) { mi.Active = true; } ComboItemSet isetLocal = items; ComboItem ciLocal = ci; mi.Activated += delegate { SelectItem(isetLocal, ciLocal); }; mi.ShowAll(); menu.Insert(mi, -1); } menu.Popup(null, null, PositionFunc, 0, Gtk.Global.CurrentEventTime); }
public void SelectItem(ComboItemSet iset, ComboItem item) { if (item != null) { iset.CurrentItem = item.Item; ActiveText = item.Label; } else { iset.CurrentItem = null; ActiveText = ""; } if (Changed != null) { ChangedEventArgs args = new ChangedEventArgs(); args.ItemSet = iset; if (item != null) { args.Item = item.Item; } else { args.Item = null; } Changed(this, args); } }
void SelectItem(ComboItemSet iset, ComboItem item) { iset.CurrentItem = item.Item; if (Changed != null) { ChangedEventArgs args = new ChangedEventArgs(); args.ItemSet = iset; args.Item = item.Item; Changed(this, args); } }
public void SelectValue(ComboItemSet iset, object item) { if (item != null) { ComboItem ci = iset.FindItemByValue(item); if (ci != null) { SelectItem(iset, ci); return; } } }
public void AddItemSet(ComboItemSet iset) { items.Add(iset); }
public void SetItemSet(ComboItemSet iset) { items.Clear(); items = iset; }