示例#1
0
 /// <summary>
 /// Remove a ToolBoxItem object from the collection.
 /// </summary>
 public void Remove(ToolBoxItem item)
 {
     if (List.Contains(item))
     {
         List.Remove(item);
     }
 }
示例#2
0
 /// <summary>
 /// Insert a ToolBoxItem object to the collection at specified index.
 /// </summary>
 public void Insert(int index, ToolBoxItem item)
 {
     if (!List.Contains(item))
     {
         item._owner = _owner;
         List.Insert(index, item);
         item.EnabledChanged += _owner.item_EnabledChanged;
         item.VisibleChanged += _owner.item_VisibleChanged;
         item.TextChanged    += _owner.item_TextChanged;
         item.ImageChanged   += _owner.item_ImageChanged;
     }
 }
示例#3
0
            protected override void OnRemove(int index, object value)
            {
                ToolBoxItem item = (ToolBoxItem)value;

                item.EnabledChanged -= _owner.item_EnabledChanged;
                item.VisibleChanged -= _owner.item_VisibleChanged;
                item.TextChanged    -= _owner.item_TextChanged;
                item.ImageChanged   -= _owner.item_ImageChanged;
                if (Removing != null)
                {
                    Removing(this, new CollectionEventArgs(CollectionEventArgs.EventType.OnRemove, index, value));
                }
            }
示例#4
0
 /// <summary>
 /// Add a ToolBoxItem object to the collection.
 /// </summary>
 public ToolBoxItem Add(ToolBoxItem item)
 {
     if (!List.Contains(item))
     {
         item._owner = _owner;
         int index = List.Add(item);
         item.EnabledChanged += _owner.item_EnabledChanged;
         item.VisibleChanged += _owner.item_VisibleChanged;
         item.TextChanged    += _owner.item_TextChanged;
         item.ImageChanged   += _owner.item_ImageChanged;
         return((ToolBoxItem)List[index]);
     }
     return(null);
 }
示例#5
0
            protected override void OnClear()
            {
                int i = 0;

                while (i < List.Count)
                {
                    ToolBoxItem item = (ToolBoxItem)List[i];
                    item.EnabledChanged -= _owner.item_EnabledChanged;
                    item.VisibleChanged -= _owner.item_VisibleChanged;
                    item.TextChanged    -= _owner.item_TextChanged;
                    item.ImageChanged   -= _owner.item_ImageChanged;
                    i++;
                }
                if (Clearing != null)
                {
                    Clearing(this, new CollectionEventArgs(CollectionEventArgs.EventType.OnClear));
                }
            }
示例#6
0
        private void _KeyDown(object sender, KeyEventArgs e)
        {
            ToolBoxItem item = null;

            foreach (ToolBoxItem ti in _items)
            {
                if (ti.Shortcut == e.KeyData)
                {
                    item = ti;
                    break;
                }
            }
            if (item != null)
            {
                e.Handled = true;
                item.onClick();
            }
        }
示例#7
0
 public ItemHost(FloatingToolBox owner, ToolBoxItem item)
 {
     _item        = item;
     _owner       = owner;
     _rect.Height = BUTTON_SIZE;
 }
示例#8
0
 /// <summary>
 /// Determine whether a ToolBoxItem object exist in the collection.
 /// </summary>
 public bool Contains(ToolBoxItem item)
 {
     return(List.Contains(item));
 }
示例#9
0
 public int IndexOf(ToolBoxItem item)
 {
     return(List.IndexOf(item));
 }