Esempio n. 1
0
        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);
        }
Esempio n. 2
0
 private CAMenuItemList this[CATab aHost]
 {
     get
     {
         CAMenuItemList ret = null;
         //
         if (iDictionary.ContainsKey(aHost))
         {
             ret = iDictionary[aHost];
         }
         //
         return(ret);
     }
 }
Esempio n. 3
0
 private void Activate(CAMenuItemList aList)
 {
     if (iActiveList != null)
     {
         iActiveList.Deactivate();
         iActiveList = null;
     }
     //
     iActiveList = aList;
     //
     if (iActiveList != null)
     {
         iActiveList.Activate();
     }
 }
Esempio n. 4
0
        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);
                    }
                }
            }
        }