/// <summary> /// /// </summary> /// <param name="name"></param> /// <returns></returns> public bool IsItemChecked(string name) { GButton item = _list.GetChild(name).asButton; Controller c = item.GetController("checked"); if (c != null) { return(c.selectedIndex == 2); } else { return(false); } }
/// <summary> /// /// </summary> /// <param name="caption"></param> /// <param name="callback"></param> /// <returns></returns> public GButton AddItem(string caption, EventCallback1 callback) { GButton item = _list.AddItemFromPool().asButton; item.title = caption; item.data = callback; item.grayed = false; Controller c = item.GetController("checked"); if (c != null) { c.selectedIndex = 0; } return(item); }
/// <summary> /// /// </summary> /// <param name="name"></param> /// <param name="checkable"></param> public void SetItemCheckable(string name, bool checkable) { GButton item = _list.GetChild(name).asButton; Controller c = item.GetController("checked"); if (c != null) { if (checkable) { if (c.selectedIndex == 0) { c.selectedIndex = 1; } } else { c.selectedIndex = 0; } } }
/// <summary> /// /// </summary> /// <param name="caption"></param> /// <param name="index"></param> /// <param name="callback"></param> /// <returns></returns> public GButton AddItemAt(string caption, int index, EventCallback1 callback) { GObject obj = _list.GetFromPool(_list.defaultItem); _list.AddChildAt(obj, index); GButton item = (GButton)obj; item.title = caption; item.data = callback; item.grayed = false; Controller c = item.GetController("checked"); if (c != null) { c.selectedIndex = 0; } return(item); }
private void __clickItem(EventContext context) { GButton item = ((GObject)context.data).asButton; if (item == null) { return; } if (item.grayed) { _list.selectedIndex = -1; return; } Controller c = item.GetController("checked"); if (c != null && c.selectedIndex != 0) { if (c.selectedIndex == 1) { c.selectedIndex = 2; } else { c.selectedIndex = 1; } } GRoot r = (GRoot)_contentPane.parent; r.HidePopup(this.contentPane); if (item.data is EventCallback0) { ((EventCallback0)item.data)(); } else if (item.data is EventCallback1) { ((EventCallback1)item.data)(context); } }
private void __clickItem(EventContext context) { GButton item = ((GObject)context.data).asButton; if (item == null) { return; } if (item.grayed) { _list.selectedIndex = -1; return; } Controller c = item.GetController("checked"); if (c != null && c.selectedIndex != 0) { if (c.selectedIndex == 1) { c.selectedIndex = 2; } else { c.selectedIndex = 1; } } if (hideOnClickItem) { if (_parentMenu != null) { _parentMenu.Hide(); } Hide(); } item.DispatchEvent(EVENT_TYPE, item); //event data is for backward compatibility }