/// ------------------------------------------------------------------------------------ /// <summary> /// Adds an ExplorerBarItem with the specified text and hosting the specified control. /// </summary> /// ------------------------------------------------------------------------------------ public ExplorerBarItem Add(string text, Control control) { ExplorerBarItem item = new ExplorerBarItem(text, control); Add(item); return(item); }
/// ------------------------------------------------------------------------------------ /// <summary> /// Removes the specified item from the collection of items. /// </summary> /// ------------------------------------------------------------------------------------ public void Remove(ExplorerBarItem item) { if (item != null && m_items.Contains(item)) { Controls.Remove(item); m_items.Remove(item); item.Collapsed -= HandleItemExpandingOrCollapsing; item.Expanded -= HandleItemExpandingOrCollapsing; item.SizeChanged -= item_SizeChanged; ManageVScrollBar(); } }
/// ------------------------------------------------------------------------------------ /// <summary> /// Adds the specified item to the item collection. /// </summary> /// ------------------------------------------------------------------------------------ public void Add(ExplorerBarItem item) { item.Dock = DockStyle.Top; item.BackColor = BackColor; m_items.Add(item); Controls.Add(item); item.BringToFront(); item.Collapsed += HandleItemExpandingOrCollapsing; item.Expanded += HandleItemExpandingOrCollapsing; item.SizeChanged += item_SizeChanged; ManageVScrollBar(); }
/// ------------------------------------------------------------------------------------ /// <summary> /// Handles an item expanding or collapsing. /// </summary> /// ------------------------------------------------------------------------------------ void HandleItemExpandingOrCollapsing(object sender, EventArgs e) { ExplorerBarItem item = sender as ExplorerBarItem; if (item == null) { return; } ScrollControlIntoView(item); ManageVScrollBar(); if (item.IsExpanded && ItemExpanded != null) { ItemExpanded(this, item); } else if (!item.IsExpanded && ItemCollapsed != null) { ItemCollapsed(this, item); } }
/// ------------------------------------------------------------------------------------ /// <summary> /// Adds an ExplorerBarItem with the specified text and hosting the specified control. /// </summary> /// ------------------------------------------------------------------------------------ public ExplorerBarItem Add(string text, Control control) { ExplorerBarItem item = new ExplorerBarItem(text, control); Add(item); return item; }
/// ------------------------------------------------------------------------------------ /// <summary> /// Handles one of the character grids in the explorer bar expanding or collapsing. /// </summary> /// ------------------------------------------------------------------------------------ private void HandleCharGridCharExplorerItemStateChanged(SimpleExplorerBar expBar, ExplorerBarItem item) { btnRemoveChar.Enabled = !string.IsNullOrEmpty(m_validCharsGridMngr.CurrentCharacter); }