상속: BaseToolboxNode
예제 #1
0
        private void Build()
        {
            base.Clear();
            Hashtable categories = categorised? new Hashtable() : null;

            for (int i = 0; i < innerStore.Count; i++)
            {
                ItemToolboxNode node = (ItemToolboxNode)innerStore [i];
                node.SetParent(null);

                if (!node.Filter(filter))
                {
                    continue;
                }

                if (categorised)
                {
                    string cat = node.Category;
                    if (cat.Length < 1)
                    {
                        cat = "Miscellaneous";
                    }

                    if (!categories.ContainsKey(cat))
                    {
                        categories.Add(cat, new CategoryToolboxNode(cat));
                    }

                    ((CategoryToolboxNode)categories[cat]).Add(node);
                }
                else
                {
                    base.AddNode(node);
                }
            }

            if (categorised)
            {
                ArrayList arrList = new ArrayList(categories.Values);
                arrList.Sort(new SortByName());

                for (int i = 0; i < arrList.Count; i++)
                {
                    base.AddNode((CategoryToolboxNode)arrList [i]);
                }
            }
        }
예제 #2
0
파일: Toolbox.cs 프로젝트: deck05/aspeditor
        private void OnRowActivated(object sender, RowActivatedArgs e)
        {
            ItemToolboxNode activatedNode = store.GetNode(e.Path) as ItemToolboxNode;

            DesignerHost    host           = parentServices.GetService(typeof(IDesignerHost)) as DesignerHost;
            IToolboxService toolboxService = parentServices.GetService(typeof(IToolboxService)) as IToolboxService;

            //toolboxitem needs to trigger extra events from toolboxService
            if (selectedNode is ToolboxItemToolboxNode)
            {
                if (toolboxService == null || host == null)
                {
                    return;
                }
                toolboxService.SetSelectedToolboxItem(((ToolboxItemToolboxNode)activatedNode).ToolboxItem);
                activatedNode.Activate(host);
                toolboxService.SelectedToolboxItemUsed();
            }
            else
            {
                activatedNode.Activate(host);
            }
        }
예제 #3
0
        public void Remove(ItemToolboxNode child)
        {
            int pos = children.IndexOf (child);

            if (pos < 0)
                throw new InvalidOperationException ("A node cannot be removed if it is not in the store.");

            children.Remove (child);
            child.SetParent (null);
            OnChildRemoved (child, pos);
        }
예제 #4
0
 public void Add(ItemToolboxNode child)
 {
     child.SetParent (this);
     children.Add (child);
     OnChildAdded (child);
 }
예제 #5
0
 public void Add(ItemToolboxNode child)
 {
     child.SetParent(this);
     children.Add(child);
     OnChildAdded(child);
 }