internal void DragCancel() { if (!m_DragInProgress) return; if (m_DragTab != null) { if (m_DragTabOriginalIndex >= 0) { this.Tabs.Remove(m_DragTab); this.Tabs.Insert(m_DragTabOriginalIndex, m_DragTab); this.RecalcLayout(); this.Refresh(); } m_DragTab = null; m_DragTabOriginalIndex = -1; } else if (m_DragButton != null) { if (m_DragButtonOriginalIndex >= 0) { if (m_DragButton.Parent != null) m_DragButton.Parent.Buttons.Remove(m_DragButton); if (m_DragTabOriginalIndex >= 0 && m_DragTabOriginalIndex != this.Tabs.IndexOf(m_DragButton.Parent)) { this.Tabs[m_DragTabOriginalIndex].Buttons.Insert(m_DragButtonOriginalIndex, m_DragButton); } else this.Tabs[m_DragTabOriginalIndex].Buttons.Insert(m_DragButtonOriginalIndex, m_DragButton); m_DragButtonOriginalIndex = -1; m_DragTabOriginalIndex = -1; m_DragButton = null; this.RecalcLayout(); this.Refresh(); } } m_DragInProgress = false; }
/// <summary> /// Returns next visible tab from the reference tab. /// </summary> /// <param name="tabFrom">Reference tab.</param> /// <returns>Next visible tab or null if next visible tab cannot be determined.</returns> internal BubbleBarTab GetNextVisibleTab(BubbleBarTab tabFrom) { int from=0; if(tabFrom!=null)from=this.IndexOf(tabFrom)+1; for(int i=from;i<this.Count;i++) { if(this[i].Visible) return this[i]; } return null; }
private void GetTabComponents(BubbleBarTab tab, ArrayList c) { foreach(BubbleButton b in tab.Buttons) c.Add(b); }
/// <summary> /// Called after specified button has been removed. /// </summary> /// <param name="tab">Tab from which button was removed.</param> /// <param name="button">Button that was removed.</param> internal void OnButtonRemoved(BubbleBarTab tab, BubbleButton button) { StopBubbleEffect(); if (m_HasShortcuts && !this.IsDisposed) RefreshHasShortcut(); if (this.DesignMode) { this.RecalcLayout(); this.Refresh(); } }
/// <summary> /// Returns whether collection contains specified object. /// </summary> /// <param name="value">Object to look for.</param> /// <returns>true if object is part of the collection, otherwise false.</returns> public bool Contains(BubbleBarTab value) { return List.Contains(value); }
/// <summary> /// Copies collection into the specified array. /// </summary> /// <param name="array">Array to copy collection to.</param> /// <param name="index">Starting index.</param> public void CopyTo(BubbleBarTab[] array, int index) { List.CopyTo(array, index); }
/// <summary> /// Called after Visible property of the tab has changed. /// </summary> /// <param name="tab">Tab affected.</param> internal void OnTabVisibleChanged(BubbleBarTab tab) { if (m_SelectedTab == tab) { SelectNextVisible(tab, eEventSource.Code, false); } this.LayoutButtons(); this.Refresh(); }
/// <summary> /// Inserts new object into the collection. /// </summary> /// <param name="index">Position of the object.</param> /// <param name="value">Object to insert.</param> public void Insert(int index, BubbleBarTab value) { List.Insert(index, value); }
/// <summary> /// Called after all tabs are removed from the collection. /// </summary> internal void OnTabsCleared() { m_SelectedTab = null; this.LayoutButtons(); if (this.DesignMode) { this.RecalcLayout(); this.Refresh(); } }
/// <summary> /// Called after text of a tab has changed. /// </summary> /// <param name="tab">Tab which text has changed.</param> internal void OnTabTextChanged(BubbleBarTab tab) { this.RecalcLayout(); this.Refresh(); }
/// <summary> /// Called after tab has been added to the collection. /// </summary> /// <param name="tab">Newly added tab.</param> internal void OnTabAdded(BubbleBarTab tab) { if (m_SelectedTab == null) m_SelectedTab = tab; this.LayoutButtons(); if (this.DesignMode) { this.RecalcLayout(); this.Refresh(); } }
/// <summary> /// Called after tab has been removed from the collection. /// </summary> /// <param name="tab">Tab that was removed.</param> internal void OnTabRemoved(BubbleBarTab tab) { if (m_SelectedTab == tab) { SelectNextVisible(tab, eEventSource.Code, false); } if (this.DesignMode) { this.RecalcLayout(); this.Refresh(); } }
/// <summary> /// Called after new button is added to the Buttons collection. /// </summary> /// <param name="tab">Tab to which button was added.</param> /// <param name="button">Reference to the button added.</param> internal void OnButtonInserted(BubbleBarTab tab, BubbleButton button) { StopBubbleEffect(); LayoutButtons(); if (button.Shortcut != eShortcut.None) { m_HasShortcuts = true; } if (this.DesignMode) { this.RecalcLayout(); this.Refresh(); } }
/// <summary> /// Returns previous visible tab from the reference tab. /// </summary> /// <param name="tabFrom">Reference tab.</param> /// <returns>Previous visible tab or null if Previous visible tab cannot be determined.</returns> internal BubbleBarTab GetPreviousVisibleTab(BubbleBarTab tabFrom) { int from=0; if(tabFrom!=null) from=this.IndexOf(tabFrom)-1; for(int i=from;i>=0;i--) { if(this[i].Visible) return this[i]; } return null; }
private void SelectNextVisible(BubbleBarTab reference, eEventSource source, bool bCanCancel) { BubbleBarTab sel = m_Tabs.GetNextVisibleTab(reference); if (sel == null) sel = m_Tabs.GetPreviousVisibleTab(reference); SetSelectedTab(sel, source, bCanCancel); }
/// <summary> /// Adds new object to the collection. /// </summary> /// <param name="tab">Object to add.</param> /// <returns>Index of newly added object.</returns> public int Add(BubbleBarTab tab) { return List.Add(tab); }
private void SetSelectedTab(BubbleBarTab tab, eEventSource source, bool bCanCancel) { if (TabChanging != null) { BubbleBarTabChangingEventArgs e = new BubbleBarTabChangingEventArgs(); e.CurrentTab = m_SelectedTab; e.NewTab = tab; e.Source = source; TabChanging(this, e); if (e.Cancel && bCanCancel) return; } m_SelectedTab = tab; m_IgnoreButtonMouseMove = null; this.LayoutButtons(); this.RepaintAll(); }
/// <summary> /// Returns index of the object inside of the collection. /// </summary> /// <param name="value">Reference to the object.</param> /// <returns>Index of the object.</returns> public int IndexOf(BubbleBarTab value) { return List.IndexOf(value); }
public void SetMouseOverTab(BubbleBarTab tab) { if (m_MouseOverTab == tab) return; m_MouseOverTab = tab; this.Invalidate(GetTabBounds()); this.Update(); }
/// <summary> /// Removes specified object from the collection. /// </summary> /// <param name="value"></param> public void Remove(BubbleBarTab value) { List.Remove(value); }
public void StartDrag(BubbleBarTab tab) { if (m_DragInProgress) return; m_DragInProgress = true; m_DragTab = tab; Cursor.Current = Cursors.Hand; }
private BubbleButton CreateButton(BubbleBarTab tab) { BubbleBar bar=this.Control as BubbleBar; if(bar==null) return null; IDesignerHost dh=(IDesignerHost)GetService(typeof(IDesignerHost)); if(dh==null) return null; IComponentChangeService change=this.GetService(typeof(IComponentChangeService)) as IComponentChangeService; if(change!=null) change.OnComponentChanging(this.Component,TypeDescriptor.GetProperties(tab).Find("Buttons",true)); BubbleButton button=dh.CreateComponent(typeof(BubbleButton)) as BubbleButton; if(button==null) return null; button.Image=BarFunctions.LoadBitmap("SystemImages.Note24.png"); button.ImageLarge=BarFunctions.LoadBitmap("SystemImages.Note64.png"); tab.Buttons.Add(button); if(change!=null) change.OnComponentChanged(this.Component,TypeDescriptor.GetProperties(tab).Find("Buttons",true),null,null); return button; }
public void DragMouseUp(Point mousePosition) { if (m_DragTab != null) { BubbleBarTab tab = GetTabAt(mousePosition); if (tab != m_DragTab) { DragCancel(); } else { m_DragTab = null; m_DragTabOriginalIndex = -1; } } else if (m_DragButton != null) { BubbleButton button = GetButtonAt(mousePosition); if (button != m_DragButton) DragCancel(); else { m_DragButton = null; m_DragTabOriginalIndex = -1; m_DragButtonOriginalIndex = -1; } } m_DragInProgress = false; }
/// <summary> /// Creates new instance of the collection. /// </summary> /// <param name="parent">Parent of the collection.</param> internal BubbleButtonCollection(BubbleBarTab parent) { m_Parent=parent; }
/// <summary> /// Called after all buttons have been removed. /// </summary> /// <param name="tab">Tab from which all buttons were removed.</param> internal void OnButtonsCollectionClear(BubbleBarTab tab) { StopBubbleEffect(); if (this.DesignMode) { this.RecalcLayout(); this.Refresh(); } }