public ScrollableSection() { var layout = new TableLayout(4, 2); layout.SetColumnScale(1); layout.SetColumnScale(3); layout.SetRowScale(0); layout.SetRowScale(1); layout.Add(new Label { Text = "Default" }, 0, 0); layout.Add(DefaultScrollable(), 1, 0); layout.Add(new Label { Text = "No Border" }, 2, 0); layout.Add(NoBorderScrollable(), 3, 0); layout.Add(new Label { Text = "Bezeled" }, 0, 1); layout.Add(BezelScrollable(), 1, 1); layout.Add(new Label { Text = "Line" }, 2, 1); layout.Add(LineScrollable(), 3, 1); Content = layout; }
void InitializeComponent() { Resizable = true; var tblGroups = new TableLayout(1, 2); tblGroups.Add(new GroupBox { Text = "Upper", Content = new Button { Text = "Upper Button" } }, 0, 0); tblGroups.Add(new GroupBox { Text = "Lower", Content = new Button { Text = "Lower Button" } }, 0, 1); tblGroups.SetRowScale(0, true); tblGroups.SetRowScale(1, true); if (_tabs) { Content = new TabControl { Pages = { new TabPage { Text = "TabPage", Content = tblGroups } } }; } else { Content = tblGroups; } if (_posNegButtons) { PositiveButtons.Add(new Button { Text = "OK" }); NegativeButtons.Add(new Button { Text = "Cancel" }); } }
Control ChangeSizes() { var layout = new TableLayout(2, 7); layout.SetRowScale(0); layout.SetRowScale(6); for (int i = 1; i <= 10; i++) { var x = (i - 1) / 5; var y = (i - 1) % 5; layout.Add(ChangeSize(i), x, y + 1); } return(layout); }
Control NoPadding() { var layout = new TableLayout(3, 3) { BackgroundColor = Colors.Blue }; layout.Padding = Padding.Empty; layout.Spacing = new Size(20, 20); // scale first and last column layout.SetColumnScale(0); layout.SetColumnScale(2); // scale first and last row layout.SetRowScale(0); layout.SetRowScale(2); FillTable(layout); return(new Panel { Content = layout, BackgroundColor = Colors.Blue }); }
Control NoSpacing() { var layout = new TableLayout(3, 3) { BackgroundColor = Colors.Blue }; layout.Padding = new Padding(10); layout.Spacing = Size.Empty; layout.SetColumnScale(1); // scale middle column layout.SetRowScale(1); // scale middle row FillTable(layout); return(layout); }
private TableLayout ConstructBindingLayout(int columns, int rows) { var layout = new TableLayout(columns, rows) { Padding = new Padding(5), Spacing = new Size(5, 5) }; for (int i = 0; i < columns; i++) { layout.SetColumnScale(i, true); } for (int i = 0; i < rows; i++) { layout.SetRowScale(i, false); } return(layout); }
public ServerDialog() { this.Title = "Server Options"; //this.MinimumSize = new Size(300, 10); var layout = new TableLayout(1, 3) { Spacing = new Size(4, 4), Padding = 6 }; int row = 0; layout.Add(EntryControls(), 0, row++); layout.Add(ServerControls(), 0, row++); layout.SetRowScale(1); layout.Add(Buttons(), 0, row++); Content = layout; }
public ScalingSection() { TableLayout tableLayout; var layout = new DynamicLayout(); var size = new Size(-1, 100); tableLayout = new TableLayout(1, 1) { BackgroundColor = Colors.Blue, Size = size }; tableLayout.Add(new Label { Text = "1x1, should scale to fill entire region with 5px padding around border", BackgroundColor = Colors.Red }, 0, 0, false, false); layout.Add(tableLayout, yscale: true); tableLayout = new TableLayout(2, 2) { BackgroundColor = Colors.Blue, Size = size }; tableLayout.Add(new Label { Text = "2x2, should scale with extra space on top & left", BackgroundColor = Colors.Red }, 1, 1, false, false); layout.Add(tableLayout, yscale: true); tableLayout = new TableLayout(2, 2) { BackgroundColor = Colors.Blue, Size = size }; tableLayout.Add(new Label { Text = "2x2, should scale with extra space on bottom & right", BackgroundColor = Colors.Red }, 0, 0, true, true); layout.Add(tableLayout, yscale: true); tableLayout = new TableLayout(3, 3) { BackgroundColor = Colors.Blue, Size = size }; tableLayout.Add(new Label { Text = "3x3, should scale with extra space all around (10px)", BackgroundColor = Colors.Red }, 1, 1, true, true); layout.Add(tableLayout, yscale: true); tableLayout = new TableLayout(2, 2) { BackgroundColor = Colors.Blue, Size = size }; tableLayout.Add(new Label { Text = "2x2, should not scale and be top left", BackgroundColor = Colors.Red }, 0, 0, false, false); layout.Add(tableLayout, yscale: true); tableLayout = new TableLayout(2, 2) { BackgroundColor = Colors.Blue, Size = size }; tableLayout.SetColumnScale(0); tableLayout.SetRowScale(0); tableLayout.Add(new Label { Text = "2x2, should not scale and be bottom-right", BackgroundColor = Colors.Red }, 1, 1); layout.Add(tableLayout, yscale: true); tableLayout = new TableLayout(3, 3) { BackgroundColor = Colors.Blue, Size = size }; tableLayout.SetColumnScale(0); tableLayout.SetRowScale(0); tableLayout.Add(new Label { Text = "3x3, should not scale and be bottom-right", BackgroundColor = Colors.Red }, 1, 1); layout.Add(tableLayout, yscale: true); tableLayout = new TableLayout(3, 3) { BackgroundColor = Colors.Blue, Size = size }; tableLayout.SetColumnScale(0); tableLayout.SetColumnScale(2); tableLayout.SetRowScale(0); tableLayout.SetRowScale(2); tableLayout.Add(new Label { Text = "2x2, should not scale and be centered", BackgroundColor = Colors.Red }, 1, 1); layout.Add(tableLayout, yscale: true); Content = layout; }
private TabPage BuildDefinitionsTab() { var lbxFgd = new ListBox() { AllowDrop = true, ID = LbxFgdName }; var btnAddFgd = new Button { Text = "Add...", Command = CmdAddFgd }; var btnRemoveFgd = new Button { Text = "Remove", Command = CmdRemoveFgd }; var btnFgdCombineStack = new RadioButton { Text = "Stack", Checked = true, ID = BtnFgdCombineStackName }; var btnFgdCombineBlend = new RadioButton(btnFgdCombineStack) { Text = "Blend", ID = BtnFgdCombineBlendName }; var layoutFgdAddRemove = new TableLayout(2, 1) { Spacing = new Size(MasterPadding, 0) }; layoutFgdAddRemove.Add(btnAddFgd, 0, 0); layoutFgdAddRemove.Add(btnRemoveFgd, 1, 0); var tblFgdCombine = new TableLayout(2, 1) { Spacing = new Size(MasterPadding, 0) }; tblFgdCombine.Add(btnFgdCombineStack, 0, 0); tblFgdCombine.Add(btnFgdCombineBlend, 1, 0); var stkFgd = new StackLayout { Spacing = MasterPadding, HorizontalContentAlignment = HorizontalAlignment.Center, Items = { layoutFgdAddRemove, tblFgdCombine } }; var tblFgd = new TableLayout(1, 2) { Spacing = new Size(0, MasterPadding) }; tblFgd.Add(lbxFgd, 0, 0); tblFgd.Add(stkFgd, 0, 1); tblFgd.SetRowScale(0, true); tblFgd.SetRowScale(1, false); return(new TabPage { Padding = MasterPadding, Text = "Definitions", Content = tblFgd }); }
public ScalingSection() { TableLayout tableLayout; var layout = new DynamicLayout(this); var size = new Size(400, 100); tableLayout = new TableLayout(new Panel { BackgroundColor = Colors.Blue, Size = size }, 1, 1); tableLayout.Add(new Label { Text = "1x1, should scale to fill entire region (minus padding)", BackgroundColor = Colors.Red }, 0, 0, false, false); layout.Add(tableLayout.Container, yscale: true); tableLayout = new TableLayout(new Panel { BackgroundColor = Colors.Blue, Size = size }, 2, 2); tableLayout.Add(new Label { Text = "2x2, should scale", BackgroundColor = Colors.Red }, 1, 1, false, false); layout.Add(tableLayout.Container, yscale: true); tableLayout = new TableLayout(new Panel { BackgroundColor = Colors.Blue, Size = size }, 2, 2); tableLayout.Add(new Label { Text = "2x2, should scale", BackgroundColor = Colors.Red }, 0, 0, true, true); layout.Add(tableLayout.Container, yscale: true); tableLayout = new TableLayout(new Panel { BackgroundColor = Colors.Blue, Size = size }, 3, 3); tableLayout.Add(new Label { Text = "3x3, should scale", BackgroundColor = Colors.Red }, 1, 1, true, true); layout.Add(tableLayout.Container, yscale: true); tableLayout = new TableLayout(new Panel { BackgroundColor = Colors.Blue, Size = size }, 2, 2); tableLayout.Add(new Label { Text = "2x2, should not scale and be top left", BackgroundColor = Colors.Red }, 0, 0, false, false); layout.Add(tableLayout.Container, yscale: true); tableLayout = new TableLayout(new Panel { BackgroundColor = Colors.Blue, Size = size }, 2, 2); tableLayout.SetColumnScale(0); tableLayout.SetRowScale(0); tableLayout.Add(new Label { Text = "2x2, should not scale and be bottom-right", BackgroundColor = Colors.Red }, 1, 1); layout.Add(tableLayout.Container, yscale: true); tableLayout = new TableLayout(new Panel { BackgroundColor = Colors.Blue, Size = size }, 3, 3); tableLayout.SetColumnScale(0); tableLayout.SetRowScale(0); tableLayout.Add(new Label { Text = "2x2, should not scale and be bottom-right", BackgroundColor = Colors.Red }, 1, 1); layout.Add(tableLayout.Container, yscale: true); tableLayout = new TableLayout(new Panel { BackgroundColor = Colors.Blue, Size = size }, 3, 3); tableLayout.SetColumnScale(0); tableLayout.SetColumnScale(2); tableLayout.SetRowScale(0); tableLayout.SetRowScale(2); tableLayout.Add(new Label { Text = "2x2, should not scale and be centered", BackgroundColor = Colors.Red }, 1, 1); layout.Add(tableLayout.Container, yscale: true); }
private TabPage BuildTexturesTab() { var lbxWad = new ListBox() { AllowDrop = true, ID = LbxWadName }; var btnAddWad = new Button { Text = "Add...", Command = CmdAddWad }; var btnRemoveWad = new Button { Text = "Remove", Command = CmdRemoveWad }; var tblWadAddRemove = new TableLayout(2, 1) { Spacing = new Size(MasterPadding, 0) }; tblWadAddRemove.Add(btnAddWad, 0, 0); tblWadAddRemove.Add(btnRemoveWad, 1, 0); var stkWad = new StackLayout { Spacing = MasterPadding, HorizontalContentAlignment = HorizontalAlignment.Center, Items = { tblWadAddRemove } }; var btnBuiltInPalette = new RadioButton { Text = "Built-in", Checked = true, ID = "btnBuiltInPalette" }; btnBuiltInPalette.CheckedChanged += (sender, e) => { var drpPalette = FindChild <DropDown>("drpPalette"); if (btnBuiltInPalette.Checked) { drpPalette.Enabled = true; } else { drpPalette.Enabled = false; } }; var btnCustomPalette = new RadioButton(btnBuiltInPalette) { Text = "Custom", ID = "btnCustomPalette" }; btnCustomPalette.CheckedChanged += (sender, e) => { var fpkPalette = FindChild <FilePicker>("fpkPalette"); if (btnCustomPalette.Checked) { fpkPalette.Enabled = true; } else { fpkPalette.Enabled = false; } }; var tblBuiltInPalette = new TableLayout(2, 1) { Spacing = new Size(MasterPadding, 0) }; tblBuiltInPalette.Add(btnBuiltInPalette, 0, 0); tblBuiltInPalette.Add(new DropDown { Items = { "Quake" }, SelectedIndex = 0, ID = "drpPalette" }, 1, 0); var tblCustomPalette = new TableLayout(2, 1) { Spacing = new Size(MasterPadding, 0) }; tblCustomPalette.Add(btnCustomPalette, 0, 0); tblCustomPalette.Add(new FilePicker { FileAction = FileAction.OpenFile, Enabled = false, ID = "fpkPalette" }, 1, 0); var stkPalette = new StackLayout { Orientation = Orientation.Vertical, Spacing = MasterPadding, Items = { new Label { Text = "Palette:" }, tblBuiltInPalette, tblCustomPalette } }; var tblWad = new TableLayout(1, 3) { Spacing = new Size(0, MasterPadding) }; tblWad.Add(lbxWad, 0, 0); tblWad.Add(stkWad, 0, 1); tblWad.Add(stkPalette, 0, 2); tblWad.SetRowScale(0, true); tblWad.SetRowScale(1, false); tblWad.SetRowScale(2, false); return(new TabPage { Padding = MasterPadding, Text = "Textures", Content = tblWad }); }
void InitializeComponent() { Title = "Preferences"; Padding = MasterPadding; Resizable = true; // Uncommenting this line will cause the spawned TestDialog to be blank. //Size = new Size(300, 550); var lbxFgd = new ListBox() { AllowDrop = true }; lbxFgd.Items.Add("test/quake4ericwTools.fgd"); lbxFgd.Items.Add("test/func_instance.fgd"); var btnAddFgd = new Button { Text = "Add..." }; var btnRemoveFgd = new Button { Text = "Remove" }; var btnFgdCombineStack = new RadioButton { Text = "Stack", Checked = true }; var btnFgdCombineBlend = new RadioButton(btnFgdCombineStack) { Text = "Blend" }; var layoutFgdAddRemove = new TableLayout(2, 1) { Spacing = new Size(MasterPadding, 0) }; layoutFgdAddRemove.Add(btnAddFgd, 0, 0); layoutFgdAddRemove.Add(btnRemoveFgd, 1, 0); var tblFgdCombine = new TableLayout(2, 1) { Spacing = new Size(MasterPadding, 0) }; tblFgdCombine.Add(btnFgdCombineStack, 0, 0); tblFgdCombine.Add(btnFgdCombineBlend, 1, 0); var stkFgd = new StackLayout { Spacing = MasterPadding, HorizontalContentAlignment = HorizontalAlignment.Center, Items = { layoutFgdAddRemove, tblFgdCombine } }; var tblFgd = new TableLayout(1, 2) { Spacing = new Size(0, MasterPadding) }; tblFgd.Add(lbxFgd, 0, 0); tblFgd.Add(stkFgd, 0, 1); tblFgd.SetRowScale(0, true); tblFgd.SetRowScale(1, false); var gbxFgd = new GroupBox { Padding = new Padding(MasterPadding, MasterPadding, MasterPadding, 0), Text = "Entity definition files", Content = tblFgd, ID = "gbxFgd" }; var lbxWad = new ListBox() { AllowDrop = true }; lbxWad.Items.Add("test/quake.wad"); lbxWad.Items.Add("test/jam6_tens.wad"); var btnAddWad = new Button { Text = "Add..." }; var btnRemoveWad = new Button { Text = "Remove" }; var tblWadAddRemove = new TableLayout(2, 1) { Spacing = new Size(MasterPadding, 0) }; tblWadAddRemove.Add(btnAddWad, 0, 0); tblWadAddRemove.Add(btnRemoveWad, 1, 0); var stkWad = new StackLayout { Spacing = MasterPadding, HorizontalContentAlignment = HorizontalAlignment.Center, Items = { tblWadAddRemove } }; var tblPalette = new TableLayout(2, 1) { Spacing = new Size(MasterPadding, 0) }; tblPalette.Add(new Label { Text = "Palette:", VerticalAlignment = VerticalAlignment.Center }, 0, 0); tblPalette.Add(new FilePicker() { FileAction = Eto.FileAction.OpenFile }, 1, 0); var tblWad = new TableLayout(1, 3) { Spacing = new Size(0, MasterPadding) }; tblWad.Add(lbxWad, 0, 0); tblWad.Add(stkWad, 0, 1); tblWad.Add(tblPalette, 0, 2); tblWad.SetRowScale(0, true); tblWad.SetRowScale(1, false); tblWad.SetRowScale(2, false); var gbxWad = new GroupBox { Padding = new Padding(MasterPadding, MasterPadding, MasterPadding, 0), Text = "Texture collections", Content = tblWad, ID = "gbxWad" }; var tblMaster = new TableLayout(1, 2); tblMaster.Add(gbxFgd, 0, 0); tblMaster.Add(gbxWad, 0, 1); tblMaster.SetRowScale(0, true); tblMaster.SetRowScale(1, true); Content = new TabControl { BackgroundColor = SystemColors.ControlBackground, Pages = { new TabPage { Padding = MasterPadding, Text = "Resources", Content = tblMaster }, new TabPage { Text = "Controls" } } }; var cmdOK = new Command(); cmdOK.Executed += (sender, e) => Close(); var cmdCancel = new Command(); cmdCancel.Executed += (sender, e) => Close(); PositiveButtons.Add(new Button { Text = "OK", Command = cmdOK }); NegativeButtons.Add(new Button { Text = "Cancel", Command = cmdCancel }); }
public Editor(Application application, string baseDirectory, string codeFilename) { systemPath = baseDirectory + "/System.txt"; programPath = baseDirectory + "/Program.txt"; WindowState = WindowState.Maximized; Title = TitleText; Menu = new MenuBar { IncludeSystemItems = MenuBarSystemItems.Quit }; runCommand = new Command(OnRun); continueCommand = new Command(OnContinue); stepCommand = new Command(OnStep) { Shortcut = Keys.F10 }; Button runButton = new Button { Command = runCommand, Text = RunText }; Button continueButton = new Button { Command = continueCommand, Text = ContinueText }; Button stepButton = new Button { Command = stepCommand, Text = StepText }; systemEdit = new RichTextArea() { TextReplacements = TextReplacements.None }; systemEdit.Text = File.ReadAllText(systemPath); programEdit = new RichTextArea() { TextReplacements = TextReplacements.None }; programEdit.Text = File.ReadAllText(programPath); codeTree = new TreeGridView() { ShowHeader = false }; codeTree.Border = BorderType.Line; codeTree.Columns.Add(new GridColumn { Editable = false, DataCell = new TextBoxCell(0), Resizable = false }); codeTree.Columns.Add(new GridColumn { Editable = false, DataCell = new TextBoxCell(1), Resizable = false }); codeTree.SelectedItemChanged += OnCodeTreeViewSelectedItemChanged; frameStack = new ListBox { Style = "ListNative" }; frameStack.SelectedIndexChanged += OnCallStackListBoxSelectedIndexChanged; valueStack = new ListBox { Style = "ListNative" }; outputArea = new RichTextArea(); documentationView = new WebView(); Scrollable documentationwindow = new Scrollable(); documentationwindow.Content = documentationView; TableLayout buttons = TableLayout.Horizontal(runButton, continueButton, stepButton, new Panel()); DocumentPage systemPage = new DocumentPage(systemEdit) { Closable = false, Text = "System" }; DocumentPage programPage = new DocumentPage(programEdit) { Closable = false, Text = "Program" }; DocumentControl editsDocument = new DocumentControl() { AllowReordering = false }; editsDocument.Pages.Add(systemPage); editsDocument.Pages.Add(programPage); TableLayout outputControls = TableLayout.HorizontalScaled(outputArea, documentationwindow); outputControls.Height = StandardDimensionHeight; TableLayout codeOutputControls = new TableLayout(editsDocument, outputControls); codeOutputControls.SetRowScale(0); TableLayout stacks = new TableLayout(codeTree, frameStack, valueStack); stacks.SetRowScale(0); stacks.SetRowScale(1); stacks.SetRowScale(2); stacks.Width = StandardDimensionWidth; TableLayout codeControls = TableLayout.Horizontal(codeOutputControls, stacks); codeControls.SetColumnScale(0); Content = codeControls; TableLayout mainControls = new TableLayout(buttons, codeControls); mainControls.SetRowScale(1); Content = mainControls; runtime = new Mira(application, baseDirectory); runtime.Breaking += UpdateUI; runtime.Outputting += OnOutputting; runtime.Stepping += UpdateUI; runtime.Terminating += OnTerminating; runtime.Code = codeFilename; timer.Interval = 0.33; timer.Elapsed += OnElapsed; timer.Start(); LoadComplete += OnLoadComplete; }
private TabPage BuildControlsTab() { SldSensitivity.Bind(s => s.Value, Settings.Local, l => l.MouseSensitivity); TxtSensitivity.Bind <int>("Text", SldSensitivity, "Value"); SldMovementSpeed.Bind(s => s.Value, Settings.Roaming, r => r.MovementSpeed); TxtMovementSpeed.Bind <int>("Text", SldMovementSpeed, "Value"); var tblAxes = new TableLayout(1, 2) { Spacing = MasterSpacing / 2 }; tblAxes.Add(CbxInvertX, 0, 0); tblAxes.Add(CbxInvertY, 0, 1); var stkAxes = new StackLayout { Orientation = Orientation.Horizontal, VerticalContentAlignment = VerticalAlignment.Center, Spacing = MasterPadding, Items = { new Label { Text = "Axes" }, tblAxes } }; var tblSensitivity = new TableLayout(3, 1) { Spacing = MasterSpacing }; tblSensitivity.Add(new Label { Text = "Sensitivity" }, 0, 0); tblSensitivity.Add(SldSensitivity, 1, 0); tblSensitivity.Add(TxtSensitivity, 2, 0); tblSensitivity.SetColumnScale(0, false); tblSensitivity.SetColumnScale(1, true); tblSensitivity.SetColumnScale(2, false); var tblMouse = new TableLayout(1, 2) { Spacing = MasterSpacing }; tblMouse.Add(stkAxes, 0, 0); tblMouse.Add(tblSensitivity, 0, 1); tblMouse.SetRowScale(0, true); tblMouse.SetRowScale(1, true); tblMouse.SetColumnScale(0, true); var gbxMouse = new GroupBox { Text = "Mouse", Content = tblMouse, Padding = MasterPadding }; var tblMovementSpeed = new TableLayout(3, 3) { Spacing = MasterSpacing }; tblMovementSpeed.Add(new Label { Text = "Movement speed" }, 0, 1); tblMovementSpeed.Add(SldMovementSpeed, 1, 1); tblMovementSpeed.Add(TxtMovementSpeed, 2, 1); tblMovementSpeed.SetColumnScale(0, false); tblMovementSpeed.SetColumnScale(1, true); tblMovementSpeed.SetColumnScale(2, false); tblMovementSpeed.SetRowScale(0, true); tblMovementSpeed.SetRowScale(1, false); tblMovementSpeed.SetRowScale(2, true); var gbxKeyboard = new GroupBox { Text = "Keyboard", Content = tblMovementSpeed, Padding = MasterPadding }; var tblGroups = new TableLayout(1, 2); tblGroups.Add(gbxMouse, 0, 0); tblGroups.Add(gbxKeyboard, 0, 1); tblGroups.SetRowScale(0, true); tblGroups.SetRowScale(1, true); return(new TabPage { Padding = MasterPadding, Text = "Controls", Content = tblGroups }); }