/// <summary>
 /// Adds an item to this category
 /// </summary>
 /// <param name="item">Item to add</param>
 public void AddItem( CategoryItem item )
 {
     Arguments.CheckNotNull( item, "item" );
     m_Items.Add( item );
     item.ChangeParentCategory( this );
 }
 /// <summary>
 /// Removes an item from this category
 /// </summary>
 /// <param name="item">Item to remove</param>
 public void RemoveItem( CategoryItem item )
 {
     Arguments.CheckNotNull( item, "item" );
     m_Items.Remove( item );
     item.ChangeParentCategory( null );
 }
 /// <summary>
 /// Filters items from a category
 /// </summary>
 private TreeNode FilterItem( CategoryItem item, Regex filter )
 {
     if ( filter.IsMatch( item.Name ) )
     {
         TreeNode addNode = m_NodeMap[ item ];
         if ( addNode == null )
         {
             addNode = CreateNodeForCategoryItem( item );
         }
         return addNode;
     }
     TreeNode node = m_NodeMap[ item ];
     if ( node != null )
     {
         node.Remove( );
         m_NodeMap[ item ] = null;
     }
     return null;
 }
 /// <summary>
 /// Adds a component type as a category item to this category, and any type-compatible sub-categories
 /// </summary>
 public void AddComponentType( ComponentType type, string name, string description, Icon icon )
 {
     Arguments.CheckNotNull( type, "type" );
     Arguments.CheckNotNullOrEmpty( name, "name" );
     Arguments.CheckNotNull( description, "description" );
     Arguments.CheckNotNull( icon, "icon" );
     if ( m_BaseType.IsAssignableFrom( type.Type ) )
     {
         CategoryItem item = new CategoryItem( name, description, icon );
         item.Tag = type;
         AddItem( item );
     }
     foreach ( Category subCategory in SubCategories )
     {
         ComponentTypeCategory componentSubCategory = subCategory as ComponentTypeCategory;
         if ( componentSubCategory != null )
         {
             componentSubCategory.AddComponentType( type, name, description, icon );
         }
     }
 }
        /// <summary>
        /// Creates a tree node for a category item
        /// </summary>
        private TreeNode CreateNodeForCategoryItem( CategoryItem category )
        {
            Icon icon = category.Icon ?? DefaultCategoryIcon;
            TreeNode node = new TreeNode( category.Name );
            node.Tag = category;
            node.SelectedImageKey = node.ImageKey = AddImage( icon.Handle.ToString( ), icon );

            m_NodeMap[ category ] = node;

            return node;
        }