/// ------------------------------------------------------------------------------------
        /// <summary>
        /// Add item to a category tab
        /// </summary>
        /// ------------------------------------------------------------------------------------
        public void AddTabItem(string tabName, SBTabItemProperties itemProps)
        {
            Tab  tab  = m_sidePane.GetTabByName(tabName);
            Item item = new Item(itemProps.Name);

            item.Text = itemProps.Text;
            item.Icon = m_largeItemImages.Images[itemProps.ImageIndex];
            item.Tag  = itemProps;
            m_sidePane.AddItem(tab, item);
        }
Beispiel #2
0
        /// <summary>
        /// Add tabs and items from the information received and cached by
        /// CreateUIForChoiceGroupCollection and CreateUIForChoiceGroup.
        /// </summary>
        private void AddTabsAndItemsFromCache()
        {
            // Add tabs

            if (null != this.MyPanel.Tag)
            {
                ((ChoiceGroup)this.MyPanel.Tag).OnDisplay(null, null);
            }

            // Add items

            // m_choiceGroupCache appears to contain 2 kinds of things:
            //  * ChoiceGroups that are a list of items, with the name of their tab in the group.ReferenceWidget
            //  * A ChoiceGroup named "Areas" which is a special case list representing the tabs
            foreach (ChoiceGroup group in m_choiceGroupCache)
            {
                if (group == null)
                {
                    continue;
                }

                if (group.Label == areasLabel)
                {
                    continue;                                // Skip the "Areas" special case ChoiceGroup
                }
                foreach (ListPropertyChoice choice in group) // group must already be populated
                {
                    if (choice == null)
                    {
                        continue;
                    }

                    Tab tab = m_sidepane.GetTabByName((group.ReferenceWidget as ListView).Name);
                    if (tab == null)
                    {
                        continue;                         // Item's tab doesn't exist in the sidepane for some reason. Skip this item.
                    }
                    Item item = new Item(choice.Value)
                    {
                        Icon = m_smallImages.GetImage(choice.ImageName),
                        Text = choice.Label,
                        Tag  = choice,
                    };
                    choice.ReferenceWidget = item;

                    m_sidepane.AddItem(tab, item);
                }
            }
        }