private ToolboxTabCollection PopulateToolboxTabs()
		{
			ToolboxTabCollection toolboxTabs = new ToolboxTabCollection();
// 			string[] tabNames = { Strings.WindowsForms, Strings.UserControls };
// 
// 			for (int i = 0; i < tabNames.Length; i++)
// 			{
// 				ToolboxTab toolboxTab = new ToolboxTab();
// 
// 				toolboxTab.Name = tabNames[i];
// 				PopulateToolboxItems(toolboxTab);
// 				toolboxTabs.Add(toolboxTab);
// 			}

			return toolboxTabs;
		}
 ///  <summary>
 ///       Initializes a new instance of <see cref="ToolboxLibrary.ToolboxTabCollection"/> based on another <see cref="ToolboxLibrary.ToolboxTabCollection"/>.
 ///  </summary>
 ///  <param name="value">
 ///       A <see cref="ToolboxLibrary.ToolboxTabCollection"/> from which the contents are copied
 ///  </param>
 ///  <remarks></remarks>
 ///  <history>
 ///      [dineshc] 3/26/2003  Created
 ///  </history>
 public ToolboxTabCollection(ToolboxTabCollection value)
 {
     this.AddRange(value);
 }
 public ToolboxTabEnumerator(ToolboxTabCollection mappings)
 {
     this.temp           = ((IEnumerable)(mappings));
     this.baseEnumerator = temp.GetEnumerator();
 }
        private ToolboxTabCollection PopulateToolboxTabs(XmlDocument xmlDocument)
        {
            if (xmlDocument == null)
            {
                return(null);
            }

            XmlNode toolboxNode = xmlDocument.FirstChild;

            if (toolboxNode == null)
            {
                return(null);
            }

            XmlNode tabCollectionNode = toolboxNode.FirstChild;

            if (tabCollectionNode == null)
            {
                return(null);
            }

            XmlNodeList tabsNodeList = tabCollectionNode.ChildNodes;

            if (tabsNodeList == null)
            {
                return(null);
            }

            ToolboxTabCollection toolboxTabs = new ToolboxTabCollection();

            foreach (XmlNode tabNode in tabsNodeList)
            {
                if (tabNode == null)
                {
                    continue;
                }

                XmlNode propertiesNode = tabNode.FirstChild;
                if (propertiesNode == null)
                {
                    continue;
                }

                XmlNode nameNode = propertiesNode[Strings.Name];
                if (nameNode == null)
                {
                    continue;
                }

                ToolboxTab toolboxTab = new ToolboxTab();
                toolboxTab.Name = nameNode.InnerXml.ToString();
                PopulateToolboxItems(tabNode, toolboxTab);
                toolboxTabs.Add(toolboxTab);
            }
            if (toolboxTabs.Count == 0)
            {
                return(null);
            }

            return(toolboxTabs);
        }
// 		private void PopulateToolboxItems(ToolboxTab toolboxTab)
// 		{
// 			if (toolboxTab == null)
// 				return;
// 
// 			Type[] typeArray = null;
// 
// 			switch (toolboxTab.Name)
// 			{
// 				case Strings.WindowsForms:
// 					typeArray = windowsFormsToolTypes;
// 					break;
// 				case Strings.Components:
// 					typeArray = componentsToolTypes;
// 					break;
// 				case Strings.Data:
// 					typeArray = dataToolTypes;
// 					break;
// 				case Strings.UserControls:
// 					typeArray = userControlsToolTypes;
// 					break;
// 				default:
// 					break;
// 			}
// 
// 			ToolboxItemCollection toolboxItems = new ToolboxItemCollection();
// 
// 			for (int i = 0; i < typeArray.Length; i++)
// 			{
// 				ToolboxItem toolboxItem = new ToolboxItem();
// 
// 				toolboxItem.Type = typeArray[i];
// 				toolboxItem.Name = typeArray[i].Name;
// 				toolboxItems.Add(toolboxItem);
// 			}
// 
// 			toolboxTab.ToolboxItems = toolboxItems;
// 		}

		private ToolboxTabCollection PopulateToolboxTabs(XmlDocument xmlDocument)
		{
			if(xmlDocument==null)
				return null;

			XmlNode toolboxNode = xmlDocument.FirstChild;
			if(toolboxNode==null)
				return null;

			XmlNode tabCollectionNode = toolboxNode.FirstChild;
			if(tabCollectionNode==null)
				return null;

			XmlNodeList tabsNodeList = tabCollectionNode.ChildNodes;
			if(tabsNodeList==null)
				return null;

			ToolboxTabCollection toolboxTabs = new ToolboxTabCollection();

			foreach(XmlNode tabNode in tabsNodeList)
			{
				if(tabNode==null)
					continue;

				XmlNode propertiesNode = tabNode.FirstChild;
				if(propertiesNode==null)
					continue;

				XmlNode nameNode = propertiesNode[Strings.Name];
				if(nameNode==null)
					continue;

				ToolboxTab toolboxTab = new ToolboxTab();
				toolboxTab.Name = nameNode.InnerXml.ToString();
				PopulateToolboxItems(tabNode, toolboxTab);
				toolboxTabs.Add(toolboxTab);
			}
			if(toolboxTabs.Count==0)
				return null;

			return toolboxTabs;
		}
        public void AddTab(string tabName, Type[] types)
        {            
            if (Tabs == null) Tabs = new ToolboxTabCollection();
           
            ToolboxTab toolboxTab = new ToolboxTab();
            toolboxTab.Name = tabName;

            ToolboxItemCollection toolboxItems = new ToolboxItemCollection();

            for (int i = 0; i < types.Length; i++)
            {
                ToolboxItem toolboxItem = new ToolboxItem();

                toolboxItem.Type = types[i];
                toolboxItem.Name = types[i].Name;
                toolboxItems.Add(toolboxItem);
            }
            toolboxItems.SortByName();

            toolboxTab.ToolboxItems = toolboxItems;
            
            Tabs.Add(toolboxTab);

            ToolboxUIManagerVS toolboxUIManagerVS = new ToolboxUIManagerVS(this);
            toolboxUIManagerVS.FillToolbox();

            AddEventHandlers();
            //PrintToolbox();
        }
 ///  <summary>
 ///       Initializes a new instance of <see cref="ToolboxLibrary.ToolboxTabCollection"/> based on another <see cref="ToolboxLibrary.ToolboxTabCollection"/>.
 ///  </summary>
 ///  <param name="value">
 ///       A <see cref="ToolboxLibrary.ToolboxTabCollection"/> from which the contents are copied
 ///  </param>
 ///  <remarks></remarks>
 ///  <history>
 ///      [dineshc] 3/26/2003  Created
 ///  </history>
 public ToolboxTabCollection(ToolboxTabCollection value) {
     this.AddRange(value);
 }
 public ToolboxTabEnumerator(ToolboxTabCollection mappings) {
     this.temp = ((IEnumerable)(mappings));
     this.baseEnumerator = temp.GetEnumerator();
 }
 ///  <summary>
 ///     
 ///       Adds the contents of another <see cref="ToolboxLibrary.ToolboxTabCollection"/> to the end of the collection.
 ///    
 ///  </summary>
 ///  <param name="value">
 ///    A <see cref="ToolboxLibrary.ToolboxTabCollection"/> containing the objects to add to the collection.
 ///  </param>
 ///  <remarks><seealso cref="ToolboxLibrary.ToolboxTabCollection.Add"/></remarks>
 ///  <history>
 ///      [dineshc] 3/26/2003  Created
 ///  </history>
 public void AddRange(ToolboxTabCollection value) {
     for (int i = 0; (i < value.Count); i = (i + 1)) {
         this.Add(value[i]);
     }
 }