void OpenToolWindow(ControlBase control, EventArgs args) { Control.ToolWindow window = new Control.ToolWindow(this); window.Padding = Padding.Five; window.HorizontalAlignment = HorizontalAlignment.Left; window.VerticalAlignment = VerticalAlignment.Top; window.StartPosition = StartPosition.CenterParent; window.Vertical = true; Control.Layout.GridLayout layout = new Control.Layout.GridLayout(window); layout.ColumnCount = 2; Control.Button button = new Control.Button(layout); button.Size = new Size(100, 40); button.UserData = window; button.Clicked += Close; button = new Control.Button(layout); button.Size = new Size(100, 40); button.UserData = window; button.Clicked += Close; button = new Control.Button(layout); button.Size = new Size(100, 40); button.UserData = window; button.Clicked += Close; button = new Control.Button(layout); button.Size = new Size(100, 40); button.UserData = window; button.Clicked += Close; }
private Control.Layout.GridLayout CreateGrid(ControlBase parent) { Control.Layout.GridLayout grid = new Control.Layout.GridLayout(parent); grid.SetColumnWidths(0.2f, Control.Layout.GridLayout.AutoSize, 140.0f, 0.8f); grid.SetRowHeights(0.2f, Control.Layout.GridLayout.AutoSize, 140.0f, 0.8f); CreateControl(grid, "C: 20%, R: 20%"); CreateControl(grid, "C: Auto R: 20%"); CreateControl(grid, "C: 140, R: 20%"); CreateControl(grid, "C: 80%, R: 20%"); CreateControl(grid, "C: 20%, R: Auto"); CreateControl(grid, "C: Auto R: Auto"); CreateControl(grid, "C: 140, R: Auto"); CreateControl(grid, "C: 80%, R: Auto"); CreateControl(grid, "C: 20%, R: 140"); CreateControl(grid, "C: Auto R: 140"); CreateControl(grid, "C: 140, R: 140"); CreateControl(grid, "C: 80%, R: 140"); CreateControl(grid, "C: 20%, R: 80%"); CreateControl(grid, "C: Auto R: 80%"); CreateControl(grid, "C: 140, R: 80%"); CreateControl(grid, "C: 80%, R: 80%"); return(grid); }
public XsdWriting(ControlBase parent) : base(parent) { Control.Layout.GridLayout layout = new Control.Layout.GridLayout(this); layout.VerticalAlignment = VerticalAlignment.Top; layout.VerticalAlignment = VerticalAlignment.Stretch; layout.SetColumnWidths(Control.Layout.GridLayout.Fill); layout.SetRowHeights(30.0f, Control.Layout.GridLayout.Fill); Control.Button button1 = new Control.Button(layout); button1.Text = "Write Xsd File "; button1.Clicked += WriteXsd; button1.Width = 100; button1.HorizontalAlignment = HorizontalAlignment.Left; xsdContent = new Control.MultilineTextBox(layout); }
public ScrollControl(ControlBase parent) : base(parent) { Control.Layout.GridLayout layout = new Control.Layout.GridLayout(this); layout.ColumnCount = 6; Control.Button pTestButton; { Control.ScrollControl ctrl = new Control.ScrollControl(layout); ctrl.Margin = Margin.Three; ctrl.Size = new Size(100, 100); pTestButton = new Control.Button(ctrl); pTestButton.Text = "Twice As Big"; pTestButton.Size = new Size(200, 200); } { Control.ScrollControl ctrl = new Control.ScrollControl(layout); ctrl.Margin = Margin.Three; ctrl.Size = new Size(100, 100); pTestButton = new Control.Button(ctrl); pTestButton.Text = "Same Size"; pTestButton.Size = new Size(100, 100); } { Control.ScrollControl ctrl = new Control.ScrollControl(layout); ctrl.Margin = Margin.Three; ctrl.Size = new Size(100, 100); pTestButton = new Control.Button(ctrl); pTestButton.Text = "Wide"; pTestButton.Size = new Size(200, 50); } { Control.ScrollControl ctrl = new Control.ScrollControl(layout); ctrl.Margin = Margin.Three; ctrl.Size = new Size(100, 100); pTestButton = new Control.Button(ctrl); pTestButton.Text = "Tall"; pTestButton.Size = new Size(50, 200); } { Control.ScrollControl ctrl = new Control.ScrollControl(layout); ctrl.Margin = Margin.Three; ctrl.Size = new Size(100, 100); ctrl.EnableScroll(false, true); pTestButton = new Control.Button(ctrl); pTestButton.Text = "Vertical"; pTestButton.Size = new Size(200, 200); } { Control.ScrollControl ctrl = new Control.ScrollControl(layout); ctrl.Margin = Margin.Three; ctrl.Size = new Size(100, 100); ctrl.EnableScroll(true, false); pTestButton = new Control.Button(ctrl); pTestButton.Text = "Horizontal"; pTestButton.Size = new Size(200, 200); } // Bottom Row { Control.ScrollControl ctrl = new Control.ScrollControl(layout); ctrl.Margin = Margin.Three; ctrl.Size = new Size(100, 100); ctrl.AutoHideBars = true; pTestButton = new Control.Button(ctrl); pTestButton.Text = "Twice As Big"; pTestButton.Size = new Size(200, 200); } { Control.ScrollControl ctrl = new Control.ScrollControl(layout); ctrl.Margin = Margin.Three; ctrl.Size = new Size(100, 100); ctrl.AutoHideBars = true; pTestButton = new Control.Button(ctrl); pTestButton.Text = "Same Size"; pTestButton.Size = new Size(100, 100); } { Control.ScrollControl ctrl = new Control.ScrollControl(layout); ctrl.Margin = Margin.Three; ctrl.Size = new Size(100, 100); ctrl.AutoHideBars = true; pTestButton = new Control.Button(ctrl); pTestButton.Text = "Wide"; pTestButton.Size = new Size(200, 50); } { Control.ScrollControl ctrl = new Control.ScrollControl(layout); ctrl.Margin = Margin.Three; ctrl.Size = new Size(100, 100); ctrl.AutoHideBars = true; pTestButton = new Control.Button(ctrl); pTestButton.Text = "Tall"; pTestButton.Size = new Size(50, 200); } { Control.ScrollControl ctrl = new Control.ScrollControl(layout); ctrl.Margin = Margin.Three; ctrl.Size = new Size(100, 100); ctrl.AutoHideBars = true; ctrl.EnableScroll(false, true); pTestButton = new Control.Button(ctrl); pTestButton.Text = "Vertical"; pTestButton.Size = new Size(200, 200); } { Control.ScrollControl ctrl = new Control.ScrollControl(layout); ctrl.Margin = Margin.Three; ctrl.Size = new Size(100, 100); ctrl.AutoHideBars = true; ctrl.EnableScroll(true, false); pTestButton = new Control.Button(ctrl); pTestButton.Text = "Horinzontal"; pTestButton.Size = new Size(200, 200); } }
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; } }
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; } }
public Label(ControlBase parent) : base(parent) { VerticalLayout layout = new VerticalLayout(this); { Control.Label label = new Control.Label(layout); label.Text = "Standard label (not autosized)"; } { Control.Label label = new Control.Label(layout); label.Text = "Chinese: \u4E45\u6709\u5F52\u5929\u613F \u7EC8\u8FC7\u9B3C\u95E8\u5173"; } { Control.Label label = new Control.Label(layout); label.Text = "Japanese: \u751F\u3080\u304E\u3000\u751F\u3054\u3081\u3000\u751F\u305F\u307E\u3054"; } { Control.Label label = new Control.Label(layout); label.Text = "Korean: \uADF9\uC9C0\uD0D0\uD5D8\u3000\uD611\uD68C\uACB0\uC131\u3000\uCCB4\uACC4\uC801\u3000\uC5F0\uAD6C"; } { Control.Label label = new Control.Label(layout); 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"; } { Control.Label label = new Control.Label(layout); 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"; } { Control.Label label = new Control.Label(layout); 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; } { Control.Label label = new Control.Label(layout); label.Text = "Coloured Text With Alpha"; label.TextColor = new Color(100, 0, 0, 255); } { // 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(layout); label.Text = "Custom Font (Comic Sans 25)"; label.Font = font1; } { font2 = new Font(Skin.Renderer, "French Script MT", 35); Control.Label label = new Control.Label(layout); label.Font = font2; label.Text = "Custom Font (French Script MT 35)"; } // alignment test { Control.Label txt = new Control.Label(layout); txt.Text = "Alignment test"; Control.Layout.GridLayout outer = new Control.Layout.GridLayout(layout); outer.ColumnCount = 3; Control.Label l11 = new Control.Label(outer); l11.Size = new Size(50, 50); l11.Text = "TL"; l11.Alignment = Alignment.Top | Alignment.Left; Control.Label l12 = new Control.Label(outer); l12.Size = new Size(50, 50); l12.Text = "T"; l12.Alignment = Alignment.Top | Alignment.CenterH; Control.Label l13 = new Control.Label(outer); l13.Size = new Size(50, 50); l13.Text = "TR"; l13.Alignment = Alignment.Top | Alignment.Right; Control.Label l21 = new Control.Label(outer); l21.Size = new Size(50, 50); l21.Text = "L"; l21.Alignment = Alignment.Left | Alignment.CenterV; Control.Label l22 = new Control.Label(outer); l22.Size = new Size(50, 50); l22.Text = "C"; l22.Alignment = Alignment.CenterH | Alignment.CenterV; Control.Label l23 = new Control.Label(outer); l23.Size = new Size(50, 50); l23.Text = "R"; l23.Alignment = Alignment.Right | Alignment.CenterV; Control.Label l31 = new Control.Label(outer); l31.Size = new Size(50, 50); l31.Text = "BL"; l31.Alignment = Alignment.Bottom | Alignment.Left; Control.Label l32 = new Control.Label(outer); l32.Size = new Size(50, 50); l32.Text = "B"; l32.Alignment = Alignment.Bottom | Alignment.CenterH; Control.Label l33 = new Control.Label(outer); l33.Size = new Size(50, 50); l33.Text = "BR"; l33.Alignment = Alignment.Bottom | Alignment.Right; outer.DrawDebugOutlines = true; } }
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); }
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; }
public GridLayout(ControlBase parent) : base(parent) { Control.Layout.GridLayout grid = CreateGrid(this); grid.Dock = Dock.Fill; }