public virtual void OnItemMouseEnter(GUIMenu menu, int itemIndex) { //if this is the top level menu item we only expand if there is a sibling with an open menu if ((m_MenuSelStack.Count > 0 && m_MenuSelStack[0].m_Menu == menu) || m_MenuSelStack.Count == 0) { bool expand = false; for (int i = 0; i < menu.m_MenuItems.Length; i++) { if (!menu.m_MenuItems[i].m_SubMenu.m_Hidden) { expand = true; break; } } if (!expand) { return; } } //this stack keeps track of selections through the menu system if (itemIndex != -1) { //if the item does not already exist push the item on the stack and make its submenu visible //otherwise just toggle the visibility of the submenu GUIMenuSelection menuSel = new GUIMenuSelection(); menuSel.m_Menu = menu; menuSel.m_SelIndex = itemIndex; if (m_MenuSelStack.Find(x => (x.m_Menu == menuSel.m_Menu && x.m_SelIndex == menuSel.m_SelIndex)) == null) { UnwindMenuSelStack(menuSel); m_MenuSelStack.Add(menuSel); menuSel.GetSelectedMenuItemSubMenu().m_Hidden = false; } else { //toggle visibility bool hidden = menuSel.GetSelectedMenuItemSubMenu().m_Hidden; if (hidden) { menuSel.ShowSel(true); } } } }
public virtual void OnItemClick(GUIMenu menu, int itemIndex) { if (itemIndex != -1) { //only the top level menu items handle clicking if (m_MenuSelStack.Count == 0 || m_MenuSelStack[0].m_Menu == menu) { //if the item does not already exist push the item on the stack and make its submenu visible //otherwise just toggle the visibility of the submenu GUIMenuSelection menuSel = new GUIMenuSelection(); menuSel.m_Menu = menu; menuSel.m_SelIndex = itemIndex; if (m_MenuSelStack.Find(x => (x.m_Menu == menuSel.m_Menu && x.m_SelIndex == menuSel.m_SelIndex)) == null) { UnwindMenuSelStack(menuSel); m_MenuSelStack.Add(menuSel); menuSel.GetSelectedMenuItemSubMenu().m_Hidden = false; } else { //toggle visibility bool hidden = menuSel.GetSelectedMenuItemSubMenu().m_Hidden; if (hidden) { menuSel.ShowSel(true); } else { menuSel.GetSelectedMenuItemSubMenu().Show(false); } } } } }
public virtual void OnItemMouseEnter(GUIMenu menu, int itemIndex ) { //if this is the top level menu item we only expand if there is a sibling with an open menu if((m_MenuSelStack.Count > 0 && m_MenuSelStack[0].m_Menu == menu) || m_MenuSelStack.Count == 0) { bool expand = false; for(int i = 0; i < menu.m_MenuItems.Length; i++) { if(!menu.m_MenuItems[i].m_SubMenu.m_Hidden) { expand = true; break; } } if(!expand) return; } //this stack keeps track of selections through the menu system if (itemIndex != -1) { //if the item does not already exist push the item on the stack and make its submenu visible //otherwise just toggle the visibility of the submenu GUIMenuSelection menuSel = new GUIMenuSelection(); menuSel.m_Menu = menu; menuSel.m_SelIndex = itemIndex; if (m_MenuSelStack.Find(x => (x.m_Menu == menuSel.m_Menu && x.m_SelIndex == menuSel.m_SelIndex)) == null) { UnwindMenuSelStack(menuSel); m_MenuSelStack.Add(menuSel); menuSel.GetSelectedMenuItemSubMenu().m_Hidden = false; } else { //toggle visibility bool hidden = menuSel.GetSelectedMenuItemSubMenu().m_Hidden; if (hidden) { menuSel.ShowSel(true); } } } }
public virtual void OnItemClick(GUIMenu menu, int itemIndex ) { if (itemIndex != -1) { //only the top level menu items handle clicking if(m_MenuSelStack.Count == 0 || m_MenuSelStack[0].m_Menu == menu) { //if the item does not already exist push the item on the stack and make its submenu visible //otherwise just toggle the visibility of the submenu GUIMenuSelection menuSel = new GUIMenuSelection(); menuSel.m_Menu = menu; menuSel.m_SelIndex = itemIndex; if (m_MenuSelStack.Find(x => (x.m_Menu == menuSel.m_Menu && x.m_SelIndex == menuSel.m_SelIndex)) == null) { UnwindMenuSelStack(menuSel); m_MenuSelStack.Add(menuSel); menuSel.GetSelectedMenuItemSubMenu().m_Hidden = false; } else { //toggle visibility bool hidden = menuSel.GetSelectedMenuItemSubMenu().m_Hidden; if (hidden) { menuSel.ShowSel(true); } else { menuSel.GetSelectedMenuItemSubMenu().Show(false); } } } } }