Пример #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));
 }