示例#1
0
        /// <summary>
        /// Adds an item to the palette in the given category</summary>
        /// <param name="item">Palette item</param>
        /// <param name="categoryName">Category name</param>
        /// <param name="client">Client that instantiates item during drag-drop operations</param>
        public void AddItem(object item, string categoryName, IPaletteClient client)
        {
            if (m_objectClients.ContainsKey(item))
            {
                throw new InvalidOperationException("duplicate item");
            }

            if (categoryName != null)
            {
                m_objectClients.Add(item, client);
                m_paletteTreeAdapter.AddItem(item, categoryName);
            }
        }
示例#2
0
            /// <summary>
            /// Gets item's display information</summary>
            /// <param name="item">Item being displayed</param>
            /// <param name="info">Item info, to fill out</param>
            public void GetInfo(object item, ItemInfo info)
            {
                info.AllowLabelEdit = false;

                if (item != this)
                {
                    string categoryName = item as string;
                    if (categoryName != null && m_categories.ContainsKey(categoryName))
                    {
                        info.Label = categoryName;
                    }
                    else
                    {
                        IPaletteClient client = m_paletteService.m_objectClients[item];
                        client.GetInfo(item, info);
                    }
                }
            }
示例#3
0
        /// <summary>
        /// Adds an item to the palette in the given category</summary>
        /// <param name="item">Palette item</param>
        /// <param name="categoryName">Category name</param>
        /// <param name="client">Client that instantiates item during drag-drop operations</param>
        public void AddItem(object item, string categoryName, IPaletteClient client)
        {
            if (m_objectClients.ContainsKey(item))
                throw new InvalidOperationException("duplicate item");

            if (categoryName != null)
            {
                m_objectClients.Add(item, client);
                TreeAdapter.AddItem(item, categoryName);
            }
        }