/// <summary> /// Returns all menu entries matching the name in this applicaiton menu /// </summary> /// <param name="entryName">Sring Entry name to be searched</param> /// <param name="pulldownMenu">Current pulldown menu</param> /// <returns>List of MenuEntries matching the entry Name</returns> public ArrayList GetMatchingMenuValues(String entryName, MgMenu pulldownMenu) { ArrayList matchingMnuValues = new ArrayList(); // Can't use List<T> - may hold MenuEntry or MgValue IEnumerator iMgMenu = menus.GetEnumerator(); while (iMgMenu.MoveNext()) { bool isPulldown; MgMenu mgmenu = (MgMenu)iMgMenu.Current; if (mgmenu == pulldownMenu) { isPulldown = true; } else { isPulldown = false; } IEnumerator iMenuEntry = mgmenu.iterator(); BuildMatchingMenuValues(entryName, iMenuEntry, isPulldown, matchingMnuValues); } matchingMnuValues.TrimToSize(); return(matchingMnuValues); }
/// <summary> /// Gets the menu entry from its Uid. /// </summary> /// <param name = "menuUid">Uid whose corresponding menu entry is to be found</param> /// <returns></returns> public MenuEntry menuByUid(int menuUid) { MenuEntry menuEntryByUid = null; IEnumerator iMgMenu = menus.GetEnumerator(); while (iMgMenu.MoveNext()) { MgMenu mgmenu = (MgMenu)iMgMenu.Current; IEnumerator iMenuEntry = mgmenu.iterator(); while (iMenuEntry.MoveNext()) { MenuEntry menuEntry = (MenuEntry)iMenuEntry.Current; if (menuEntry.menuUid() == menuUid) { menuEntryByUid = menuEntry; return(menuEntryByUid); } if (menuEntry.menuType() == GuiMenuEntry.MenuType.MENU) { menuEntryByUid = getMenuEntryByUid(menuEntry, menuUid); if (menuEntryByUid != null) { if (menuEntryByUid.menuUid() == menuUid) { return(menuEntryByUid); } } } } } return(menuEntryByUid); }
/// <summary> /// Refresh all the menus text in our menu list. /// </summary> public void refreshMenuesTextMls() { IEnumerator iMgMenu = menus.GetEnumerator(); while (iMgMenu.MoveNext()) { MgMenu mgmenu = (MgMenu)iMgMenu.Current; IEnumerator iMenuEntry = mgmenu.iterator(); while (iMenuEntry.MoveNext()) { MenuEntry menuEntry = (MenuEntry)iMenuEntry.Current; refreshRecursiveMenuesEntryMls(menuEntry); } } }
/** * get the tool index for method menuShow. * we pass all the menu entry in the MgMenu and calculate the index of the tool. * @param form : the form that we work on it * @param toolGroup: the tool group that this icon need to be added. * @forMenuEntry: calculate the tool index for this menu entry * @return */ private int calcToolbarIndex(MgFormBase form, int toolGroup, MenuEntry forMenuEntry) { int count = 0; MgMenu mgMenu = form.getMgMenu(MenuStyle.MENU_STYLE_PULLDOWN); bool found = false; IEnumerator iMenuEntry = mgMenu.iterator(); while (iMenuEntry.MoveNext()) { MenuEntry menuEntry = (MenuEntry)iMenuEntry.Current; //get the count from this menu recursively count += menuEntry.getGroupCount(form, toolGroup, forMenuEntry, ref found); if (found) { break; } } return(count); }