public void Add(ToolStripMenuItem aParent, string aCaption, UIMenuItemClickHandler aClickHandler, object aTag, CATab aHost) { CAMenuItem item = new CAMenuItem(this, aCaption, aClickHandler, aTag); if (aHost != null) { // Find a menu list for the corresponding tab CAMenuItemList list = this[aHost]; if (list == null) { list = new CAMenuItemList(this); iDictionary.Add(aHost, list); } // Add the item to the list list.Add(item); } else { // Not associated with a specific tab, so most likely a top-level // plugin menu item that is always visible } aParent.DropDownItems.Add(item); }
private CAMenuItemList this[CATab aHost] { get { CAMenuItemList ret = null; // if (iDictionary.ContainsKey(aHost)) { ret = iDictionary[aHost]; } // return(ret); } }
private void Activate(CAMenuItemList aList) { if (iActiveList != null) { iActiveList.Deactivate(); iActiveList = null; } // iActiveList = aList; // if (iActiveList != null) { iActiveList.Activate(); } }
private void TabStrip_SelectedTabChanged(TabStripTab aTab) { TabStripPage page = aTab.Page; if (page != null) { // Get the corresponding tab host Control mainControl = aTab.Page.Body; CATab host = mainControl as CATab; if (host != null) { // Map tab host back to our tab type CAMenuItemList menuItems = this[host]; if (menuItems != null) { Activate(menuItems); } } } }