예제 #1
0
파일: Window.cs 프로젝트: slagusev/Gwen.CS
        private void OpenWindowModal(ControlBase control, EventArgs args)
        {
            Control.Window window = new Control.Window(this);
            window.Title               = String.Format("Modal Window ({0})", ++m_WindowCount);
            window.Left                = m_Rand.Next(700);
            window.Top                 = m_Rand.Next(400);
            window.Padding             = new Padding(6, 3, 6, 6);
            window.HorizontalAlignment = HorizontalAlignment.Left;
            window.VerticalAlignment   = VerticalAlignment.Top;
            window.Resizing            = Resizing.None;
            window.MakeModal(true);

            VerticalLayout layout = new VerticalLayout(window);

            Control.GroupBox grb = new Control.GroupBox(layout);
            grb.Text = "Auto size";
            layout   = new VerticalLayout(grb);

            {
                Control.Label label = new Control.Label(layout);
                label.Margin = Margin.Six;
                label.Text   = "Label text";

                Control.Button button = new Control.Button(layout);
                button.Margin = Margin.Six;
                button.Text   = "Button";
                button.Width  = 200;
            }
        }
예제 #2
0
        public StatusBar(Base parent)
            : base(parent)
        {
            Control.StatusBar sb   = new Control.StatusBar(this);
            Control.Label     left = new Control.Label(sb)
            {
                Text = "Label added to left"
            };
            sb.AddControl(left, false);

            Control.Label right = new Control.Label(sb)
            {
                Text = "Label added to right"
            };
            sb.AddControl(right, true);

            Control.Button bl = new Control.Button(sb)
            {
                Text = "Left button"
            };
            sb.AddControl(bl, false);

            Control.Button br = new Control.Button(sb)
            {
                Text = "Right button"
            };
            sb.AddControl(br, true);
        }
예제 #3
0
파일: Window.cs 프로젝트: slagusev/Gwen.CS
        private void OpenWindowAutoSizing(ControlBase control, EventArgs args)
        {
            Control.Window window = new Control.Window(this);
            window.Title               = String.Format("Window ({0})", ++m_WindowCount);
            window.Left                = m_Rand.Next(700);
            window.Top                 = m_Rand.Next(400);
            window.Padding             = new Padding(6, 3, 6, 6);
            window.HorizontalAlignment = HorizontalAlignment.Left;
            window.VerticalAlignment   = VerticalAlignment.Top;
            window.Resizing            = Resizing.None;

            VerticalLayout layout = new VerticalLayout(window);

            Control.GroupBox grb = new Control.GroupBox(layout);
            grb.Text = "Auto size";
            layout   = new VerticalLayout(grb);

            {
                Control.Label label = new Control.Label(layout);
                label.Margin = Margin.Six;
                label.Text   = "Label text";

                Control.Button button = new Control.Button(layout);
                button.Margin = Margin.Six;
                button.Text   = "Click Me";
                button.Width  = 200;

                label        = new Control.Label(layout);
                label.Margin = Margin.Six;
                label.Text   = "Hide / Show Label";
                //label.IsCollapsed = true;

                button.Clicked += (s, a) => label.IsCollapsed = !label.IsCollapsed;
            }
        }
예제 #4
0
        public Docking(Base parent)
            : base(parent)
        {
            font      = Skin.DefaultFont.Copy();
            font.Size = 20;

            outer = new Control.Label(this);
            outer.SetBounds(10, 10, 400, 400);

            Control.Label inner1 = new Control.Label(outer);
            inner1.Text = "1";
            inner1.Font = font;
            inner1.SetSize(100, 100);
            inner1.Dock = Pos.Left;
            Control.Label inner2 = new Control.Label(outer);
            inner2.Text = "2";
            inner2.Font = font;
            inner2.SetSize(100, 100);
            inner2.Dock = Pos.Top;
            Control.Label inner3 = new Control.Label(outer);
            inner3.Text = "3";
            inner3.Font = font;
            inner3.SetSize(100, 100);
            inner3.Dock = Pos.Right;
            Control.Label inner4 = new Control.Label(outer);
            inner4.Text = "4";
            inner4.Font = font;
            inner4.SetSize(100, 100);
            inner4.Dock = Pos.Bottom;
            Control.Label inner5 = new Control.Label(outer);
            inner5.Text = "5";
            inner5.Font = font;
            inner5.SetSize(100, 100);
            inner5.Dock = Pos.Fill;

            outer.DrawDebugOutlines = true;

            inner1.UserData.Add("test", CreateControls(inner1, 0, "Control 1", 440, 10));
            inner2.UserData.Add("test", CreateControls(inner2, 1, "Control 2", 650, 10));
            inner3.UserData.Add("test", CreateControls(inner3, 2, "Control 3", 440, 170));
            inner4.UserData.Add("test", CreateControls(inner4, 3, "Control 4", 650, 170));
            inner5.UserData.Add("test", CreateControls(inner5, 4, "Control 5", 440, 330));

            Control.Label l_padding = new Control.Label(this);
            l_padding.Text = "Padding:";
            l_padding.SetSize(50, 15);
            Align.PlaceDownLeft(l_padding, outer, 20);

            Control.HorizontalSlider padding = new Control.HorizontalSlider(this);
            padding.Min   = 0;
            padding.Max   = 200;
            padding.Value = 10;
            padding.SetSize(100, 20);
            padding.ValueChanged += PaddingChanged;
            Align.PlaceRightBottom(padding, l_padding);

            //DrawDebugOutlines = true;
        }
예제 #5
0
        public Docking(ControlBase parent)
            : base(parent)
        {
            font = Skin.DefaultFont.Copy();
            font.Size = 20;

            outer = new Control.Label(this);
            outer.SetBounds(10, 10, 400, 400);

            Control.Label inner1 = new Control.Label(outer);
            inner1.Text = "1";
            inner1.Font = font;
            inner1.SetSize(100, 100);
            inner1.Dock = Pos.Left;
            Control.Label inner2 = new Control.Label(outer);
            inner2.Text = "2";
            inner2.Font = font;
            inner2.SetSize(100, 100); 
            inner2.Dock = Pos.Top;
            Control.Label inner3 = new Control.Label(outer);
            inner3.Text = "3";
            inner3.Font = font;
            inner3.SetSize(100, 100); 
            inner3.Dock = Pos.Right;
            Control.Label inner4 = new Control.Label(outer);
            inner4.Text = "4";
            inner4.Font = font;
            inner4.SetSize(100, 100); 
            inner4.Dock = Pos.Bottom;
            Control.Label inner5 = new Control.Label(outer);
            inner5.Text = "5";
            inner5.Font = font;
            inner5.SetSize(100, 100); 
            inner5.Dock = Pos.Fill;

            outer.DrawDebugOutlines = true;

            inner1.UserData = CreateControls(inner1, 0, "Control 1", 440, 10);
            inner2.UserData = CreateControls(inner2, 1, "Control 2", 650, 10);
            inner3.UserData = CreateControls(inner3, 2, "Control 3", 440, 170);
            inner4.UserData = CreateControls(inner4, 3, "Control 4", 650, 170);
            inner5.UserData = CreateControls(inner5, 4, "Control 5", 440, 330);

            Control.Label l_padding = new Control.Label(this);
            l_padding.Text = "Padding:";
            l_padding.SetSize(50, 15);
            Align.PlaceDownLeft(l_padding, outer, 20);

            Control.HorizontalSlider padding = new Control.HorizontalSlider(this);
            padding.Min = 0;
            padding.Max = 200;
            padding.Value = 10;
            padding.SetSize(100, 20);
            padding.ValueChanged += PaddingChanged;
            Align.PlaceRightBottom(padding, l_padding);

            //DrawDebugOutlines = true;
        }
예제 #6
0
파일: TextBox.cs 프로젝트: slagusev/Gwen.CS
            public TextPad(ControlBase parent)
                : base(parent)
            {
                StartPosition = StartPosition.CenterParent;
                Size          = new Size(400, 300);
                Padding       = new Padding(1, 0, 1, 1);
                Title         = "TextPad";

                DockLayout layout = new DockLayout(this);

                layout.Dock = Dock.Fill;

                Control.MenuStrip menuStrip = new MenuStrip(layout);
                menuStrip.Dock = Dock.Top;
                Control.MenuItem fileMenu = menuStrip.AddItem("File");
                fileMenu.Menu.AddItem("Open...", String.Empty, "Ctrl+O").SetAction((s, a) => OnOpen(s, a));
                fileMenu.Menu.AddItem("Save", String.Empty, "Ctrl+S").SetAction((s, a) => OnSave(s, a));
                fileMenu.Menu.AddItem("Save As...").SetAction((s, a) => OnSaveAs(s, a));
                fileMenu.Menu.AddItem("Quit", String.Empty, "Ctrl+Q").SetAction((s, a) => Close());

                m_Font          = Skin.DefaultFont.Copy();
                m_Font.FaceName = "Courier New";

                Control.StatusBar statusBar = new Gwen.Control.StatusBar(layout);
                statusBar.Dock = Dock.Bottom;

                Control.Label length = new Control.Label(statusBar);
                length.Margin = new Margin(5, 0, 5, 0);

                Control.Label label = new Control.Label(statusBar);
                label.Margin = new Margin(5, 0, 5, 0);
                label.Text   = "Length:";

                Control.Label lines = new Control.Label(statusBar);
                lines.Margin = new Margin(5, 0, 5, 0);

                label        = new Control.Label(statusBar);
                label.Margin = new Margin(5, 0, 5, 0);
                label.Text   = "Lines:";

                m_TextBox      = new Control.MultilineTextBox(layout);
                m_TextBox.Dock = Dock.Fill;
                m_TextBox.ShouldDrawBackground = false;
                m_TextBox.Font         = m_Font;
                m_TextBox.TextChanged += (sender, arguments) => { lines.Text = m_TextBox.TotalLines.ToString(); length.Text = m_TextBox.Text.Length.ToString(); };
                m_TextBox.Text         = "";

                m_Path = null;
            }
예제 #7
0
        public StatusBar(Base parent)
            : base(parent)
        {
            Control.StatusBar sb = new Control.StatusBar(this);
            Control.Label left = new Control.Label(sb);
            left.Text = "Label added to left";
            sb.AddControl(left, false);

            Control.Label right = new Control.Label(sb);
            right.Text = "Label added to right";
            sb.AddControl(right, true);

            Control.Button bl = new Control.Button(sb);
            bl.Text = "Left button";
            sb.AddControl(bl, false);

            Control.Button br = new Control.Button(sb);
            br.Text = "Right button";
            sb.AddControl(br, true);
        }
예제 #8
0
파일: Label.cs 프로젝트: esdrubal/guieditor
        public Label(Base parent) : base(parent)
        {
            {
                Control.Label label = new Control.Label(this);
                label.Text = "Standard label (not autosized)";
                label.SetBounds(10, 10, 100, 10);
            }
            {
                Control.Label label = new Control.Label(this);
                label.AutoSizeToContents = true;
                label.Text = "Chinese: \u4E45\u6709\u5F52\u5929\u613F \u7EC8\u8FC7\u9B3C\u95E8\u5173";
                label.SetPosition(10, 30);
            }
            {
                Control.Label label = new Control.Label(this);
                label.AutoSizeToContents = true;
                label.Text = "Japanese: \u751F\u3080\u304E\u3000\u751F\u3054\u3081\u3000\u751F\u305F\u307E\u3054";
                label.SetPosition(10, 50);
            }
            {
                Control.Label label = new Control.Label(this);
                label.AutoSizeToContents = true;
                label.Text = "Korean: \uADF9\uC9C0\uD0D0\uD5D8\u3000\uD611\uD68C\uACB0\uC131\u3000\uCCB4\uACC4\uC801\u3000\uC5F0\uAD6C";
                label.SetPosition(10, 70);
            }
            {
                Control.Label label = new Control.Label(this);
                label.AutoSizeToContents = true;
                label.Text = "Hindi: \u092F\u0947 \u0905\u0928\u0941\u091A\u094D\u091B\u0947\u0926 \u0939\u093F\u0928\u094D\u0926\u0940 \u092E\u0947\u0902 \u0939\u0948\u0964";
                label.SetPosition(10, 90);
            }
            {
                Control.Label label = new Control.Label(this);
                label.AutoSizeToContents = true;
                label.Text = "Arabic: \u0627\u0644\u0622\u0646 \u0644\u062D\u0636\u0648\u0631 \u0627\u0644\u0645\u0624\u062A\u0645\u0631 \u0627\u0644\u062F\u0648\u0644\u064A";
                label.SetPosition(10, 110);
            }
            {
                Control.Label label = new Control.Label(this);
                label.AutoSizeToContents = true;
                label.MouseInputEnabled  = true; // needed for tooltip
                label.Text      = "Wow, Coloured Text (and tooltip)";
                label.TextColor = Color.Blue;
                label.SetToolTipText("I'm a tooltip");
                font3 = new Font(Skin.Renderer, "Motorwerk", 20);
                ((Control.Label)label.ToolTip).Font = font3;
                label.SetPosition(10, 130);
            }
            {
                Control.Label label = new Control.Label(this);
                label.AutoSizeToContents = true;
                label.Text      = "Coloured Text With Alpha";
                label.TextColor = Color.FromArgb(100, 0, 0, 255);
                label.SetPosition(10, 150);
            }
            {
                // Note that when using a custom font, this font object has to stick around
                // for the lifetime of the label. Rethink, or is that ideal?
                font1          = new Font(Skin.Renderer);
                font1.FaceName = "Comic Sans MS";
                font1.Size     = 25;

                Control.Label label = new Control.Label(this);
                label.AutoSizeToContents = true;
                label.Text = "Custom Font (Comic Sans 25)";
                label.SetPosition(10, 170);
                label.Font = font1;
            }
            {
                font2 = new Font(Skin.Renderer, "French Script MT", 35);

                Control.Label label = new Control.Label(this);
                label.AutoSizeToContents = true;
                label.Font = font2;
                label.SetPosition(10, 210);
                label.Text = "Custom Font (French Script MT 35)";
            }

            // alignment test
            {
                Control.Label txt = new Control.Label(this);
                txt.SetPosition(10, 280);
                txt.Text = "Alignment test";
                txt.AutoSizeToContents = true;

                Control.Label outer = new Control.Label(this);
                outer.SetBounds(10, 300, 190, 190);

                Control.Label l11 = new Control.Label(outer);
                l11.SetBounds(10, 10, 50, 50);
                l11.Text      = "TL";
                l11.Alignment = Pos.Top | Pos.Left;

                Control.Label l12 = new Control.Label(outer);
                l12.SetBounds(70, 10, 50, 50);
                l12.Text      = "T";
                l12.Alignment = Pos.Top | Pos.CenterH;

                Control.Label l13 = new Control.Label(outer);
                l13.SetBounds(130, 10, 50, 50);
                l13.Text      = "TR";
                l13.Alignment = Pos.Top | Pos.Right;

                Control.Label l21 = new Control.Label(outer);
                l21.SetBounds(10, 70, 50, 50);
                l21.Text      = "L";
                l21.Alignment = Pos.Left | Pos.CenterV;

                Control.Label l22 = new Control.Label(outer);
                l22.SetBounds(70, 70, 50, 50);
                l22.Text      = "C";
                l22.Alignment = Pos.CenterH | Pos.CenterV;

                Control.Label l23 = new Control.Label(outer);
                l23.SetBounds(130, 70, 50, 50);
                l23.Text      = "R";
                l23.Alignment = Pos.Right | Pos.CenterV;

                Control.Label l31 = new Control.Label(outer);
                l31.SetBounds(10, 130, 50, 50);
                l31.Text      = "BL";
                l31.Alignment = Pos.Bottom | Pos.Left;

                Control.Label l32 = new Control.Label(outer);
                l32.SetBounds(70, 130, 50, 50);
                l32.Text      = "B";
                l32.Alignment = Pos.Bottom | Pos.CenterH;

                Control.Label l33 = new Control.Label(outer);
                l33.SetBounds(130, 130, 50, 50);
                l33.Text      = "BR";
                l33.Alignment = Pos.Bottom | Pos.Right;

                outer.DrawDebugOutlines = true;
            }
        }
예제 #9
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;
        }
예제 #10
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;
        }
예제 #11
0
파일: Menu.cs 프로젝트: slagusev/Gwen.CS
        public Menu(ControlBase parent)
            : base(parent)
        {
            /* Menu Strip */
            {
                Control.MenuStrip menu = new Control.MenuStrip(this);
                menu.Dock = Dock.Top;

                /* File */
                {
                    Control.MenuItem root = menu.AddItem("File");
                    root.Menu.AddItem("Load", "test16.png", "Ctrl+L").SetAction(MenuItemSelect);
                    root.Menu.AddItem("Save", String.Empty, "Ctrl+S").SetAction(MenuItemSelect);
                    root.Menu.AddItem("Save As..", String.Empty, "Ctrl+A").SetAction(MenuItemSelect);
                    root.Menu.AddItem("Quit", String.Empty, "Ctrl+Q").SetAction(MenuItemSelect);
                }

                /* Russian */
                {
                    Control.MenuItem pRoot = menu.AddItem("\u043F\u0438\u0440\u0430\u0442\u0441\u0442\u0432\u043E");
                    pRoot.Menu.AddItem("\u5355\u5143\u6D4B\u8BD5").SetAction(MenuItemSelect);
                    pRoot.Menu.AddItem("\u0111\u01A1n v\u1ECB th\u1EED nghi\u1EC7m", "test16.png").SetAction(MenuItemSelect);
                }
                {
                    Control.MenuItem sRoot = menu.AddItemPath("File/s/d/s/s/d/f");
                }
                /* Embdedded Menu Items */
                {
                    Control.MenuItem pRoot = menu.AddItem("Submenu");

                    Control.MenuItem pCheckable = pRoot.Menu.AddItem("Checkable");
                    pCheckable.IsCheckable = true;
                    pCheckable.IsCheckable = true;

                    {
                        Control.MenuItem pRootB = pRoot.Menu.AddItem("Two");
                        pRootB.Menu.AddItem("Two.One");
                        pRootB.Menu.AddItem("Two.Two");
                        pRootB.Menu.AddItem("Two.Three");
                        pRootB.Menu.AddItem("Two.Four");
                        pRootB.Menu.AddItem("Two.Five");
                        pRootB.Menu.AddItem("Two.Six");
                        pRootB.Menu.AddItem("Two.Seven");
                        pRootB.Menu.AddItem("Two.Eight");
                        pRootB.Menu.AddItem("Two.Nine", "test16.png");
                    }

                    pRoot.Menu.AddItem("Three");
                    pRoot.Menu.AddItem("Four");
                    pRoot.Menu.AddItem("Five");

                    {
                        Control.MenuItem pRootB = pRoot.Menu.AddItem("Six");
                        pRootB.Menu.AddItem("Six.One");
                        pRootB.Menu.AddItem("Six.Two");
                        pRootB.Menu.AddItem("Six.Three");
                        pRootB.Menu.AddItem("Six.Four");
                        pRootB.Menu.AddItem("Six.Five", "test16.png");

                        {
                            Control.MenuItem pRootC = pRootB.Menu.AddItem("Six.Six");
                            pRootC.Menu.AddItem("Sheep");
                            pRootC.Menu.AddItem("Goose");
                            {
                                Control.MenuItem pRootD = pRootC.Menu.AddItem("Camel");
                                pRootD.Menu.AddItem("Eyes");
                                pRootD.Menu.AddItem("Nose");
                                {
                                    Control.MenuItem pRootE = pRootD.Menu.AddItem("Hair");
                                    pRootE.Menu.AddItem("Blonde");
                                    pRootE.Menu.AddItem("Black");
                                    {
                                        Control.MenuItem pRootF = pRootE.Menu.AddItem("Red");
                                        pRootF.Menu.AddItem("Light");
                                        pRootF.Menu.AddItem("Medium");
                                        pRootF.Menu.AddItem("Dark");
                                    }
                                    pRootE.Menu.AddItem("Brown");
                                }
                                pRootD.Menu.AddItem("Ears");
                            }
                            pRootC.Menu.AddItem("Duck");
                        }

                        pRootB.Menu.AddItem("Six.Seven");
                        pRootB.Menu.AddItem("Six.Eight");
                        pRootB.Menu.AddItem("Six.Nine");
                    }

                    pRoot.Menu.AddItem("Seven");
                }
            }

            /* Context Menu Strip */
            {
                Control.Label lblClickMe = new Control.Label(this);
                lblClickMe.Dock = Dock.Fill;
                lblClickMe.VerticalAlignment = VerticalAlignment.Center;
                lblClickMe.Text = "Right Click Me";

                m_ContextMenu = new Control.Menu(this);
                m_ContextMenu.AddItem("Test");
                m_ContextMenu.AddItem("Clickable").Clicked += (sender2, args2) =>
                {
                    UnitPrint("Clickable item was clicked");
                };

                lblClickMe.RightClicked += (sender, args) =>
                {
                    m_ContextMenu.Position = this.CanvasPosToLocal(new Point(args.X, args.Y));
                    m_ContextMenu.Show();
                };
            }
        }
예제 #12
0
        ControlBase CreateControls(Control.ControlBase subject, Dock docking, string name, ControlBase container)
        {
            Control.GroupBox gb = new Control.GroupBox(container);
            gb.Text = name;
            {
                HorizontalLayout hlayout = new HorizontalLayout(gb);
                {
                    Control.GroupBox dgb = new Control.GroupBox(hlayout);
                    dgb.Text = "Dock";
                    {
                        Control.RadioButtonGroup dock = new RadioButtonGroup(dgb);
                        dock.UserData = subject;
                        dock.AddOption("Left", null, Dock.Left);
                        dock.AddOption("Top", null, Dock.Top);
                        dock.AddOption("Right", null, Dock.Right);
                        dock.AddOption("Bottom", null, Dock.Bottom);
                        dock.AddOption("Fill", null, Dock.Fill);
                        dock.SelectByUserData(docking);
                        dock.SelectionChanged += DockChanged;
                    }

                    VerticalLayout vlayout = new VerticalLayout(hlayout);
                    {
                        HorizontalLayout hlayout2 = new HorizontalLayout(vlayout);
                        {
                            Control.GroupBox hgb = new Control.GroupBox(hlayout2);
                            hgb.Text = "H. Align";
                            {
                                Control.RadioButtonGroup halign = new RadioButtonGroup(hgb);
                                halign.UserData = subject;
                                halign.AddOption("Left", null, HorizontalAlignment.Left);
                                halign.AddOption("Center", null, HorizontalAlignment.Center);
                                halign.AddOption("Right", null, HorizontalAlignment.Right);
                                halign.AddOption("Stretch", null, HorizontalAlignment.Stretch);
                                halign.SelectByUserData(subject.HorizontalAlignment);
                                halign.SelectionChanged += HAlignChanged;
                            }

                            Control.GroupBox vgb = new Control.GroupBox(hlayout2);
                            vgb.Text = "V. Align";
                            {
                                Control.RadioButtonGroup valign = new RadioButtonGroup(vgb);
                                valign.UserData = subject;
                                valign.AddOption("Top", null, VerticalAlignment.Top);
                                valign.AddOption("Center", null, VerticalAlignment.Center);
                                valign.AddOption("Bottom", null, VerticalAlignment.Bottom);
                                valign.AddOption("Stretch", null, VerticalAlignment.Stretch);
                                valign.SelectByUserData(subject.VerticalAlignment);
                                valign.SelectionChanged += VAlignChanged;
                            }
                        }

                        Control.Layout.GridLayout glayout = new Control.Layout.GridLayout(vlayout);
                        glayout.SetColumnWidths(Control.Layout.GridLayout.AutoSize, Control.Layout.GridLayout.Fill);
                        {
                            Control.Label l_width = new Control.Label(glayout);
                            l_width.Text = "Width:";

                            Control.HorizontalSlider width = new HorizontalSlider(glayout);
                            width.Name          = "Width";
                            width.UserData      = subject;
                            width.Min           = 50;
                            width.Max           = 350;
                            width.Value         = 100;
                            width.ValueChanged += WidthChanged;

                            Control.Label l_height = new Control.Label(glayout);
                            l_height.Text = "Height:";

                            Control.HorizontalSlider height = new Control.HorizontalSlider(glayout);
                            height.Name          = "Height";
                            height.UserData      = subject;
                            height.Min           = 50;
                            height.Max           = 350;
                            height.Value         = 100;
                            height.ValueChanged += HeightChanged;

                            Control.Label l_margin = new Control.Label(glayout);
                            l_margin.Text = "Margin:";

                            Control.HorizontalSlider margin = new HorizontalSlider(glayout);
                            margin.Name          = "Margin";
                            margin.UserData      = subject;
                            margin.Min           = 0;
                            margin.Max           = 50;
                            margin.Value         = 0;
                            margin.ValueChanged += MarginChanged;
                        }
                    }
                }
            }

            return(gb);
        }
예제 #13
0
        public GroupBox(ControlBase parent)
            : base(parent)
        {
            Control.Layout.GridLayout layout = new Control.Layout.GridLayout(this);
            layout.ColumnCount = 2;

            {
                Control.GroupBox gb = new Control.GroupBox(layout);
                gb.Size = new Size(200, 100);
                gb.Text = "Group Box";
            }

            {
                Control.GroupBox gb = new Control.GroupBox(layout);
                gb.HorizontalAlignment = HorizontalAlignment.Left;
                gb.VerticalAlignment   = VerticalAlignment.Top;
                gb.Text = "With Label (autosized)";
                Control.Label label = new Control.Label(gb);
                label.Dock = Dock.Fill;
                label.Text = "I'm a label";
            }

            {
                Control.GroupBox gb = new Control.GroupBox(layout);
                gb.HorizontalAlignment = HorizontalAlignment.Left;
                gb.VerticalAlignment   = VerticalAlignment.Top;
                gb.Text = "With Label (autosized)";
                Control.Label label = new Control.Label(gb);
                label.Dock = Dock.Fill;
                label.Text = "I'm a label. I'm a really long label!";
            }

            {
                Control.GroupBox gb = new Control.GroupBox(layout);
                gb.HorizontalAlignment = HorizontalAlignment.Left;
                gb.VerticalAlignment   = VerticalAlignment.Top;
                gb.Text = "Two docked Labels (autosized)";
                Control.ControlBase gbl    = new Control.Layout.DockLayout(gb);
                Control.Label       label1 = new Control.Label(gbl);
                label1.Text = "I'm a label";
                label1.Dock = Dock.Top;
                Control.Label label2 = new Control.Label(gbl);
                label2.Text = "I'm a label. I'm a really long label!";
                label2.Dock = Dock.Top;
            }

            {
                Control.GroupBox gb = new Control.GroupBox(layout);
                gb.HorizontalAlignment = HorizontalAlignment.Left;
                gb.VerticalAlignment   = VerticalAlignment.Top;
                gb.Text = "Empty (autosized)";
            }

            {
                Control.GroupBox gb1 = new Control.GroupBox(layout);
                gb1.HorizontalAlignment = HorizontalAlignment.Left;
                gb1.VerticalAlignment   = VerticalAlignment.Top;
                gb1.Padding             = Padding.Five;
                gb1.Text = "Yo dawg,";
                Control.ControlBase gb1l = new Control.Layout.DockLayout(gb1);

                Control.GroupBox gb2 = new Control.GroupBox(gb1l);
                gb2.Text    = "I herd";
                gb2.Dock    = Dock.Left;
                gb2.Margin  = Margin.Three;
                gb2.Padding = Padding.Five;

                Control.GroupBox gb3 = new Control.GroupBox(gb1l);
                gb3.Text = "You like";
                gb3.Dock = Dock.Fill;
                Control.ControlBase gb3l = new Control.Layout.DockLayout(gb3);

                Control.GroupBox gb4 = new Control.GroupBox(gb3l);
                gb4.Text = "Group Boxes,";
                gb4.Dock = Dock.Top;

                Control.GroupBox gb5 = new Control.GroupBox(gb3l);
                gb5.Text = "So I put Group";
                gb5.Dock = Dock.Fill;
                Control.ControlBase gb5l = new Control.Layout.DockLayout(gb5);

                Control.GroupBox gb6 = new Control.GroupBox(gb5l);
                gb6.Text = "Boxes in yo";
                gb6.Dock = Dock.Left;

                Control.GroupBox gb7 = new Control.GroupBox(gb5l);
                gb7.Text = "Boxes so you can";
                gb7.Dock = Dock.Top;
                Control.ControlBase gb7l = new Control.Layout.DockLayout(gb7);

                Control.GroupBox gb8 = new Control.GroupBox(gb7l);
                gb8.Text   = "Group Box while";
                gb8.Dock   = Dock.Top;
                gb8.Margin = Gwen.Margin.Five;

                Control.GroupBox gb9 = new Control.GroupBox(gb7l);
                gb9.Text    = "u Group Box";
                gb9.Dock    = Dock.Bottom;
                gb9.Padding = Gwen.Padding.Five;
            }
        }
예제 #14
0
        public CommonDialogs(ControlBase parent)
            : base(parent)
        {
            Control.Layout.GridLayout grid = new Control.Layout.GridLayout(this);
            grid.Dock = Dock.Fill;
            grid.SetColumnWidths(Control.Layout.GridLayout.AutoSize, Control.Layout.GridLayout.Fill);

            Control.Button button;

            {
                Control.Label openFile = null;

                button          = new Control.Button(grid);
                button.Margin   = Margin.Five;
                button.Text     = "OpenFileDialog";
                button.Clicked += (sender, args) =>
                {
                    openFile.Text = "";
                    OpenFileDialog dialog = Component.Create <OpenFileDialog>(this);
                    dialog.InitialFolder = "C:\\";
                    dialog.Filters       = "Text Files (*.txt)|*.txt|All Files (*.*)|*.*";
                    dialog.Callback      = (path) => openFile.Text = path != null ? path : "Cancelled";
                };

                openFile             = new Control.Label(grid);
                openFile.TextPadding = new Padding(3, 0, 0, 0);
                openFile.Alignment   = Alignment.Left | Alignment.CenterV;
            }

            {
                Control.Label saveFile = null;

                button          = new Control.Button(grid);
                button.Margin   = Margin.Five;
                button.Text     = "SaveFileDialog";
                button.Clicked += (sender, args) =>
                {
                    saveFile.Text = "";
                    SaveFileDialog dialog = Component.Create <SaveFileDialog>(this);
                    dialog.Callback = (path) => saveFile.Text = path != null ? path : "Cancelled";
                };

                saveFile             = new Control.Label(grid);
                saveFile.TextPadding = new Padding(3, 0, 0, 0);
                saveFile.Alignment   = Alignment.Left | Alignment.CenterV;
            }

            {
                Control.Label createFile = null;

                button          = new Control.Button(grid);
                button.Margin   = Margin.Five;
                button.Text     = "SaveFileDialog (create)";
                button.Clicked += (sender, args) =>
                {
                    createFile.Text = "";
                    SaveFileDialog dialog = Component.Create <SaveFileDialog>(this);
                    dialog.Title        = "Create File";
                    dialog.OkButtonText = "Create";
                    dialog.Callback     = (path) => createFile.Text = path != null ? path : "Cancelled";
                };

                createFile             = new Control.Label(grid);
                createFile.TextPadding = new Padding(3, 0, 0, 0);
                createFile.Alignment   = Alignment.Left | Alignment.CenterV;
            }

            {
                Control.Label selectFolder = null;

                button          = new Control.Button(grid);
                button.Margin   = Margin.Five;
                button.Text     = "FolderBrowserDialog";
                button.Clicked += (sender, args) =>
                {
                    selectFolder.Text = "";
                    FolderBrowserDialog dialog = Component.Create <FolderBrowserDialog>(this);
                    dialog.InitialFolder = "C:\\";
                    dialog.Callback      = (path) => selectFolder.Text = path != null ? path : "Cancelled";
                };

                selectFolder             = new Control.Label(grid);
                selectFolder.TextPadding = new Padding(3, 0, 0, 0);
                selectFolder.Alignment   = Alignment.Left | Alignment.CenterV;
            }
        }
예제 #15
0
        public ListBox(ControlBase parent)
            : base(parent)
        {
            {
                Control.ListBox ctrl = new Control.ListBox(this);
                ctrl.SetPosition(10, 10);

                ctrl.AddRow("First");
                ctrl.AddRow("Blue");
                ctrl.AddRow("Yellow");
                ctrl.AddRow("Orange");
                ctrl.AddRow("Brown");
                ctrl.AddRow("Black");
                ctrl.AddRow("Green");
                ctrl.AddRow("Dog");
                ctrl.AddRow("Cat Blue");
                ctrl.AddRow("Shoes");
                ctrl.AddRow("Shirts");
                ctrl.AddRow("Chair");
                ctrl.AddRow("I'm autosized");
                ctrl.AddRow("Last");

                ctrl.AllowMultiSelect = true;
                ctrl.SelectRowsByRegex("Bl.e|Dog");

                ctrl.RowSelected   += RowSelected;
                ctrl.RowUnselected += RowUnSelected;

                ctrl.SizeToContents();
            }

            {
                Table ctrl = new Table(this);
                ctrl.SetPosition(120, 10);

                ctrl.AddRow("First");
                ctrl.AddRow("Blue");
                ctrl.AddRow("Yellow");
                ctrl.AddRow("Orange");
                ctrl.AddRow("Brown");
                ctrl.AddRow("Black");
                ctrl.AddRow("Green");
                ctrl.AddRow("Dog");
                ctrl.AddRow("Cat Blue");
                ctrl.AddRow("Shoes");
                ctrl.AddRow("Shirts");
                ctrl.AddRow("Chair");
                ctrl.AddRow("I'm autosized");
                ctrl.AddRow("Last");

                ctrl.SizeToContents(0);
            }

            {
                Control.ListBox ctrl = new Control.ListBox(this);
                ctrl.SetBounds(220, 10, 200, 200);
                ctrl.ColumnCount = 3;
                //ctrl.AllowMultiSelect = true;
                ctrl.RowSelected   += RowSelected;
                ctrl.RowUnselected += RowUnSelected;

                {
                    TableRow row = ctrl.AddRow("Baked Beans");
                    row.SetCellText(1, "Heinz");
                    row.SetCellText(2, "£3.50");
                }

                {
                    TableRow row = ctrl.AddRow("Bananas");
                    row.SetCellText(1, "Trees");
                    row.SetCellText(2, "£1.27");
                }

                {
                    TableRow row = ctrl.AddRow("Chicken");
                    row.SetCellText(1, "\u5355\u5143\u6D4B\u8BD5");
                    row.SetCellText(2, "£8.95");
                }
            }

            {
                // fixed-size table
                Control.Layout.Table table = new Table(this);
                table.SetColumnCount(3);
                table.SetBounds(450, 10, 320, 100);
                table.SetColumnWidth(0, 100);
                table.SetColumnWidth(1, 100);
                table.SetColumnWidth(2, 100);
                var row1 = table.AddRow();
                row1.SetCellText(0, "Row 1");
                row1.SetCellText(1, "R1 cell 1");
                row1.SetCellText(2, "Row 1 cell 2");

                table.AddRow().Text = "Row 2, slightly bigger";
                table[1].SetCellText(1, "Center cell");

                table.AddRow().Text = "Row 3, medium";
                table[2].SetCellText(2, "Last cell");
            }

            {
                //Control.Label outer = new Control.Label(this);
                //outer.SetBounds(340, 140, 300, 200);

                // autosized table
                Control.Layout.Table table = new Table(this);
                table.SetColumnCount(3);
                table.SetPosition(450, 150);

                var row1 = table.AddRow();
                row1.SetCellText(0, "Row 1");
                row1.SetCellText(1, "R1 cell 1");
                row1.SetCellText(2, "Row 1 cell 2");

                table.AddRow().Text = "Row 2, slightly bigger";
                table[1].SetCellText(1, "Center cell");

                table.AddRow().Text = "Row 3, medium";
                table[2].SetCellText(2, "Last cell");

                table.SizeToContents(0);
            }

            /* Selecting Rows in Code */
            {
                Control.ListBox ctrl = new Control.ListBox(this);
                ctrl.SetPosition(10, 320);

                ListBoxRow Row = ctrl.AddRow("Row");
                ctrl.AddRow("Text");
                ctrl.AddRow("InternalName", "Name");
                ctrl.AddRow("UserData", "Internal", 12);

                ctrl.SizeToContents();

                Control.CheckBox Multiline = new Control.CheckBox(this);
                Multiline.SetPosition(10, 405);
                Multiline.CheckChanged += delegate(ControlBase sender, EventArgs args)
                {
                    ctrl.AllowMultiSelect = Multiline.IsChecked;
                };

                Control.Label lblml = new Control.Label(this);
                lblml.Text = "Enable MultiSelect";
                lblml.SetPosition(30, 405);


                //Select by Menu Item
                {
                    Control.Button TriangleButton = new Control.Button(this);
                    TriangleButton.SetPosition(100, 320);
                    TriangleButton.Text     = "Row";
                    TriangleButton.Width    = 100;
                    TriangleButton.Clicked += delegate(ControlBase sender, ClickedEventArgs args)
                    {
                        ctrl.SelectedRow = Row;
                    };
                }

                //Select by Text
                {
                    Control.Button TestBtn = new Control.Button(this);
                    TestBtn.SetPosition(100, 340);
                    TestBtn.Text     = "Text";
                    TestBtn.Width    = 100;
                    TestBtn.Clicked += delegate(ControlBase sender, ClickedEventArgs args)
                    {
                        ctrl.SelectByText("Text");
                    };
                }

                //Select by Name
                {
                    Control.Button TestBtn = new Control.Button(this);
                    TestBtn.SetPosition(100, 360);
                    TestBtn.Text     = "Name";
                    TestBtn.Width    = 100;
                    TestBtn.Clicked += delegate(ControlBase sender, ClickedEventArgs args)
                    {
                        ctrl.SelectByName("Name");
                    };
                }

                //Select by UserData
                {
                    Control.Button TestBtn = new Control.Button(this);
                    TestBtn.SetPosition(100, 380);
                    TestBtn.Text     = "UserData";
                    TestBtn.Width    = 100;
                    TestBtn.Clicked += delegate(ControlBase sender, ClickedEventArgs args)
                    {
                        ctrl.SelectByUserData(12);
                    };
                }
            }
        }
예제 #16
0
        public ListBox(Base parent)
            : base(parent)
        {
            {
                Control.ListBox ctrl = new Control.ListBox(this);
                ctrl.SetPosition(10, 10);

                ctrl.AddRow("First");
                ctrl.AddRow("Blue");
                ctrl.AddRow("Yellow");
                ctrl.AddRow("Orange");
                ctrl.AddRow("Brown");
                ctrl.AddRow("Black");
                ctrl.AddRow("Green");
                ctrl.AddRow("Dog");
                ctrl.AddRow("Cat Blue");
                ctrl.AddRow("Shoes");
                ctrl.AddRow("Shirts");
                ctrl.AddRow("Chair");
                ctrl.AddRow("I'm autosized");
                ctrl.AddRow("Last");

                ctrl.AllowMultiSelect = true;
                ctrl.SelectRowsByRegex("Bl.e|Dog");

                ctrl.RowSelected += RowSelected;
                ctrl.RowUnselected += RowUnSelected;

                ctrl.SizeToContents();
            }

            {
                Table ctrl = new Table(this);
                ctrl.SetPosition(120, 10);

                ctrl.AddRow("First");
                ctrl.AddRow("Blue");
                ctrl.AddRow("Yellow");
                ctrl.AddRow("Orange");
                ctrl.AddRow("Brown");
                ctrl.AddRow("Black");
                ctrl.AddRow("Green");
                ctrl.AddRow("Dog");
                ctrl.AddRow("Cat Blue");
                ctrl.AddRow("Shoes");
                ctrl.AddRow("Shirts");
                ctrl.AddRow("Chair");
                ctrl.AddRow("I'm autosized");
                ctrl.AddRow("Last");

                ctrl.SizeToContents(0);
            }

            {
                Control.ListBox ctrl = new Control.ListBox(this);
                ctrl.SetBounds(220, 10, 200, 200);
                ctrl.ColumnCount = 3;
                //ctrl.AllowMultiSelect = true;
                ctrl.RowSelected += RowSelected;
                ctrl.RowUnselected += RowUnSelected;

                {
                    TableRow row = ctrl.AddRow("Baked Beans");
                    row.SetCellText(1, "Heinz");
                    row.SetCellText(2, "£3.50");
                }

                {
                    TableRow row = ctrl.AddRow("Bananas");
                    row.SetCellText(1, "Trees");
                    row.SetCellText(2, "£1.27");
                }

                {
                    TableRow row = ctrl.AddRow("Chicken");
                    row.SetCellText(1, "\u5355\u5143\u6D4B\u8BD5");
                    row.SetCellText(2, "£8.95");
                }
            }

            {
                // fixed-size table
                Control.Layout.Table table = new Table(this);
                table.SetColumnCount(3);
                table.SetBounds(450, 10, 320, 100);
                table.SetColumnWidth(0, 100);
                table.SetColumnWidth(1, 100);
                table.SetColumnWidth(2, 100);
                var row1 = table.AddRow();
                row1.SetCellText(0, "Row 1");
                row1.SetCellText(1, "R1 cell 1");
                row1.SetCellText(2, "Row 1 cell 2");

                table.AddRow().Text = "Row 2, slightly bigger";
                table[1].SetCellText(1, "Center cell");

                table.AddRow().Text = "Row 3, medium";
                table[2].SetCellText(2, "Last cell");
            }

            {
                //Control.Label outer = new Control.Label(this);
                //outer.SetBounds(340, 140, 300, 200);

                // autosized table
                Control.Layout.Table table = new Table(this);
                table.SetColumnCount(3);
                table.SetPosition(450, 150);

                var row1 = table.AddRow();
                row1.SetCellText(0, "Row 1");
                row1.SetCellText(1, "R1 cell 1");
                row1.SetCellText(2, "Row 1 cell 2");

                table.AddRow().Text = "Row 2, slightly bigger";
                table[1].SetCellText(1, "Center cell");

                table.AddRow().Text = "Row 3, medium";
                table[2].SetCellText(2, "Last cell");

                table.SizeToContents(0);
            }

            /* Selecting Rows in Code */
            {
                Control.ListBox ctrl = new Control.ListBox(this);
                ctrl.SetPosition(10, 320);

                ListBoxRow Row = ctrl.AddRow("Row");
                ctrl.AddRow("Text");
                ctrl.AddRow("InternalName", "Name");
                ctrl.AddRow("UserData", "Internal", 12);

                ctrl.SizeToContents();

                Control.CheckBox Multiline = new Control.CheckBox(this);
                Multiline.SetPosition(10, 405);
                Multiline.CheckChanged +=
                    delegate(Base sender, EventArgs args) { ctrl.AllowMultiSelect = Multiline.IsChecked; };

                Control.Label lblml = new Control.Label(this);
                lblml.Text = "Enable MultiSelect";
                lblml.SetPosition(30, 405);

                //Select by Menu Item
                {
                    Control.Button TriangleButton = new Control.Button(this);
                    TriangleButton.SetPosition(100, 320);
                    TriangleButton.Text = "Row";
                    TriangleButton.Width = 100;
                    TriangleButton.Clicked += delegate(Base sender, ClickedEventArgs args) { ctrl.SelectedRow = Row; };
                }

                //Select by Text
                {
                    Control.Button TestBtn = new Control.Button(this);
                    TestBtn.SetPosition(100, 340);
                    TestBtn.Text = "Text";
                    TestBtn.Width = 100;
                    TestBtn.Clicked += delegate(Base sender, ClickedEventArgs args) { ctrl.SelectByText("Text"); };
                }

                //Select by Name
                {
                    Control.Button TestBtn = new Control.Button(this);
                    TestBtn.SetPosition(100, 360);
                    TestBtn.Text = "Name";
                    TestBtn.Width = 100;
                    TestBtn.Clicked += delegate(Base sender, ClickedEventArgs args) { ctrl.SelectByName("Name"); };
                }

                //Select by UserData
                {
                    Control.Button TestBtn = new Control.Button(this);
                    TestBtn.SetPosition(100, 380);
                    TestBtn.Text = "UserData";
                    TestBtn.Width = 100;
                    TestBtn.Clicked += delegate(Base sender, ClickedEventArgs args) { ctrl.SelectByUserData(12); };
                }
            }
        }
예제 #17
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;
        }
예제 #18
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);
        }
예제 #19
0
        public Label(Base parent) : base(parent)
        {
            {
                Control.Label label = new Control.Label(this);
                label.Text = "Standard label (not autosized)";
				label.AutoSizeToContents = false;
                label.SetBounds(10, 10, 100, 10);
            }
            {
                Control.Label label = new Control.Label(this);
                label.Text = "Chinese: \u4E45\u6709\u5F52\u5929\u613F \u7EC8\u8FC7\u9B3C\u95E8\u5173";
                label.SetPosition(10, 30);
            }
            {
                Control.Label label = new Control.Label(this);
                label.Text = "Japanese: \u751F\u3080\u304E\u3000\u751F\u3054\u3081\u3000\u751F\u305F\u307E\u3054";
                label.SetPosition(10, 50);
            }
            {
                Control.Label label = new Control.Label(this);
                label.Text = "Korean: \uADF9\uC9C0\uD0D0\uD5D8\u3000\uD611\uD68C\uACB0\uC131\u3000\uCCB4\uACC4\uC801\u3000\uC5F0\uAD6C";
                label.SetPosition(10, 70);
            }
            {
                Control.Label label = new Control.Label(this);
                label.Text = "Hindi: \u092F\u0947 \u0905\u0928\u0941\u091A\u094D\u091B\u0947\u0926 \u0939\u093F\u0928\u094D\u0926\u0940 \u092E\u0947\u0902 \u0939\u0948\u0964";
                label.SetPosition(10, 90);
            }
            {
                Control.Label label = new Control.Label(this);
                label.Text = "Arabic: \u0627\u0644\u0622\u0646 \u0644\u062D\u0636\u0648\u0631 \u0627\u0644\u0645\u0624\u062A\u0645\u0631 \u0627\u0644\u062F\u0648\u0644\u064A";
                label.SetPosition(10, 110);
            }
            {
                Control.Label label = new Control.Label(this);
                label.MouseInputEnabled = true; // needed for tooltip
                label.Text = "Wow, Coloured Text (and tooltip)";
                label.TextColor = Color.Blue;
                label.SetToolTipText("I'm a tooltip");
                font3 = new Font(Skin.Renderer, "Motorwerk", 20);
                ((Control.Label) label.ToolTip).Font = font3;
                label.SetPosition(10, 130);
            }
            {
                Control.Label label = new Control.Label(this);
                label.Text = "Coloured Text With Alpha";
                label.TextColor = Color.FromArgb(100, 0, 0, 255);
                label.SetPosition(10, 150);
            }
            {
                // Note that when using a custom font, this font object has to stick around
                // for the lifetime of the label. Rethink, or is that ideal?
                font1 = new Font(Skin.Renderer);
                font1.FaceName = "Comic Sans MS";
                font1.Size = 25;

                Control.Label label = new Control.Label(this);
                label.Text = "Custom Font (Comic Sans 25)";
                label.SetPosition(10, 170);
                label.Font = font1;
            }
            {
                font2 = new Font(Skin.Renderer, "French Script MT", 35);

                Control.Label label = new Control.Label(this);
                label.Font = font2;
                label.SetPosition(10, 210);
                label.Text = "Custom Font (French Script MT 35)";
            }

            // alignment test
            {
                Control.Label txt = new Control.Label(this);
                txt.SetPosition(10, 280);
                txt.Text = "Alignment test";

                Control.Label outer = new Control.Label(this);
                outer.SetBounds(10, 300, 190, 190);
                
                Control.Label l11 = new Control.Label(outer);
                l11.SetBounds(10, 10, 50, 50);
                l11.Text = "TL";
                l11.Alignment = Pos.Top | Pos.Left;

                Control.Label l12 = new Control.Label(outer);
                l12.SetBounds(70, 10, 50, 50);
                l12.Text = "T";
                l12.Alignment = Pos.Top|Pos.CenterH;

                Control.Label l13 = new Control.Label(outer);
                l13.SetBounds(130, 10, 50, 50);
                l13.Text = "TR";
                l13.Alignment = Pos.Top | Pos.Right;

                Control.Label l21 = new Control.Label(outer);
                l21.SetBounds(10, 70, 50, 50);
                l21.Text = "L";
                l21.Alignment = Pos.Left|Pos.CenterV;

                Control.Label l22 = new Control.Label(outer);
                l22.SetBounds(70, 70, 50, 50);
                l22.Text = "C";
                l22.Alignment = Pos.CenterH|Pos.CenterV;

                Control.Label l23 = new Control.Label(outer);
                l23.SetBounds(130, 70, 50, 50);
                l23.Text = "R";
                l23.Alignment = Pos.Right|Pos.CenterV;

                Control.Label l31 = new Control.Label(outer);
                l31.SetBounds(10, 130, 50, 50);
                l31.Text = "BL";
                l31.Alignment = Pos.Bottom | Pos.Left;

                Control.Label l32 = new Control.Label(outer);
                l32.SetBounds(70, 130, 50, 50);
                l32.Text = "B";
                l32.Alignment = Pos.Bottom | Pos.CenterH;

                Control.Label l33 = new Control.Label(outer);
                l33.SetBounds(130, 130, 50, 50);
                l33.Text = "BR";
                l33.Alignment = Pos.Bottom | Pos.Right;

                outer.DrawDebugOutlines = true;
            }
        }
예제 #20
0
        public string Note;        // additional text to display in status bar

        public UnitTest(ControlBase parent) : base(parent)
        {
            Dock = Dock.Fill;

            DockBase dock = new DockBase(this);

            dock.Dock = Dock.Fill;

            m_List = new Control.CollapsibleList(this);

            dock.LeftDock.TabControl.AddPage("Unit tests", m_List);
            dock.LeftDock.Width = 150;

            m_TextOutput = new Control.ListBox(this);
            m_TextOutput.AlternateColor = false;

            dock.BottomDock.TabControl.AddPage("Output", m_TextOutput);
            dock.BottomDock.Height = 200;

            m_StatusBar      = new Control.StatusBar(this);
            m_StatusBar.Dock = Dock.Bottom;

            m_DebugCheck               = new Control.LabeledCheckBox(m_StatusBar);
            m_DebugCheck.Text          = "Debug outlines";
            m_DebugCheck.CheckChanged += DebugCheckChanged;

            m_IncScale = new Control.Button(m_StatusBar);
            m_IncScale.HorizontalAlignment = HorizontalAlignment.Left;
            m_IncScale.VerticalAlignment   = VerticalAlignment.Stretch;
            m_IncScale.Width       = 30;
            m_IncScale.Margin      = new Margin(0, 0, 8, 0);
            m_IncScale.TextPadding = new Padding(5, 0, 5, 0);
            m_IncScale.Text        = "+";
            m_IncScale.Clicked    += (sender, arguments) => { m_UIScale.Value = Math.Min(m_UIScale.Value + 0.25f, 3.0f); };

            m_UIScale = new Control.TextBoxNumeric(m_StatusBar);
            m_UIScale.VerticalAlignment = VerticalAlignment.Stretch;
            m_UIScale.Width             = 70;
            m_UIScale.Value             = GetCanvas().Scale;
            m_UIScale.TextChanged      += (sender, arguments) => { GetCanvas().Scale = m_UIScale.Value; };

            m_DecScale = new Control.Button(m_StatusBar);
            m_DecScale.HorizontalAlignment = HorizontalAlignment.Left;
            m_DecScale.VerticalAlignment   = VerticalAlignment.Stretch;
            m_DecScale.Width       = 30;
            m_DecScale.Margin      = new Margin(4, 0, 0, 0);
            m_DecScale.TextPadding = new Padding(5, 0, 5, 0);
            m_DecScale.Text        = "-";
            m_DecScale.Clicked    += (sender, arguments) => { m_UIScale.Value = Math.Max(m_UIScale.Value - 0.25f, 1.0f); };

            m_UIScaleText = new Control.Label(m_StatusBar);
            m_UIScaleText.VerticalAlignment = VerticalAlignment.Stretch;
            m_UIScaleText.Alignment         = Alignment.Left | Alignment.CenterV;
            m_UIScaleText.Text = "Scale:";

            m_Center      = new Control.Layout.DockLayout(dock);
            m_Center.Dock = Dock.Fill;

            List <Type> tests = typeof(UnitTest).Assembly.GetTypes().Where(t => t.IsDefined(typeof(UnitTestAttribute), false)).ToList();

            tests.Sort((t1, t2) =>
            {
                object[] a1s = t1.GetCustomAttributes(typeof(UnitTestAttribute), false);
                object[] a2s = t2.GetCustomAttributes(typeof(UnitTestAttribute), false);
                if (a1s.Length > 0 && a2s.Length > 0)
                {
                    UnitTestAttribute a1 = a1s[0] as UnitTestAttribute;
                    UnitTestAttribute a2 = a2s[0] as UnitTestAttribute;
                    if (a1.Order == a2.Order)
                    {
                        if (a1.Category == a2.Category)
                        {
                            return(String.Compare(a1.Name != null ? a1.Name : t1.Name, a2.Name != null ? a2.Name : t2.Name, StringComparison.OrdinalIgnoreCase));
                        }
                        else
                        {
                            return(String.Compare(a1.Category, a2.Category, StringComparison.OrdinalIgnoreCase));
                        }
                    }
                    return(a1.Order - a2.Order);
                }

                return(0);
            });

            foreach (Type type in tests)
            {
                object[] attribs = type.GetCustomAttributes(typeof(UnitTestAttribute), false);
                if (attribs.Length > 0)
                {
                    UnitTestAttribute attrib = attribs[0] as UnitTestAttribute;
                    if (attrib != null)
                    {
                        CollapsibleCategory cat = m_List.FindChildByName(attrib.Category) as CollapsibleCategory;
                        if (cat == null)
                        {
                            cat = m_List.Add(attrib.Category, attrib.Category);
                        }
                        GUnit test = Activator.CreateInstance(type, m_Center) as GUnit;
                        RegisterUnitTest(attrib.Name != null ? attrib.Name : type.Name, cat, test);
                    }
                }
            }

            m_StatusBar.SendToBack();
            PrintText("Unit Test started!");
        }
예제 #21
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;
        }
예제 #22
0
        public Docking(ControlBase parent)
            : base(parent)
        {
            font       = Skin.DefaultFont.Copy();
            font.Size *= 2;

            Control.Label inner1, inner2, inner3, inner4, inner5;

            HorizontalLayout hlayout = new HorizontalLayout(this);
            {
                VerticalLayout vlayout = new VerticalLayout(hlayout);
                {
                    outer      = new Control.Layout.DockLayout(vlayout);
                    outer.Size = new Size(400, 400);
                    {
                        inner1           = new Control.Label(outer);
                        inner1.Alignment = Alignment.Center;
                        inner1.Text      = "1";
                        inner1.Font      = font;
                        inner1.Size      = new Size(100, Util.Ignore);
                        inner1.Dock      = Dock.Left;

                        inner2           = new Control.Label(outer);
                        inner2.Alignment = Alignment.Center;
                        inner2.Text      = "2";
                        inner2.Font      = font;
                        inner2.Size      = new Size(Util.Ignore, 100);
                        inner2.Dock      = Dock.Top;

                        inner3           = new Control.Label(outer);
                        inner3.Alignment = Alignment.Center;
                        inner3.Text      = "3";
                        inner3.Font      = font;
                        inner3.Size      = new Size(100, Util.Ignore);
                        inner3.Dock      = Dock.Right;

                        inner4           = new Control.Label(outer);
                        inner4.Alignment = Alignment.Center;
                        inner4.Text      = "4";
                        inner4.Font      = font;
                        inner4.Size      = new Size(Util.Ignore, 100);
                        inner4.Dock      = Dock.Bottom;

                        inner5           = new Control.Label(outer);
                        inner5.Alignment = Alignment.Center;
                        inner5.Text      = "5";
                        inner5.Font      = font;
                        inner5.Size      = new Size(Util.Ignore, Util.Ignore);
                        inner5.Dock      = Dock.Fill;
                    }

                    outer.DrawDebugOutlines = true;

                    HorizontalLayout hlayout2 = new HorizontalLayout(vlayout);
                    {
                        Control.Label l_padding = new Control.Label(hlayout2);
                        l_padding.Text = "Padding:";

                        Control.HorizontalSlider padding = new Control.HorizontalSlider(hlayout2);
                        padding.Min           = 0;
                        padding.Max           = 200;
                        padding.Value         = 10;
                        padding.Width         = 100;
                        padding.ValueChanged += PaddingChanged;
                    }
                }

                Control.Layout.GridLayout controlsLayout = new Control.Layout.GridLayout(hlayout);
                controlsLayout.ColumnCount = 2;
                {
                    inner1.UserData = CreateControls(inner1, Dock.Left, "Control 1", controlsLayout);
                    inner2.UserData = CreateControls(inner2, Dock.Top, "Control 2", controlsLayout);
                    inner3.UserData = CreateControls(inner3, Dock.Right, "Control 3", controlsLayout);
                    inner4.UserData = CreateControls(inner4, Dock.Bottom, "Control 4", controlsLayout);
                    inner5.UserData = CreateControls(inner5, Dock.Fill, "Control 5", controlsLayout);
                }
            }
            //DrawDebugOutlines = true;
        }
예제 #23
0
파일: Menu.cs 프로젝트: Sprunth/gwen-dotnet
        public Menu(Base parent)
            : base(parent)
        {
            /* Context Menu Strip */
            {
                Control.Label lblClickMe = new Control.Label(this);
                lblClickMe.Text = "Right Click Me";
                lblClickMe.SetPosition(10, 30);
                lblClickMe.RightClicked += delegate(Control.Base sender, ClickedEventArgs args)
                {
                    Control.Menu menu = new Control.Menu(this);
                    Point Local = this.CanvasPosToLocal(new Point(args.X, args.Y));
                    menu.SetPosition(Local.X, Local.Y);
                    menu.AddItem("Test");
                    menu.AddItem("Clickable").Clicked +=
                        delegate(Control.Base sender2, ClickedEventArgs args2)
                        {
                            UnitPrint("Clickable item was clicked");
                        };
                    menu.Show();
                };
            }

            /* Menu Strip */
            {
                Control.MenuStrip menu = new Control.MenuStrip(this);

                /* File */
                {
                    Control.MenuItem root = menu.AddItem("File");
                    root.Menu.AddItem("Load", "test16.png", "Ctrl+L").SetAction(MenuItemSelect);
                    root.Menu.AddItem("Save", String.Empty, "Ctrl+S").SetAction(MenuItemSelect);
                    root.Menu.AddItem("Save As..", String.Empty, "Ctrl+A").SetAction(MenuItemSelect);
                    root.Menu.AddItem("Quit", String.Empty, "Ctrl+Q").SetAction(MenuItemSelect);
                }

                /* Russian */
                {
                    Control.MenuItem pRoot = menu.AddItem("\u043F\u0438\u0440\u0430\u0442\u0441\u0442\u0432\u043E");
                    pRoot.Menu.AddItem("\u5355\u5143\u6D4B\u8BD5").SetAction(MenuItemSelect);
                    pRoot.Menu.AddItem("\u0111\u01A1n v\u1ECB th\u1EED nghi\u1EC7m", "test16.png")
                        .SetAction(MenuItemSelect);
                }

                /* Embdedded Menu Items */
                {
                    Control.MenuItem pRoot = menu.AddItem("Submenu");

                    Control.MenuItem pCheckable = pRoot.Menu.AddItem("Checkable");
                    pCheckable.IsCheckable = true;
                    pCheckable.IsCheckable = true;

                    {
                        Control.MenuItem pRootB = pRoot.Menu.AddItem("Two");
                        pRootB.Menu.AddItem("Two.One");
                        pRootB.Menu.AddItem("Two.Two");
                        pRootB.Menu.AddItem("Two.Three");
                        pRootB.Menu.AddItem("Two.Four");
                        pRootB.Menu.AddItem("Two.Five");
                        pRootB.Menu.AddItem("Two.Six");
                        pRootB.Menu.AddItem("Two.Seven");
                        pRootB.Menu.AddItem("Two.Eight");
                        pRootB.Menu.AddItem("Two.Nine", "test16.png");
                    }

                    pRoot.Menu.AddItem("Three");
                    pRoot.Menu.AddItem("Four");
                    pRoot.Menu.AddItem("Five");

                    {
                        Control.MenuItem pRootB = pRoot.Menu.AddItem("Six");
                        pRootB.Menu.AddItem("Six.One");
                        pRootB.Menu.AddItem("Six.Two");
                        pRootB.Menu.AddItem("Six.Three");
                        pRootB.Menu.AddItem("Six.Four");
                        pRootB.Menu.AddItem("Six.Five", "test16.png");

                        {
                            Control.MenuItem pRootC = pRootB.Menu.AddItem("Six.Six");
                            pRootC.Menu.AddItem("Sheep");
                            pRootC.Menu.AddItem("Goose");
                            {
                                Control.MenuItem pRootD = pRootC.Menu.AddItem("Camel");
                                pRootD.Menu.AddItem("Eyes");
                                pRootD.Menu.AddItem("Nose");
                                {
                                    Control.MenuItem pRootE = pRootD.Menu.AddItem("Hair");
                                    pRootE.Menu.AddItem("Blonde");
                                    pRootE.Menu.AddItem("Black");
                                    {
                                        Control.MenuItem pRootF = pRootE.Menu.AddItem("Red");
                                        pRootF.Menu.AddItem("Light");
                                        pRootF.Menu.AddItem("Medium");
                                        pRootF.Menu.AddItem("Dark");
                                    }
                                    pRootE.Menu.AddItem("Brown");
                                }
                                pRootD.Menu.AddItem("Ears");
                            }
                            pRootC.Menu.AddItem("Duck");
                        }

                        pRootB.Menu.AddItem("Six.Seven");
                        pRootB.Menu.AddItem("Six.Eight");
                        pRootB.Menu.AddItem("Six.Nine");
                    }

                    pRoot.Menu.AddItem("Seven");
                }
            }
        }
        public Menu(Base parent) : base(parent)
        {
            /* Context Menu Strip */
            {
                Control.Label lblClickMe = new Control.Label(this)
                {
                    Text = "Right Click Me"
                };
                lblClickMe.SetPosition(10, 30);
                lblClickMe.RightClicked += delegate(Control.Base sender, ClickedEventArgs args)
                {
                    Control.Menu menu  = new Control.Menu(this);
                    Point        Local = CanvasPosToLocal(new Point(args.X, args.Y));
                    menu.SetPosition(Local.X, Local.Y);
                    menu.AddItem("Test");
                    menu.AddItem("Clickable").Clicked += delegate(Control.Base sender2, ClickedEventArgs args2)
                    {
                        UnitPrint("Clickable item was clicked");
                    };
                    menu.Show();
                };
            }

            /* Menu Strip */
            {
                Control.MenuStrip menu = new Control.MenuStrip(this);

                /* File */
                {
                    Control.MenuItem root = menu.AddItem("File");
                    root.Menu.AddItem("Load", "test16.png", "Ctrl+L").SetAction(MenuItemSelect);
                    root.Menu.AddItem("Save", String.Empty, "Ctrl+S").SetAction(MenuItemSelect);
                    root.Menu.AddItem("Save As..", String.Empty, "Ctrl+A").SetAction(MenuItemSelect);
                    root.Menu.AddItem("Quit", String.Empty, "Ctrl+Q").SetAction(MenuItemSelect);
                }

                /* Russian */
                {
                    Control.MenuItem pRoot = menu.AddItem("\u043F\u0438\u0440\u0430\u0442\u0441\u0442\u0432\u043E");
                    pRoot.Menu.AddItem("\u5355\u5143\u6D4B\u8BD5").SetAction(MenuItemSelect);
                    pRoot.Menu.AddItem("\u0111\u01A1n v\u1ECB th\u1EED nghi\u1EC7m", "test16.png").SetAction(MenuItemSelect);
                }

                /* Embdedded Menu Items */
                {
                    Control.MenuItem pRoot = menu.AddItem("Submenu");

                    Control.MenuItem pCheckable = pRoot.Menu.AddItem("Checkable");
                    pCheckable.IsCheckable = true;
                    pCheckable.IsCheckable = true;

                    {
                        Control.MenuItem pRootB = pRoot.Menu.AddItem("Two");
                        pRootB.Menu.AddItem("Two.One");
                        pRootB.Menu.AddItem("Two.Two");
                        pRootB.Menu.AddItem("Two.Three");
                        pRootB.Menu.AddItem("Two.Four");
                        pRootB.Menu.AddItem("Two.Five");
                        pRootB.Menu.AddItem("Two.Six");
                        pRootB.Menu.AddItem("Two.Seven");
                        pRootB.Menu.AddItem("Two.Eight");
                        pRootB.Menu.AddItem("Two.Nine", "test16.png");
                    }

                    pRoot.Menu.AddItem("Three");
                    pRoot.Menu.AddItem("Four");
                    pRoot.Menu.AddItem("Five");

                    {
                        Control.MenuItem pRootB = pRoot.Menu.AddItem("Six");
                        pRootB.Menu.AddItem("Six.One");
                        pRootB.Menu.AddItem("Six.Two");
                        pRootB.Menu.AddItem("Six.Three");
                        pRootB.Menu.AddItem("Six.Four");
                        pRootB.Menu.AddItem("Six.Five", "test16.png");

                        {
                            Control.MenuItem pRootC = pRootB.Menu.AddItem("Six.Six");
                            pRootC.Menu.AddItem("Sheep");
                            pRootC.Menu.AddItem("Goose");
                            {
                                Control.MenuItem pRootD = pRootC.Menu.AddItem("Camel");
                                pRootD.Menu.AddItem("Eyes");
                                pRootD.Menu.AddItem("Nose");
                                {
                                    Control.MenuItem pRootE = pRootD.Menu.AddItem("Hair");
                                    pRootE.Menu.AddItem("Blonde");
                                    pRootE.Menu.AddItem("Black");
                                    {
                                        Control.MenuItem pRootF = pRootE.Menu.AddItem("Red");
                                        pRootF.Menu.AddItem("Light");
                                        pRootF.Menu.AddItem("Medium");
                                        pRootF.Menu.AddItem("Dark");
                                    }
                                    pRootE.Menu.AddItem("Brown");
                                }
                                pRootD.Menu.AddItem("Ears");
                            }
                            pRootC.Menu.AddItem("Duck");
                        }

                        pRootB.Menu.AddItem("Six.Seven");
                        pRootB.Menu.AddItem("Six.Eight");
                        pRootB.Menu.AddItem("Six.Nine");
                    }

                    pRoot.Menu.AddItem("Seven");
                }
            }
        }