public ColorPickers(Base parent) : base(parent) { /* RGB Picker */ { ColorPicker rgbPicker = new ColorPicker(this); rgbPicker.SetPosition(10, 10); rgbPicker.ColorChanged += ColorChanged; } /* HSVColorPicker */ { HSVColorPicker hsvPicker = new HSVColorPicker(this); hsvPicker.SetPosition(300, 10); hsvPicker.ColorChanged += ColorChanged; } /* HSVColorPicker in Window */ { Control.WindowControl Window = new WindowControl(this); Window.SetSize(300, 300); Window.Hide(); HSVColorPicker hsvPicker = new HSVColorPicker(Window); hsvPicker.SetPosition(10, 10); hsvPicker.ColorChanged += ColorChanged; Control.Button OpenWindow = new Control.Button(this); OpenWindow.SetPosition(10, 200); OpenWindow.SetSize(200, 20); OpenWindow.Text = "Open Window"; OpenWindow.Clicked += delegate(Base sender, ClickedEventArgs args) { Window.Show(); }; } }
void OpenWindow(ControlBase control, EventArgs args) { Control.WindowControl window = new Control.WindowControl(GetCanvas()); window.Title = String.Format("Window {0}", m_WindowCount); window.SetSize(rand.Next(200, 400), rand.Next(200, 400)); window.SetPosition(rand.Next(700), rand.Next(400)); Control.Button b1 = new Control.Button(window); b1.Text = "Test"; var size = window.DrawAreaSize; b1.SetPosition(size.X - b1.Width, size.Y - b1.Height); window.Resized += (s, e) => { var size2 = window.DrawAreaSize; b1.SetPosition(size2.X - b1.Width, size2.Y - b1.Height); }; m_WindowCount++; }
public Button(Base parent) : base(parent) { buttonA = new Control.Button(this); buttonA.Text = "Event tester"; buttonA.SetBounds(200, 30, 300, 200); buttonA.Pressed += onButtonAp; buttonA.Clicked += onButtonAc; buttonA.Released += onButtonAr; buttonB = new Control.Button(this); buttonB.Text = "\u0417\u0430\u043C\u0435\u0436\u043D\u0430\u044F \u043C\u043E\u0432\u0430"; buttonB.SetPosition(0, 20); buttonC = new Control.Button(this); buttonC.Text = "Image button"; buttonC.SetImage("test16.png"); Align.PlaceDownLeft(buttonC, buttonB, 10); buttonD = new Control.Button(this); buttonD.SetImage("test16.png"); buttonD.SetSize(20, 20); Align.PlaceDownLeft(buttonD, buttonC, 10); buttonE = new Control.Button(this); buttonE.Text = "Toggle me"; buttonE.IsToggle = true; buttonE.Toggled += onToggle; buttonE.ToggledOn += onToggleOn; buttonE.ToggledOff += onToggleOff; Align.PlaceDownLeft(buttonE, buttonD, 10); buttonF = new Control.Button(this); buttonF.Text = "Disabled :D"; buttonF.IsDisabled = true; Align.PlaceDownLeft(buttonF, buttonE, 10); buttonG = new Control.Button(this); buttonG.Text = "With Tooltip"; buttonG.SetToolTipText("This is tooltip"); Align.PlaceDownLeft(buttonG, buttonF, 10); buttonH = new Control.Button(this); buttonH.Text = "I'm autosized"; buttonH.SizeToContents(); Align.PlaceDownLeft(buttonH, buttonG, 10); }
public Button(ControlBase parent) : base(parent) { buttonA = new Control.Button(this); buttonA.Text = "Event tester"; buttonA.SetBounds(200, 30, 300, 200); buttonA.Pressed += onButtonAp; buttonA.Clicked += onButtonAc; buttonA.Released += onButtonAr; buttonB = new Control.Button(this); buttonB.Text = "\u0417\u0430\u043C\u0435\u0436\u043D\u0430\u044F \u043C\u043E\u0432\u0430"; buttonB.SetPosition(0, 20); buttonC = new Control.Button(this); buttonC.Text = "Image button"; buttonC.SetImage("test16.png"); Align.PlaceDownLeft(buttonC, buttonB, 10); buttonD = new Control.Button(this); buttonD.SetImage("test16.png"); buttonD.SetSize(20, 20); Align.PlaceDownLeft(buttonD, buttonC, 10); buttonE = new Control.Button(this); buttonE.Text = "Toggle me"; buttonE.IsToggle = true; buttonE.Toggled += onToggle; buttonE.ToggledOn += onToggleOn; buttonE.ToggledOff += onToggleOff; Align.PlaceDownLeft(buttonE, buttonD, 10); buttonF = new Control.Button(this); buttonF.Text = "Disabled :D"; buttonF.IsDisabled = true; Align.PlaceDownLeft(buttonF, buttonE, 10); buttonG = new Control.Button(this); buttonG.Text = "With Tooltip"; buttonG.SetToolTipText("This is tooltip"); Align.PlaceDownLeft(buttonG, buttonF, 10); buttonH = new Control.Button(this); buttonH.Text = "I'm autosized"; buttonH.SizeToContents(); Align.PlaceDownLeft(buttonH, buttonG, 10); }
public ComboBox(Base parent) : base(parent) { { Control.ComboBox combo = new Control.ComboBox(this); combo.SetPosition(50, 50); combo.Width = 200; combo.AddItem("Option One", "one"); combo.AddItem("Number Two", "two"); combo.AddItem("Door Three", "three"); combo.AddItem("Four Legs", "four"); combo.AddItem("Five Birds", "five"); combo.ItemSelected += OnComboSelect; } { // Empty Control.ComboBox combo = new Control.ComboBox(this); combo.SetPosition(50, 80); combo.Width = 200; } { // Lots of things Control.ComboBox combo = new Control.ComboBox(this); combo.SetPosition(50, 110); combo.Width = 200; for (int i = 0; i < 500; i++) combo.AddItem(String.Format("Option {0}", i)); combo.ItemSelected += OnComboSelect; } { // In-Code Item Change Control.ComboBox combo = new Control.ComboBox(this); combo.SetPosition(50, 140); combo.Width = 200; MenuItem Triangle = combo.AddItem("Triangle"); combo.AddItem("Red", "color"); combo.AddItem("Apple", "fruit"); combo.AddItem("Blue", "color"); combo.AddItem("Green", "color", 12); combo.ItemSelected += OnComboSelect; //Select by Menu Item { Control.Button TriangleButton = new Control.Button(this); TriangleButton.SetPosition(255, 140); TriangleButton.Text = "Triangle"; TriangleButton.Width = 100; TriangleButton.Clicked += delegate(Base sender, ClickedEventArgs args) { combo.SelectedItem = Triangle; }; } //Select by Text { Control.Button TestBtn = new Control.Button(this); TestBtn.SetPosition(360, 140); TestBtn.Text = "Red"; TestBtn.Width = 100; TestBtn.Clicked += delegate(Base sender, ClickedEventArgs args) { combo.SelectByText("Red"); }; } //Select by Name { Control.Button TestBtn = new Control.Button(this); TestBtn.SetPosition(465, 140); TestBtn.Text = "Apple"; TestBtn.Width = 100; TestBtn.Clicked += delegate(Base sender, ClickedEventArgs args) { combo.SelectByName("fruit"); }; } //Select by UserData { Control.Button TestBtn = new Control.Button(this); TestBtn.SetPosition(570, 140); TestBtn.Text = "Green"; TestBtn.Width = 100; TestBtn.Clicked += delegate(Base sender, ClickedEventArgs args) { combo.SelectByUserData(12); }; } } }
public ComboBox(ControlBase parent) : base(parent) { { Control.ComboBox combo = new Control.ComboBox(this); combo.SetPosition(50, 50); combo.Width = 200; combo.AddItem("Option One", "one"); combo.AddItem("Number Two", "two"); combo.AddItem("Door Three", "three"); combo.AddItem("Four Legs", "four"); combo.AddItem("Five Birds", "five"); combo.ItemSelected += OnComboSelect; } { // Empty Control.ComboBox combo = new Control.ComboBox(this); combo.SetPosition(50, 80); combo.Width = 200; } { // Lots of things Control.ComboBox combo = new Control.ComboBox(this); combo.SetPosition(50, 110); combo.Width = 200; for (int i = 0; i < 500; i++) { combo.AddItem(String.Format("Option {0}", i)); } combo.ItemSelected += OnComboSelect; } { // In-Code Item Change Control.ComboBox combo = new Control.ComboBox(this); combo.SetPosition(50, 140); combo.Width = 200; MenuItem Triangle = combo.AddItem("Triangle"); combo.AddItem("Red", "color"); combo.AddItem("Apple", "fruit"); combo.AddItem("Blue", "color"); combo.AddItem("Green", "color", 12); combo.ItemSelected += OnComboSelect; //Select by Menu Item { Control.Button TriangleButton = new Control.Button(this); TriangleButton.SetPosition(255, 140); TriangleButton.Text = "Triangle"; TriangleButton.Width = 100; TriangleButton.Clicked += delegate(ControlBase sender, ClickedEventArgs args) { combo.SelectedItem = Triangle; }; } //Select by Text { Control.Button TestBtn = new Control.Button(this); TestBtn.SetPosition(360, 140); TestBtn.Text = "Red"; TestBtn.Width = 100; TestBtn.Clicked += delegate(ControlBase sender, ClickedEventArgs args) { combo.SelectByText("Red"); }; } //Select by Name { Control.Button TestBtn = new Control.Button(this); TestBtn.SetPosition(465, 140); TestBtn.Text = "Apple"; TestBtn.Width = 100; TestBtn.Clicked += delegate(ControlBase sender, ClickedEventArgs args) { combo.SelectByName("fruit"); }; } //Select by UserData { Control.Button TestBtn = new Control.Button(this); TestBtn.SetPosition(570, 140); TestBtn.Text = "Green"; TestBtn.Width = 100; TestBtn.Clicked += delegate(ControlBase sender, ClickedEventArgs args) { combo.SelectByUserData(12); }; } } }
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); }; } } }
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); }; } } }