Exemplo n.º 1
0
        protected override void LayoutChildren(IGUIContext ctx, RectangleF bounds)
        {
            bool overFlow = TabBar.IsOverflow;

            ScrollLeftButton.Visible  = overFlow;
            ScrollRightButton.Visible = overFlow;

            if (overFlow)
            {
                ScrollLeftButton.Enabled  = TabBar.CanScrollRight;
                ScrollRightButton.Enabled = TabBar.CanScrollLeft;
                SizeF      sz = TabBar.PreferredSize(ctx, bounds.Size);
                RectangleF rb = new RectangleF(bounds.Left - 1, bounds.Top, bounds.Width + 2, sz.Height);
                LayoutChild(ctx, ScrollLeftButton, rb);
                LayoutChild(ctx, ScrollRightButton, rb);
                RectangleF centerBounds = rb;
                centerBounds.Inflate(-ScrollLeftButton.Width, 0);
                LayoutChild(ctx, TabBar, centerBounds);
            }
            else
            {
                LayoutChild(ctx, TabBar, bounds);
            }

            TabPage tp = SelectedTab;

            if (tp != null)
            {
                LayoutChild(ctx, tp, new RectangleF(bounds.Left, bounds.Top + TabBar.Height + TabBar.Margin.Bottom,
                                                    bounds.Width, bounds.Height - TabBar.Height - TabBar.Margin.Bottom));
            }
        }
Exemplo n.º 2
0
        public void AdTabPage(string name, string caption, Color backColr = default(Color), char icon = (char)0, int index = -1)
        {
            TabPage tp = new TabPage(name, caption, icon);

            tp.Parent    = this;
            tp.BackColor = backColr;
            if (index >= 0 && index < TabPages.Count)
            {
                tp.TabIndex = TabPages [index].TabIndex;
                for (int i = index + 1; i < TabPages.Count; i++)
                {
                    TabPages [i].TabIndex++;
                }
                TabPages.Insert(index, tp);
            }
            else
            {
                if (TabPages.Count == 0)
                {
                    tp.TabIndex = 0;
                }
                else
                {
                    tp.TabIndex = TabPages.Last.TabIndex + 1;
                }
                TabPages.AddLast(tp);
            }
            TabBar.AddChild(tp.TabButton);
            tp.Selected |= TabPages.Count == 1;
            ResetCachedLayout();
        }
Exemplo n.º 3
0
        public TabContainer(string name)
            : base(name, Docking.Fill, new TabContainerStyle())
        {
            ScrollLeftButton             = new Button("scrollleft", null, ((char)FontAwesomeIcons.fa_long_arrow_left), ColorContexts.Default);
            ScrollLeftButton.Dock        = Docking.Left;
            ScrollLeftButton.CanFocus    = false;
            ScrollLeftButton.CanSelect   = false;
            ScrollLeftButton.IsAutofire  = true;
            ScrollRightButton            = new Button("scrollright", null, ((char)FontAwesomeIcons.fa_long_arrow_right), ColorContexts.Default);
            ScrollRightButton.Dock       = Docking.Right;
            ScrollRightButton.IsAutofire = true;
            ScrollRightButton.CanFocus   = false;
            ScrollRightButton.CanSelect  = false;

            Children.Add(ScrollLeftButton);
            Children.Add(ScrollRightButton);

            TabBar = new TabBar();
            Children.Add(TabBar);
            TabPages = new TabPageCollection();

            ScrollLeftButton.Fire  += ScrollLeftButton_Fire;
            ScrollRightButton.Fire += ScrollRightButton_Fire;
        }
Exemplo n.º 4
0
 void ScrollRightButton_Fire(object sender, EventArgs e)
 {
     TabBar.ScrollNext();
     //TabBar.ScrollRight ();
 }
Exemplo n.º 5
0
 void ScrollLeftButton_Fire(object sender, EventArgs e)
 {
     //TabBar.ScrollLeft ();
     TabBar.ScrollPrevious();
 }