/// <summary> /// Remove a ToolBoxItem object from the collection. /// </summary> public void Remove(ToolBoxItem item) { if (List.Contains(item)) { List.Remove(item); } }
/// <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; } }
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)); } }
/// <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); }
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)); } }
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(); } }
public ItemHost(FloatingToolBox owner, ToolBoxItem item) { _item = item; _owner = owner; _rect.Height = BUTTON_SIZE; }
/// <summary> /// Determine whether a ToolBoxItem object exist in the collection. /// </summary> public bool Contains(ToolBoxItem item) { return(List.Contains(item)); }
public int IndexOf(ToolBoxItem item) { return(List.IndexOf(item)); }