Ejemplo n.º 1
0
 public void SetTabBar(TabBar tabBar)
 {
     if (_tabBar == null)
     {
         _tabBar = new TabBar();
     }
     this.HideTabs = true;
     foreach (TabPage page in this.TabPages)
     {
         TabButton button = new TabButton();
         button.Text = page.Text;
         button.Tag  = page.Tag;
         _tabBar.AddTab(button, false);
     }
     _tabBar.SelectedItemChanged += TabBarSelectedItemChanged;
 }
Ejemplo n.º 2
0
        void TabSelected(object sender, EventArgs e)
        {
            TabButton t = sender as TabButton;

            for (int i = 0; i < this._tabList.Count; i++)
            {
                if (!this._tabList[i].Equals(t))
                {
                    this._tabList[i].State = TabState.Deactivated;
                }
                else
                {
                    TabSelectedEventArgs args = new TabSelectedEventArgs(i, t);
                    OnSelectedItemChanged(args);
                }
            }

            this._activedTabStack.Push(t);
        }
Ejemplo n.º 3
0
        /// <summary>
        /// 添加标签
        /// </summary>
        /// <param name="index">在该位置插入</param>
        /// <param name="tab">标签</param>
        ///<param name="actived">是否立即激活</param>
        public void AddTab(int index, TabButton tab, bool actived)
        {
            index = Math.Min(Math.Max(0, index), this._tabList.Count);

            tab.Selected        += TabSelected;
            tab.DoubleClick     += TabDoubleClick;
            tab.Disposed        += TabDisposed;
            tab.ActiveColor      = this._activedTabColor;
            tab.DeactivatedColor = this._deactivatedTabColor;
            tab.MouseEnter      += TabMouseEnter;
            tab.MouseLeave      += TabMouseLeave;
            this._tabList.Insert(index, tab);
            this.Controls.Add(tab);
            if (index == 0)
            {
                actived = true;
            }
            if (actived)
            {
                tab.State = TabState.Actived;
            }

            this.OnTabAdded(tab, index);
        }
Ejemplo n.º 4
0
 public TabAddedEventArgs(TabButton tabAdded, TabBar sender, int index)
 {
     this._tabAdded = tabAdded;
     this._sender = sender;
     this._index = index;
 }
Ejemplo n.º 5
0
 public TabSelectedEventArgs(int index, TabButton sender)
 {
     _index = index;
     _sender = sender;
 }
Ejemplo n.º 6
0
 public TabBarSelectedItemChangedArgs(TabButton oldItem, TabButton newItem)
 {
     this._oldItem = oldItem;
     this._newItem = newItem;
 }
Ejemplo n.º 7
0
 private void OnTabRemoved(TabButton tabRemoved)
 {
     if (this.TabRemoved != null)
     {
         this.TabRemoved(this, new TabRemovedEventArgs(tabRemoved, this));
     }
 }
Ejemplo n.º 8
0
        private void OnTabAdded(TabButton tab, int index)
        {
            if (this.TabAdded != null)
            {
                this.TabAdded(this, new TabAddedEventArgs(tab, this, index));
            }

            this.Invalidate(true);
        }
Ejemplo n.º 9
0
        public void RemoveTab(TabButton tab)
        {
            this._tabList.Remove(tab);
            this.Controls.Remove(tab);
            this.OnTabRemoved(tab);

            tab.Hide();
            tab.Dispose();
        }
Ejemplo n.º 10
0
 /// <summary>
 /// 添加标签
 /// </summary>
 /// <param name="tab">标签</param>
 /// <param name="actived">是否立即激活</param>
 public void AddTab(TabButton tab, bool actived)
 {
     this.AddTab(this._tabList.Count, tab, actived);
 }
Ejemplo n.º 11
0
 public TabRemovedEventArgs(TabButton tabRemoved, TabBar sender)
 {
     this._tabRemoved = tabRemoved;
     this._sender     = sender;
 }
Ejemplo n.º 12
0
 public TabAddedEventArgs(TabButton tabAdded, TabBar sender, int index)
 {
     this._tabAdded = tabAdded;
     this._sender   = sender;
     this._index    = index;
 }
Ejemplo n.º 13
0
 public TabSelectedEventArgs(int index, TabButton sender)
 {
     _index  = index;
     _sender = sender;
 }
Ejemplo n.º 14
0
 public TabBarSelectedItemChangedArgs(TabButton oldItem, TabButton newItem)
 {
     this._oldItem = oldItem;
     this._newItem = newItem;
 }
Ejemplo n.º 15
0
 public TabRemovedEventArgs(TabButton tabRemoved, TabBar sender)
 {
     this._tabRemoved = tabRemoved;
     this._sender = sender;
 }
Ejemplo n.º 16
0
        /// <summary>
        /// 添加标签
        /// </summary>
        /// <param name="index">在该位置插入</param>
        /// <param name="tab">标签</param>
        ///<param name="actived">是否立即激活</param>
        public void AddTab(int index, TabButton tab, bool actived)
        {
            index = Math.Min(Math.Max(0, index), this._tabList.Count);

            tab.Selected += TabSelected;
            tab.DoubleClick += TabDoubleClick;
            tab.Disposed += TabDisposed;
            tab.ActiveColor = this._activedTabColor;
            tab.DeactivatedColor = this._deactivatedTabColor;
            tab.MouseEnter += TabMouseEnter;
            tab.MouseLeave += TabMouseLeave;
            this._tabList.Insert(index, tab);
            this.Controls.Add(tab);
            if (index == 0)
            {
                actived = true;
            }
            if (actived)
            {
                tab.State = TabState.Actived;
            }

            this.OnTabAdded(tab, index);
        }
Ejemplo n.º 17
0
 public void SetTabBar(TabBar tabBar)
 {
     if(_tabBar == null)
     {
         _tabBar = new TabBar();
     }
     this.HideTabs = true;
     foreach(TabPage page in this.TabPages)
     {
         TabButton button = new TabButton();
         button.Text = page.Text;
         button.Tag = page.Tag;
         _tabBar.AddTab(button,false);
     }
     _tabBar.SelectedItemChanged += TabBarSelectedItemChanged;
 }
Ejemplo n.º 18
0
 /// <summary>
 /// 添加标签
 /// </summary>
 /// <param name="tab">标签</param>
 /// <param name="actived">是否立即激活</param>
 public void AddTab(TabButton tab, bool actived)
 {
     this.AddTab(this._tabList.Count, tab, actived);
 }