Пример #1
0
        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;
        }
Пример #2
0
		/// <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;
		}
Пример #3
0
		private void GetTabComponents(BubbleBarTab tab, ArrayList c)
		{
			foreach(BubbleButton b in tab.Buttons)
				c.Add(b);
		}
Пример #4
0
 /// <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();
     }
 }
Пример #5
0
		/// <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);
		}
Пример #6
0
		/// <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);
		}
Пример #7
0
 /// <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();
 }
Пример #8
0
		/// <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);
		}
Пример #9
0
 /// <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();
     }
 }
Пример #10
0
 /// <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();
 }
Пример #11
0
 /// <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();
     }
 }
Пример #12
0
 /// <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();
     }
 }
Пример #13
0
 /// <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();
     }
 }
Пример #14
0
		/// <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;
		}
Пример #15
0
 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);
 }
Пример #16
0
		/// <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);
		}
Пример #17
0
 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();
 }
Пример #18
0
		/// <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);
		}
Пример #19
0
        public void SetMouseOverTab(BubbleBarTab tab)
        {
            if (m_MouseOverTab == tab)
                return;

            m_MouseOverTab = tab;

            this.Invalidate(GetTabBounds());
            this.Update();
        }
Пример #20
0
		/// <summary>
		/// Removes specified object from the collection.
		/// </summary>
		/// <param name="value"></param>
		public void Remove(BubbleBarTab value) 
		{
			List.Remove(value);
		}
Пример #21
0
        public void StartDrag(BubbleBarTab tab)
        {
            if (m_DragInProgress)
                return;

            m_DragInProgress = true;
            m_DragTab = tab;
            Cursor.Current = Cursors.Hand;
        }
Пример #22
0
		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;
		}
Пример #23
0
        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;
        }
Пример #24
0
		/// <summary>
		/// Creates new instance of the collection.
		/// </summary>
		/// <param name="parent">Parent of the collection.</param>
		internal BubbleButtonCollection(BubbleBarTab parent)
		{
			m_Parent=parent;
		}
Пример #25
0
 /// <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();
     }
 }