Esempio n. 1
0
        ControlBase CreateControls(ControlBase subject, int dock_idx, String name, int x, int y)
        {
            Control.GroupBox gb = new Control.GroupBox(this);
            gb.SetBounds(x, y, 200, 150);
            gb.Text = name;

            Control.Label l_width = new Control.Label(gb);
            l_width.SetSize(35, 15);
            l_width.Text = "Width:";
         
            Control.HorizontalSlider width = new HorizontalSlider(gb);
            width.Name = "Width";
            width.UserData = subject;
            width.Min = 50;
            width.Max = 350;
            width.Value = 100;
            width.SetSize(55, 15);
            width.ValueChanged += WidthChanged;
            Align.PlaceRightBottom(width, l_width);

            Control.Label l_height = new Control.Label(gb);
            l_height.SetSize(35, 15);
            l_height.Text = "Height:";
            Align.PlaceRightBottom(l_height, width, 10);

            Control.HorizontalSlider height = new Control.HorizontalSlider(gb);
            height.Name = "Height";
            height.UserData = subject;
            height.Min = 50;
            height.Max = 350;
            height.Value = 100;
            height.SetSize(55, 15);
            height.ValueChanged += HeightChanged;
            Align.PlaceRightBottom(height, l_height);

            Control.RadioButtonGroup dock = new RadioButtonGroup(gb, "Dock");
            dock.UserData = subject; // store control that we are controlling
            dock.AddOption("Left");
            dock.AddOption("Top");
            dock.AddOption("Right");
            dock.AddOption("Bottom");
            dock.AddOption("Fill");
            dock.SetSelection(dock_idx);
            Align.PlaceDownLeft(dock, l_width, 5);
            //dock.DrawDebugOutlines = true;
            dock.Invalidate();

            Control.Label l_margin = new Control.Label(gb);
            l_margin.Text = "Margin:";
            l_margin.SetBounds(75, 20, 35, 15);
            //Align.PlaceRightBottom(l_margin, dock);
            // can't use Align to anchor with 'dock' because radio group is resized only after layout ~_~
            // this is become really cumbersome
            //l_margin.DrawDebugOutlines = true;

            Control.HorizontalSlider margin = new HorizontalSlider(gb);
            margin.Name = "Margin";
            margin.UserData = subject;
            margin.Min = 0;
            margin.Max = 50;
            margin.Value = 10;
            margin.SetSize(55, 15);
            margin.ValueChanged += MarginChanged;
            Align.PlaceRightBottom(margin, l_margin);

            dock.SelectionChanged += DockChanged;

            return gb;
        }
Esempio n. 2
0
        Base CreateControls(Control.Base subject, int dock_idx, String name, int x, int y)
        {
            Control.GroupBox gb = new Control.GroupBox(this);
            gb.SetBounds(x, y, 200, 150);
            gb.Text = name;

            Control.Label l_width = new Control.Label(gb);
            l_width.SetSize(35, 15);
            l_width.Text = "Width:";

            Control.HorizontalSlider width = new HorizontalSlider(gb);
            width.Name = "Width";
            width.UserData.Add("test", subject);
            width.Min   = 50;
            width.Max   = 350;
            width.Value = 100;
            width.SetSize(55, 15);
            width.ValueChanged += WidthChanged;
            Align.PlaceRightBottom(width, l_width);

            Control.Label l_height = new Control.Label(gb);
            l_height.SetSize(35, 15);
            l_height.Text = "Height:";
            Align.PlaceRightBottom(l_height, width, 10);

            Control.HorizontalSlider height = new Control.HorizontalSlider(gb);
            height.Name = "Height";
            height.UserData.Add("test", subject);
            height.Min   = 50;
            height.Max   = 350;
            height.Value = 100;
            height.SetSize(55, 15);
            height.ValueChanged += HeightChanged;
            Align.PlaceRightBottom(height, l_height);

            Control.RadioButtonGroup dock = new RadioButtonGroup(gb, "Dock");
            dock.UserData.Add("test", subject); // store control that we are controlling
            dock.AddOption("Left");
            dock.AddOption("Top");
            dock.AddOption("Right");
            dock.AddOption("Bottom");
            dock.AddOption("Fill");
            dock.SetSelection(dock_idx);
            Align.PlaceDownLeft(dock, l_width, 5);
            //dock.DrawDebugOutlines = true;
            dock.Invalidate();

            Control.Label l_margin = new Control.Label(gb);
            l_margin.Text = "Margin:";
            l_margin.SetBounds(75, 20, 35, 15);
            //Align.PlaceRightBottom(l_margin, dock);
            // can't use Align to anchor with 'dock' because radio group is resized only after layout ~_~
            // this is become really cumbersome
            //l_margin.DrawDebugOutlines = true;

            Control.HorizontalSlider margin = new HorizontalSlider(gb);
            margin.Name = "Margin";
            margin.UserData.Add("test", subject);
            margin.Min   = 0;
            margin.Max   = 50;
            margin.Value = 10;
            margin.SetSize(55, 15);
            margin.ValueChanged += MarginChanged;
            Align.PlaceRightBottom(margin, l_margin);

            dock.SelectionChanged += DockChanged;

            return(gb);
        }
Esempio n. 3
0
        public GroupBox(Base parent)
            : base(parent)
        {
            {
                Control.GroupBox gb = new Control.GroupBox(this);
                gb.Text = "Group Box (centered)";
                gb.SetBounds(10, 10, 200, 100);
                //Align.Center(gb);
            }

            {
                Control.GroupBox gb = new Control.GroupBox(this);
                gb.AutoSizeToContents = true;
                gb.Text = "With Label (autosized)";
                gb.SetPosition(250, 10);
                Control.Label label = new Control.Label(gb);
                label.AutoSizeToContents = true;
                label.Text = "I'm a label";
            }

            {
                Control.GroupBox gb = new Control.GroupBox(this);
                gb.AutoSizeToContents = true;
                gb.Text = "With Label (autosized)";
                gb.SetPosition(250, 50);
                Control.Label label = new Control.Label(gb);
                label.AutoSizeToContents = true;
                label.Text = "I'm a label. I'm a really long label!";
            }

            {
                Control.GroupBox gb = new Control.GroupBox(this);
                gb.AutoSizeToContents = true;
                gb.Text = "Two docked Labels (autosized)";
                gb.SetPosition(250, 100);
                Control.Label label1 = new Control.Label(gb);
                label1.AutoSizeToContents = true;
                label1.Text = "I'm a label";
                label1.Dock = Pos.Top;
                Control.Label label2 = new Control.Label(gb);
                label2.AutoSizeToContents = true;
                label2.Text = "I'm a label. I'm a really long label!";
                label2.Dock = Pos.Top;
            }

            {
                Control.GroupBox gb = new Control.GroupBox(this);
                gb.AutoSizeToContents = true;
                gb.Text = "Empty (autosized)";
                gb.SetPosition(10, 150);
            }

            {
                Control.GroupBox gb1 = new Control.GroupBox(this);
                //Control.Label gb1 = new Control.Label(this);
                gb1.Padding = Padding.Five;
                gb1.Text = "Yo dawg,";
                gb1.SetPosition(10, 200);
                gb1.SetSize(350, 200);
                //gb1.AutoSizeToContents = true;

                Control.GroupBox gb2 = new Control.GroupBox(gb1);
                gb2.Text = "I herd";
                gb2.Dock = Pos.Left;
                gb2.Margin = Margin.Three;
                gb2.Padding = Padding.Five;
                //gb2.AutoSizeToContents = true;

                Control.GroupBox gb3 = new Control.GroupBox(gb1);
                gb3.Text = "You like";
                gb3.Dock = Pos.Fill;

                Control.GroupBox gb4 = new Control.GroupBox(gb3);
                gb4.Text = "Group Boxes,";
                gb4.Dock = Pos.Top;
                gb4.AutoSizeToContents = true;

                Control.GroupBox gb5 = new Control.GroupBox(gb3);
                gb5.Text = "So I put Group";
                gb5.Dock = Pos.Fill;
                //gb5.AutoSizeToContents = true;

                Control.GroupBox gb6 = new Control.GroupBox(gb5);
                gb6.Text = "Boxes in yo";
                gb6.Dock = Pos.Left;
                gb6.AutoSizeToContents = true;

                Control.GroupBox gb7 = new Control.GroupBox(gb5);
                gb7.Text = "Boxes so you can";
                gb7.Dock = Pos.Top;
                gb7.SetSize(100, 100);

                Control.GroupBox gb8 = new Control.GroupBox(gb7);
                gb8.Text = "Group Box while";
                gb8.Dock = Pos.Top;
                gb8.Margin = Gwen.Margin.Five;
                gb8.AutoSizeToContents = true;

                Control.GroupBox gb9 = new Control.GroupBox(gb7);
                gb9.Text = "u Group Box";
                gb9.Dock = Pos.Bottom;
                gb9.Padding = Gwen.Padding.Five;
                gb9.AutoSizeToContents = true;
            }

            // at the end to apply to all children
            DrawDebugOutlines = true;
        }
Esempio n. 4
0
        public GroupBox(Base parent) : base(parent)
        {
            {
                Control.GroupBox gb = new Control.GroupBox(this);
                gb.Text = "Group Box (centered)";
                gb.SetBounds(10, 10, 200, 100);
                //Align.Center(gb);
            }

            {
                Control.GroupBox gb = new Control.GroupBox(this);
                gb.AutoSizeToContents = true;
                gb.Text = "With Label (autosized)";
                gb.SetPosition(250, 10);
                Control.Label label = new Control.Label(gb);
                label.AutoSizeToContents = true;
                label.Text = "I'm a label";
            }

            {
                Control.GroupBox gb = new Control.GroupBox(this);
                gb.AutoSizeToContents = true;
                gb.Text = "With Label (autosized)";
                gb.SetPosition(250, 50);
                Control.Label label = new Control.Label(gb);
                label.AutoSizeToContents = true;
                label.Text = "I'm a label. I'm a really long label!";
            }

            {
                Control.GroupBox gb = new Control.GroupBox(this);
                gb.AutoSizeToContents = true;
                gb.Text = "Two docked Labels (autosized)";
                gb.SetPosition(250, 100);
                Control.Label label1 = new Control.Label(gb);
                label1.AutoSizeToContents = true;
                label1.Text = "I'm a label";
                label1.Dock = Pos.Top;
                Control.Label label2 = new Control.Label(gb);
                label2.AutoSizeToContents = true;
                label2.Text = "I'm a label. I'm a really long label!";
                label2.Dock = Pos.Top;
            }

            {
                Control.GroupBox gb = new Control.GroupBox(this);
                gb.AutoSizeToContents = true;
                gb.Text = "Empty (autosized)";
                gb.SetPosition(10, 150);
            }

            {
                Control.GroupBox gb1 = new Control.GroupBox(this);
                //Control.Label gb1 = new Control.Label(this);
                gb1.Padding = Padding.Five;
                gb1.Text    = "Yo dawg,";
                gb1.SetPosition(10, 200);
                gb1.SetSize(350, 200);
                //gb1.AutoSizeToContents = true;

                Control.GroupBox gb2 = new Control.GroupBox(gb1);
                gb2.Text    = "I herd";
                gb2.Dock    = Pos.Left;
                gb2.Margin  = Margin.Three;
                gb2.Padding = Padding.Five;
                //gb2.AutoSizeToContents = true;

                Control.GroupBox gb3 = new Control.GroupBox(gb1);
                gb3.Text = "You like";
                gb3.Dock = Pos.Fill;

                Control.GroupBox gb4 = new Control.GroupBox(gb3);
                gb4.Text = "Group Boxes,";
                gb4.Dock = Pos.Top;
                gb4.AutoSizeToContents = true;

                Control.GroupBox gb5 = new Control.GroupBox(gb3);
                gb5.Text = "So I put Group";
                gb5.Dock = Pos.Fill;
                //gb5.AutoSizeToContents = true;

                Control.GroupBox gb6 = new Control.GroupBox(gb5);
                gb6.Text = "Boxes in yo";
                gb6.Dock = Pos.Left;
                gb6.AutoSizeToContents = true;

                Control.GroupBox gb7 = new Control.GroupBox(gb5);
                gb7.Text = "Boxes so you can";
                gb7.Dock = Pos.Top;
                gb7.SetSize(100, 100);

                Control.GroupBox gb8 = new Control.GroupBox(gb7);
                gb8.Text               = "Group Box while";
                gb8.Dock               = Pos.Top;
                gb8.Margin             = Gwen.Margin.Five;
                gb8.AutoSizeToContents = true;

                Control.GroupBox gb9 = new Control.GroupBox(gb7);
                gb9.Text               = "u Group Box";
                gb9.Dock               = Pos.Bottom;
                gb9.Padding            = Gwen.Padding.Five;
                gb9.AutoSizeToContents = true;
            }

            // at the end to apply to all children
            DrawDebugOutlines = true;
        }
Esempio n. 5
0
        public GroupBox(Base parent) : base(parent)
        {
            {
                Control.GroupBox gb = new Control.GroupBox(this)
                {
                    Text = "Group Box (centered)"
                };
                gb.SetBounds(10, 10, 200, 100);
                //Align.Center(gb);
            }

            {
                Control.GroupBox gb = new Control.GroupBox(this)
                {
                    AutoSizeToContents = true,
                    Text = "With Label (autosized)"
                };
                gb.SetPosition(250, 10);
                Control.Label label = new Control.Label(gb)
                {
                    Text = "I'm a label"
                };
            }

            {
                Control.GroupBox gb = new Control.GroupBox(this)
                {
                    AutoSizeToContents = true,
                    Text = "With Label (autosized)"
                };
                gb.SetPosition(250, 50);
                Control.Label label = new Control.Label(gb)
                {
                    Text = "I'm a label. I'm a really long label!"
                };
            }

            {
                Control.GroupBox gb = new Control.GroupBox(this)
                {
                    AutoSizeToContents = true,
                    Text = "Two docked Labels (autosized)"
                };
                gb.SetPosition(250, 100);
                Control.Label label1 = new Control.Label(gb)
                {
                    Text = "I'm a label",
                    Dock = Pos.Top
                };
                Control.Label label2 = new Control.Label(gb)
                {
                    Text = "I'm a label. I'm a really long label!",
                    Dock = Pos.Top
                };
            }

            {
                Control.GroupBox gb = new Control.GroupBox(this)
                {
                    AutoSizeToContents = true,
                    Text = "Empty (autosized)"
                };
                gb.SetPosition(10, 150);
            }

            {
                Control.GroupBox gb1 = new Control.GroupBox(this)
                {
                    //Control.Label gb1 = new Control.Label(this);
                    Padding = Padding.Five,
                    Text    = "Yo dawg,"
                };
                gb1.SetPosition(10, 200);
                gb1.SetSize(350, 200);
                //gb1.AutoSizeToContents = true;

                Control.GroupBox gb2 = new Control.GroupBox(gb1)
                {
                    Text    = "I herd",
                    Dock    = Pos.Left,
                    Margin  = Margin.Three,
                    Padding = Padding.Five
                };
                //gb2.AutoSizeToContents = true;

                Control.GroupBox gb3 = new Control.GroupBox(gb1)
                {
                    Text = "You like",
                    Dock = Pos.Fill
                };

                Control.GroupBox gb4 = new Control.GroupBox(gb3)
                {
                    Text = "Group Boxes,",
                    Dock = Pos.Top,
                    AutoSizeToContents = true
                };

                Control.GroupBox gb5 = new Control.GroupBox(gb3)
                {
                    Text = "So I put Group",
                    Dock = Pos.Fill
                };
                //gb5.AutoSizeToContents = true;

                Control.GroupBox gb6 = new Control.GroupBox(gb5)
                {
                    Text = "Boxes in yo",
                    Dock = Pos.Left,
                    AutoSizeToContents = true
                };

                Control.GroupBox gb7 = new Control.GroupBox(gb5)
                {
                    Text = "Boxes so you can",
                    Dock = Pos.Top
                };
                gb7.SetSize(100, 100);

                Control.GroupBox gb8 = new Control.GroupBox(gb7)
                {
                    Text               = "Group Box while",
                    Dock               = Pos.Top,
                    Margin             = Gwen.Margin.Five,
                    AutoSizeToContents = true
                };

                Control.GroupBox gb9 = new Control.GroupBox(gb7)
                {
                    Text               = "u Group Box",
                    Dock               = Pos.Bottom,
                    Padding            = Gwen.Padding.Five,
                    AutoSizeToContents = true
                };
            }


            // at the end to apply to all children
            DrawDebugOutlines = true;
        }