コード例 #1
0
ファイル: TabList.cs プロジェクト: TodesBrot/Mekanik
        public void SelectTab(Tab _tab)
        {
            this.Children.Remove(this.Group);

            this.CurTab = this.Children.GetTypes <Tab>().IndexOf(_tab);

            for (int i = 0; i < this.TabInfos.Count; i++)
            {
                Tab t = this.Children.GetTypes <Tab>()[i];
                if (i == CurTab)
                {
                    t.Z = 1;
                }
                else
                {
                    t.Z = 1 / (i + 2.0);
                }
            }

            TabGroup g = this.TabInfos[this.CurTab].Entity;

            //g.Position = new Vector(0, this.ContentOffset) + Font.Consolas.GetLineSpacing(14) / 4;
            g.Position = new Vector(0, this.TabOffset) + this.Border / 2;
            g.Z        = 2;
            this.Children.Add(this.Group = g);
        }
コード例 #2
0
ファイル: TabList.cs プロジェクト: TodesBrot/Mekanik
        public override void OnInitialization()
        {
            this.CollapseProgress = this.Collapsed ? 0 : 1;

            double d = Border / 2;
            double x = d;

            for (int i = 0; i < this.TabInfos.Count; i++)
            {
                Tab t = new Tab(this.TabInfos[i].Name)
                {
                    Position = new Vector(x, 0.5)
                };
                this.Children.Add(t);
                x += t.Width;
            }

            if (this.AlignRight)
            {
                foreach (Entity c in this.Children)
                {
                    c.X += (this.OuterSize.X - x - d);
                }
            }

            this.CollapseArrow.Add(new Vector(0, -1), new Vector(-1, 0), new Vector(-1, 0), new Vector(0, 1), new Vector(0, 0.5), new Vector(1, 0.5), new Vector(1, -0.5), new Vector(0, -0.5));
            this.CollapseArrow.Scale    = this.TabOffset / 2 * 0.8;
            this.CollapseArrow.Position = new Vector(this.AlignRight ? this.TabOffset / 2 : (this.OuterSize.X - this.TabOffset / 2), this.TabOffset / 2);
            this.CollapseArrow.Rotation = this.AlignRight ? Meth.Tau / 2 : 0;
            this.Graphics.Add(this.CollapseArrow);

            this.AddMouseArea(this.CollapseArea = new MouseArea(this.CollapseArrow)
            {
                OnClick = key => this.Collapsed = !this.Collapsed
            });

            this._UpdateGraphics();

            this.Children.Add(this.Group = this.TabInfos[0].Entity);
            this.SelectTab(this.Children.GetTypes <Tab>()[0]);
        }
コード例 #3
0
ファイル: TabList.cs プロジェクト: TodesBrot/Mekanik
 public TabInfo(string _name, params Entity[] _entities)
 {
     this.Name   = _name;
     this.Entity = new TabGroup(_entities);
 }