public ScrollableSection() { var layout = new TableLayout(4, 2); layout.Spacing = new Size(5, 5); layout.Padding = new Padding(10); 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; }
public ScrollableSection() { var layout = new TableLayout(this, 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); }
Control NoPadding() { var layout = new TableLayout(new Panel { BackgroundColor = Colors.Blue }, 3, 4); layout.Padding = Padding.Empty; layout.Spacing = new Size(20, 20); layout.SetColumnScale(0); // scale first and last column layout.SetColumnScale(2); // scale first and last column FillTable(layout); return(layout.Container); }
Control Buttons() { var layout = new TableLayout(3, 1); layout.SetColumnScale(0); layout.Add(CancelButton(), 1, 0); layout.Add(OkButton(), 2, 0); 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(new Panel { BackgroundColor = Colors.Blue }, 3, 4); layout.Padding = new Padding(10); layout.Spacing = Size.Empty; layout.SetColumnScale(1); // scale middle column FillTable(layout); return(layout.Container); }
Control Sliders() { var layout = new TableLayout(5, 2); layout.SetColumnScale(0); layout.SetColumnScale(4); layout.Add(new Label { Text = "Red" }, 1, 0); layout.Add(redSlider = CreateSlider(), 1, 1); layout.Add(new Label { Text = "Green" }, 2, 0); layout.Add(greenSlider = CreateSlider(), 2, 1); layout.Add(new Label { Text = "Blue" }, 3, 0); layout.Add(blueSlider = CreateSlider(), 3, 1); return(layout); }
Control Buttons() { var layout = new TableLayout(4, 1); layout.Padding = Padding.Empty; layout.SetColumnScale(1); layout.Add(RemoveSauceButton(), 0, 0); layout.Add(CancelButton(), 2, 0); layout.Add(SaveButton(), 3, 0); return(layout); }
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 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; }
Control Brushes() { var layout = new TableLayout(6, 5); layout.Spacing = new Size(10, 5); layout.SetColumnScale(0); layout.SetColumnScale(5); RadioButton master = null; var brushes = CharacterHandler.Info.Brushes; for (int i = 0; i < CharacterDocumentInfo.MAX_BRUSHES; i++) { var brush = (i < brushes.Length) ? brushes[i] : new BrushInfo(); var control = new FontTextBox(CharacterHandler, new Size(CharacterDocumentInfo.MAX_BRUSH_SIZE, 1)); control.ReadOnly = false; control.SetAttribute(CharacterHandler.DrawAttribute); brushCanvases.Add(control.Canvas); if (brush != null) { var characters = brush.GetCharacters(CharacterHandler.CurrentPage.Font.Encoding) ?? new Character[0]; for (int c = 0; c < characters.Length; c++) { var ce = control.Canvas[c, 0]; ce.Character = characters[c]; control.Canvas[c, 0] = ce; } } control.GotFocus += delegate { lastSet = control; }; var x = (i / 5) * 2; var y = i % 5; var radio = new RadioButton(master) { Text = "Brush " + (i + 1), Tag = i }; if (i == SelectedBrush) { radio.Checked = true; radio.Focus(); } radio.MouseDoubleClick += (sender, e) => { e.Handled = true; var c = (RadioButton)sender; SelectedBrush = (int)c.Tag; Result = DialogResult.Ok; Save(); Close(); }; radio.CheckedChanged += delegate(object sender, EventArgs e) { var c = (RadioButton)sender; SelectedBrush = (int)c.Tag; }; if (master == null) { master = radio; } layout.Add(radio, x + 1, y); layout.Add(control, x + 2, y); } /** * var scroll = new Scrollable{ }; * var pl = new PixelLayout(scroll); * pl.Add(layout.Container, 0, 0); * return scroll; * /**/ return(new GroupBox { Content = layout }); /**/ }
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); }
public MainForm() { Title = "Pango Leak Sanity Check"; ClientSize = new Size(800, 500); BackgroundColor = Colors.RoyalBlue; data = 0; myFont = new Font(FontFamilies.SansFamilyName, 12); myText = data.ToString(); myFormat = new StringFormat(); myFormat.Alignment = StringAlignment.Center; myFormat.LineAlignment = StringAlignment.Center; shadowBrush = new SolidBrush(Colors.Black); textBrush = new SolidBrush(Colors.White); ShadowOffset = 1; L1 = new Label { Text = "L1", TextColor = Colors.Wheat }; L2 = new DropShadowLabel(); DS1 = new DropShadowLabel(); DS2 = new DropShadowLabel(); DS3 = new DropShadowLabel(); DS4 = new DropShadowLabel(); d = new Drawable(); d.Size = new Size(200, 50); d.Paint += L2_Paint; initial_total = GC.GetTotalMemory(true); L4 = new Label { Text = string.Format("Initial Memory {0}", initial_total), TextColor = Colors.Wheat }; L3 = new Label { Text = "L3", TextColor = Colors.Wheat }; timer = new UITimer(); timer.Interval = 0.100; timer.Elapsed += Timer_Elapsed; // table with three rows TableLayout L = new TableLayout( // row with 5 columns new TableRow { Cells = { new TableCell(L1, true), new TableCell("pad", true), new TableCell(DS1, true), new TableCell("pad", true) } }, new TableRow { Cells = { new TableCell(L2, true), new TableCell("pad", true), new TableCell(DS2, true), new TableCell("pad", true) } }, new TableRow { Cells = { new TableCell(L3, true), new TableCell("pad", true), new TableCell(DS3, true), new TableCell("pad", true) } }, new TableRow { Cells = { new TableCell(L4, true), new TableCell("pad", true), new TableCell(DS4, true), new TableCell("pad", true) } }); L.SetColumnScale(1, false); Content = L; // create a few commands that can be used for the menu and toolbar var StartStop = new Command { MenuText = "Start/Stop", ToolBarText = "Start/Stop" }; StartStop.Executed += (sender, e) => { if (timer.Started) { timer.Stop(); } else { timer.Start(); } }; var MemStatus = new Command { MenuText = "Memory Status", ToolBarText = "Memory Status" }; MemStatus.Executed += MemStatus_Executed; var quitCommand = new Command { MenuText = "Quit", Shortcut = Application.Instance.CommonModifier | Keys.Q }; quitCommand.Executed += (sender, e) => Application.Instance.Quit(); var aboutCommand = new Command { MenuText = "About..." }; aboutCommand.Executed += (sender, e) => MessageBox.Show(this, "About my app..."); // create menu Menu = new MenuBar { Items = { // File submenu new ButtonMenuItem { Text = "&File", Items ={ StartStop } }, }, ApplicationItems = { // application (OS X) or file menu (others) new ButtonMenuItem { Text = "&Preferences..." }, }, QuitItem = quitCommand, AboutItem = aboutCommand }; // create toolbar ToolBar = new ToolBar { Items = { StartStop, MemStatus } }; // snapshot of original memory state using (Process ThisProcess = Process.GetCurrentProcess()) { gprior_total = ThisProcess.PrivateMemorySize64; } initial_total = GC.GetTotalMemory(true); }
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; }
public GKSheetList(Panel owner) { if (owner == null) { throw new ArgumentNullException("owner"); } fBtnMoveDown = new Button(); fBtnMoveDown.Image = UIHelper.LoadResourceImage("Resources.btn_down.gif"); fBtnMoveDown.Size = UIHelper.ShortButtonSize; fBtnMoveDown.ToolTip = LangMan.LS(LSID.LSID_RecordMoveDown); fBtnMoveDown.Click += ItemMoveDown; fBtnMoveUp = new Button(); fBtnMoveUp.Image = UIHelper.LoadResourceImage("Resources.btn_up.gif"); fBtnMoveUp.Size = UIHelper.ShortButtonSize; fBtnMoveUp.ToolTip = LangMan.LS(LSID.LSID_RecordMoveUp); fBtnMoveUp.Click += ItemMoveUp; fBtnLinkJump = new Button(); fBtnLinkJump.Image = UIHelper.LoadResourceImage("Resources.btn_jump.gif"); fBtnLinkJump.Size = UIHelper.ShortButtonSize; fBtnLinkJump.ToolTip = LangMan.LS(LSID.LSID_RecordGoto); fBtnLinkJump.Click += ItemJump; fBtnDelete = new Button(); fBtnDelete.Image = UIHelper.LoadResourceImage("Resources.btn_rec_delete.gif"); fBtnDelete.Size = UIHelper.ShortButtonSize; fBtnDelete.ToolTip = LangMan.LS(LSID.LSID_MIRecordDelete); fBtnDelete.Click += ItemDelete; fBtnEdit = new Button(); fBtnEdit.Image = UIHelper.LoadResourceImage("Resources.btn_rec_edit.gif"); fBtnEdit.Size = UIHelper.ShortButtonSize; fBtnEdit.ToolTip = LangMan.LS(LSID.LSID_MIRecordEdit); fBtnEdit.Click += ItemEdit; fBtnAdd = new Button(); fBtnAdd.Image = UIHelper.LoadResourceImage("Resources.btn_rec_new.gif"); fBtnAdd.Size = UIHelper.ShortButtonSize; fBtnAdd.ToolTip = LangMan.LS(LSID.LSID_MIRecordAdd); fBtnAdd.Click += ItemAdd; fList = new GKListView(); fList.MouseDoubleClick += List_DoubleClick; fList.KeyDown += List_KeyDown; SuspendLayout(); var toolbar = new DefStackLayout(Orientation.Vertical, 4, fBtnAdd, fBtnEdit, fBtnDelete, fBtnLinkJump, fBtnMoveUp, fBtnMoveDown); var tab = new TableLayout(2, 1); tab.Spacing = new Size(4, 4); tab.SetColumnScale(0, true); tab.SetColumnScale(1, false); tab.Add(fList, 0, 0); tab.Add(toolbar, 1, 0); Content = tab; ResumeLayout(); owner.SuspendLayout(); owner.Content = this; owner.ResumeLayout(); fButtons = EnumSet <SheetButton> .Create(SheetButton.lbAdd, SheetButton.lbEdit, SheetButton.lbDelete); fListModel = null; }
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 }); }