public TreeViewSection() { var layout = new DynamicLayout(); layout.BeginHorizontal(); layout.Add(new Label()); layout.BeginVertical(); layout.BeginHorizontal(); layout.Add(null); layout.Add(allowExpanding = new CheckBox{ Text = "Allow Expanding", Checked = true }); layout.Add(allowCollapsing = new CheckBox{ Text = "Allow Collapsing", Checked = true }); layout.Add(RefreshButton()); layout.Add(null); layout.EndHorizontal(); layout.EndVertical(); layout.EndHorizontal(); treeView = ImagesAndMenu(); layout.AddRow(new Label{ Text = "Simple" }, Default()); layout.BeginHorizontal(); layout.Add(new Panel()); layout.BeginVertical(); layout.AddSeparateRow(InsertButton(), AddChildButton(), RemoveButton(), ExpandButton(), CollapseButton(), null); layout.AddSeparateRow(LabelEditCheck(), EnabledCheck(), null); layout.EndVertical(); layout.EndHorizontal(); layout.AddRow(new Label{ Text = "With Images\n&& Context Menu" }, treeView); layout.AddRow(new Panel(), HoverNodeLabel()); layout.Add(null, false, true); Content = layout; }
public TreeGridViewSection() { var layout = new DynamicLayout(); layout.BeginHorizontal(); layout.Add(new Label()); layout.BeginVertical(); layout.BeginHorizontal(); layout.Add(null); layout.Add(allowExpanding = new CheckBox{ Text = "Allow Expanding", Checked = true }); layout.Add(allowCollapsing = new CheckBox{ Text = "Allow Collapsing", Checked = true }); layout.Add(null); layout.EndHorizontal(); layout.EndVertical(); layout.EndHorizontal(); layout.AddRow(new Label{ Text = "Simple" }, Default()); layout.AddRow(new Label{ Text = "With Images\n&& Context Menu" }, ImagesAndMenu()); layout.AddRow(new Label{ Text = "Disabled" }, Disabled()); layout.Add(null, false, true); Content = layout; }
Control TestProperties() { var layout = new DynamicLayout(); DateTimePicker min, max, current, setValue; Button setButton; layout.AddRow(new Label { Text = "Min Value" }, min = new DateTimePicker()); layout.AddRow(new Label { Text = "Max Value" }, max = new DateTimePicker()); layout.BeginHorizontal(); layout.Add(new Label { Text = "Set to value" }); layout.BeginVertical(); layout.BeginHorizontal(); layout.AddAutoSized(setValue = new DateTimePicker()); layout.Add(setButton = new Button { Text = "Set" }); layout.EndHorizontal(); layout.EndVertical(); layout.EndHorizontal(); layout.AddRow(new Label { Text = "Value" }, current = new DateTimePicker()); min.ValueChanged += (sender, e) => current.MinDate = min.Value ?? DateTime.MinValue; max.ValueChanged += (sender, e) => current.MaxDate = max.Value ?? DateTime.MaxValue; setButton.Click += (sender, e) => current.Value = setValue.Value; LogEvents(current); return layout; }
Control TestProperties() { var layout = new DynamicLayout { DefaultSpacing = new Size(5, 5) }; DateTimePicker min, max, current, setValue; Button setButton; layout.AddRow("Min Value", min = new DateTimePicker()); layout.AddRow("Max Value", max = new DateTimePicker()); layout.BeginHorizontal(); layout.Add("Set to value"); layout.BeginVertical(Padding.Empty); layout.BeginHorizontal(); layout.AddAutoSized(setValue = new DateTimePicker()); layout.Add(setButton = new Button { Text = "Set" }); layout.EndHorizontal(); layout.EndVertical(); layout.EndHorizontal(); layout.AddRow("Value", current = new DateTimePicker()); min.ValueChanged += (sender, e) => current.MinDate = min.Value ?? DateTime.MinValue; max.ValueChanged += (sender, e) => current.MaxDate = max.Value ?? DateTime.MaxValue; setButton.Click += (sender, e) => current.Value = setValue.Value; LogEvents(current); return layout; }
public PrintDialogSection() { this.DataContext = settings; var layout = new DynamicLayout { DefaultSpacing = new Size(5, 5), Padding = new Padding(10) }; layout.BeginVertical(); layout.BeginHorizontal(); layout.Add(null); layout.BeginVertical(Padding.Empty); layout.AddSeparateRow(null, ShowPrintDialog(), null); layout.AddSeparateRow(null, PrintFromGraphicsWithDialog(), null); layout.AddSeparateRow(null, PrintFromGraphics(), null); layout.EndBeginVertical(); layout.Add(PrintDialogOptions()); layout.Add(null); layout.EndVertical(); layout.Add(null); layout.EndHorizontal(); layout.EndVertical(); layout.AddSeparateRow(null, PageRange(), Settings(), null); layout.Add(null); Content = layout; }
void LayoutButtons() { if (!Loaded) { return; } SuspendLayout(); var layout = new DynamicLayout { Padding = Padding.Empty, Spacing = spacing }; var horizontal = orientation == Orientation.Horizontal; if (horizontal) { layout.BeginHorizontal(); } foreach (var button in buttons) { layout.Add(button); } layout.Add(null); if (horizontal) { layout.EndHorizontal(); } Content = layout; ResumeLayout(); }
public GridViewSection() { var layout = new DynamicLayout(); layout.AddRow(new Label { Text = "Default" }, Default()); layout.AddRow(new Label { Text = "No Header,\nNon-Editable" }, NoHeader()); #if DESKTOP layout.BeginHorizontal(); layout.Add(new Label { Text = "Context Menu\n&& Multi-Select\n&& Filter" }); layout.BeginVertical(); layout.Add(filterText = new SearchBox { PlaceholderText = "Filter" }); var withContextMenuAndFilter = WithContextMenuAndFilter(); layout.Add(withContextMenuAndFilter); layout.EndVertical(); layout.EndHorizontal(); var selectionGridView = Default(addItems: false); layout.AddRow(new Label { Text = "Selected Items" }, selectionGridView); // hook up selection of main grid to the selection grid withContextMenuAndFilter.SelectionChanged += (s, e) => { var items = new DataStoreCollection(); items.AddRange(withContextMenuAndFilter.SelectedItems); selectionGridView.DataStore = items; }; #endif Content = layout; }
void LayoutButtons() { if (!Loaded) { return; } this.SuspendLayout(); var layout = new DynamicLayout(Padding.Empty, spacing); var horizontal = orientation == RadioButtonListOrientation.Horizontal; if (horizontal) { layout.BeginHorizontal(); } foreach (var button in buttons) { layout.Add(button); } layout.Add(null); if (horizontal) { layout.EndHorizontal(); } this.Content = layout; this.ResumeLayout(); }
public MyForm() { this.ClientSize = new Size(600, 400); this.Title = "Dynamic Layout"; // Using a DynamicLayout for a simple table is actually a lot easier to maintain than using a TableLayout // and having to specify the x/y co-ordinates for each control added. // 1. Create a new DynamicLayout object var layout = new DynamicLayout(); // 2. Begin a horizontal row of controls layout.BeginHorizontal(); // 3. Add controls for each column. We are setting xscale to true to make each column use an equal portion // of the available space. layout.Add(new Label { Text = "First Column" }, xscale: true); layout.Add(new Label { Text = "Second Column" }, xscale: true); layout.Add(new Label { Text = "Third Column" }, xscale: true); // 4. End the horizontal section layout.EndHorizontal(); // 5. To add a new row, begin another horizontal section and add more controls: layout.BeginHorizontal(); layout.Add(new TextBox { Text = "Second Row, First Column" }); layout.Add(new ComboBox { DataStore = new ListItemCollection { new ListItem { Text = "Second Row, Second Column" } } }); layout.Add(new CheckBox { Text = "Second Row, Third Column" }); layout.EndHorizontal(); // 6. By default, the last row & column of a table expands to fill the rest of the space. We can add one // last row with nothing in it to make the space empty. Since we are not in a horizontal group, calling // Add() adds a new row. layout.Add(null); // 7. Set the content of the form to use the layout Content = layout; GenerateActions(); }
static void AddHeaders(DynamicLayout layout) { layout.BeginHorizontal(); layout.Add(null, xscale: false); layout.Add(new Label { Text = "Bitmap", HorizontalAlign = HorizontalAlign.Center }, xscale: true); layout.Add(new Label { Text = "Icon", HorizontalAlign = HorizontalAlign.Center }, xscale: true); layout.EndHorizontal(); }
protected override Forms.Window GetWindow() { // Add splitters like this: // |--------------------------- // | | | | // | P0 | P2 | P4 | // | -------| | | <== These are on MainPanel // | P1 |------| | // | | P3 | | // |--------------------------- // | status0..4, | <== These are on StatusPanel // ---------------------------- Label[] status = new Label[] { new Label(), new Label(), new Label(), new Label(), new Label() }; // Status bar var statusPanel = new Panel { }; var statusLayout = new DynamicLayout(Padding.Empty, Size.Empty); statusLayout.BeginHorizontal(); for (var i = 0; i < status.Length; ++i) statusLayout.Add(status[i], xscale: true); statusLayout.EndHorizontal(); statusPanel.Content = statusLayout; // Splitter windows Panel[] p = new Panel[] { new Panel(), new Panel(), new Panel(), new Panel(), new Panel() }; var colors = new Color[] { Colors.PaleTurquoise, Colors.Olive, Colors.NavajoWhite, Colors.Purple, Colors.Orange }; var count = 0; for (var i = 0; i < p.Length; ++i) { var temp = i; //p[i].BackgroundColor = colors[i]; var button = new Button { Text = "Click to update status " + i.ToString(), BackgroundColor = colors[i] }; button.Click += (s, e) => status[temp].Text = "New count: " + (count++).ToString(); p[i].Content = button; } var p0_1 = new Splitter { Panel1 = p[0], Panel2 = p[1], Orientation = SplitterOrientation.Vertical, Position = 200 }; var p2_3 = new Splitter { Panel1 = p[2], Panel2 = p[3], Orientation = SplitterOrientation.Vertical, Position = 200 }; var p01_23 = new Splitter { Panel1 = p0_1, Panel2 = p2_3, Orientation = SplitterOrientation.Horizontal, Position = 200}; var p0123_4 = new Splitter { Panel1 = p01_23, Panel2 = p[4], Orientation = SplitterOrientation.Horizontal, Position = 400 }; // Main panel var mainPanel = new Panel(); mainPanel.Content = p0123_4; // Form's content var layout = new DynamicLayout(); layout.Add(mainPanel, yscale: true); layout.Add(statusPanel); layout.Generate(); var form = new Form { Size = new Size(800, 600), Content = layout }; return form; }
protected override void OnPreLoad(EventArgs e) { var layout = new DynamicLayout { DefaultSpacing = new Size(5, 5), Padding = new Padding(10) }; var options = CreateOptions(); if (options != null) layout.Add(options); layout.BeginVertical(); layout.AddRow(null, LabelControl(), ButtonControl(), new Panel(), null); layout.AddRow(null, TextBoxControl(), PasswordBoxControl()); layout.BeginHorizontal(); layout.Add(null); layout.Add(TextAreaControl()); if (Platform.Supports<ListBox>()) layout.Add(ListBoxControl()); layout.EndHorizontal(); layout.AddRow(null, CheckBoxControl(), RadioButtonControl()); layout.AddRow(null, DateTimeControl(), NumericUpDownControl()); layout.AddRow(null, DropDownControl(), ComboBoxControl()); layout.BeginHorizontal(); layout.Add(null); layout.Add(ColorPickerControl()); if (Platform.Supports<GroupBox>()) layout.Add(GroupBoxControl()); layout.EndHorizontal(); layout.AddRow(null, LinkButtonControl(), SliderControl()); layout.AddRow(null, DrawableControl(), ImageViewControl()); layout.EndVertical(); layout.Add(null); Content = layout; base.OnPreLoad(e); }
public MessageBoxSection() { MessageBoxText = "Some message"; MessageBoxCaption = "Some caption"; AttachToParent = true; var layout = new DynamicLayout(); layout.AddSeparateRow(null, new Label { Text = "Caption" }, CaptionBox(), null); layout.AddSeparateRow(null, new Label { Text = "Text" }, TitleBox(), null); layout.BeginVertical(Padding.Empty); layout.BeginHorizontal(); layout.Add(null); layout.Add(new Label { Text = "Type", VerticalAlign = VerticalAlign.Middle, HorizontalAlign = HorizontalAlign.Right }); layout.Add(MessageBoxTypeCombo()); layout.Add(AttachToParentCheckBox()); layout.Add(null); layout.EndHorizontal(); layout.EndBeginVertical(); layout.BeginHorizontal(); layout.Add(null); layout.Add(new Label { Text = "Buttons", VerticalAlign = VerticalAlign.Middle, HorizontalAlign = HorizontalAlign.Right }); layout.Add(MessageBoxButtonsCombo()); layout.Add(new Label { Text = "Default Button", VerticalAlign = VerticalAlign.Middle, HorizontalAlign = HorizontalAlign.Right }); layout.Add(MessageBoxDefaultButtonCombo()); layout.Add(null); layout.EndHorizontal(); layout.EndVertical(); layout.AddSeparateRow(null, ShowDialogButton(), null); layout.Add(null); Content = layout; }
public MessageBoxSection() { MessageBoxText = "Some message"; MessageBoxCaption = "Some caption"; AttachToParent = true; var layout = new DynamicLayout { DefaultSpacing = new Size(5, 5), Padding = new Padding(10) }; layout.AddSeparateRow(null, new Label { Text = "Caption" }, CaptionBox(), null); layout.AddSeparateRow(null, new Label { Text = "Text" }, TitleBox(), null); layout.BeginVertical(); layout.BeginHorizontal(); layout.Add(null); layout.Add(new Label { Text = "Type", VerticalAlignment = VerticalAlignment.Center, TextAlignment = TextAlignment.Right }); layout.Add(MessageBoxTypeCombo()); layout.Add(AttachToParentCheckBox()); layout.Add(null); layout.EndHorizontal(); layout.EndBeginVertical(); layout.BeginHorizontal(); layout.Add(null); layout.Add(new Label { Text = "Buttons", VerticalAlignment = VerticalAlignment.Center, TextAlignment = TextAlignment.Right }); layout.Add(MessageBoxButtonsCombo()); layout.Add(new Label { Text = "Default Button", VerticalAlignment = VerticalAlignment.Center, TextAlignment = TextAlignment.Right }); layout.Add(MessageBoxDefaultButtonCombo()); layout.Add(null); layout.EndHorizontal(); layout.EndVertical(); layout.AddSeparateRow(null, ShowDialogButton(), null); layout.Add(null); Content = layout; }
static Control SetBadgeLabel() { var layout = new DynamicLayout { Spacing = new Size(5, 5) }; layout.BeginHorizontal(); var text = new TextBox(); var button = new Button { Text = "Set Badge Label" }; button.Click += (sender, e) => Application.Instance.BadgeLabel = text.Text; layout.Add(new Label { Text = "Badge Label Text:", VerticalAlignment = VerticalAlignment.Center }); layout.AddCentered(text); layout.Add(button); layout.EndHorizontal(); return layout; }
Control Disabled() { var layout = new DynamicLayout(); layout.BeginHorizontal(); RadioButton controller = null; for (int i = 0; i < 5; i++) { var item = new RadioButton(controller) { Text = "Item " + i, Checked = i == 2, Enabled = false }; controller = controller ?? item; LogEvents(item); layout.Add(item); } layout.EndHorizontal(); return layout; }
Control SetInitialValue() { var layout = new DynamicLayout { DefaultSpacing = new Size(5, 5) }; layout.BeginHorizontal(); RadioButton controller = null; for (int i = 0; i < 5; i++) { var item = new RadioButton(controller) { Text = "Item " + i, Checked = i == 2 }; controller = controller ?? item; LogEvents(item); layout.Add(item); } layout.EndHorizontal(); return layout; }
Control SetBadgeLabel() { var layout = new DynamicLayout(); layout.BeginHorizontal(); TextBox text = new TextBox(); Button button = new Button { Text = "Set Badge Label" }; button.Click += (sender, e) => { Application.Instance.BadgeLabel = text.Text; }; layout.Add(new Label { Text = "Badge Label Text:", VerticalAlign = VerticalAlign.Middle }); layout.AddCentered(text); layout.Add(button); layout.EndHorizontal(); return layout; }
Control SetInitialValue() { var layout = new DynamicLayout(); layout.BeginHorizontal(); RadioButton controller = null; for (int i = 0; i < 5; i++) { var item = new RadioButton(controller) { Text = "Item " + i, Checked = i == 2 }; if (controller == null) controller = item; LogEvents(item); layout.Add(item); } layout.EndHorizontal(); return layout; }
public DrawableSection () { var layout = new DynamicLayout (this); layout.BeginVertical (); layout.BeginHorizontal (); layout.Add (new Label { Text = "Default" }); layout.Add (this.Default (), true); layout.Add (new Label { Text = "With Background" }); layout.Add (this.WithBackground (), true); layout.EndHorizontal (); layout.EndVertical (); layout.BeginVertical (); layout.AddRow (new Label { Text = "Large Canvas" }, DockLayout.CreatePanel (this.LargeCanvas ())); layout.EndVertical (); layout.Add (null); }
void Init() { _textAreaInput = new TextArea(); _textAreaInput.Font = new Font(FontFamilies.Monospace, 10); _dropDownServices = new DropDown {Width = 200}; _dropDownServices.SelectedIndexChanged += DropDownServicesSelectedIndexChanged; _radioButtonEncode = new RadioButton {Text = "Encode"}; _radioButtonEncode.CheckedChanged += _radioButtonEncode_CheckedChanged; _radioButtonDecode = new RadioButton(_radioButtonEncode) {Text = "Decode"}; _buttonRun = new Button { Text = "Run" }; _buttonRun.Click += _buttonRun_Click; _textAreaOutput = new TextArea(); _textAreaOutput.Font = new Font(FontFamilies.Monospace, 10); var inputLayout = new DynamicLayout {Padding = new Padding(5, 5, 5, 0), Spacing = new Size(5, 5)}; inputLayout.AddSeparateRow(_textAreaInput); var outputLayout = new DynamicLayout {Padding = new Padding(5, 5), Spacing = new Size(5, 5)}; outputLayout.BeginVertical(); outputLayout.BeginHorizontal(); outputLayout.AddCentered(_radioButtonEncode, horizontalCenter: false); outputLayout.AddCentered(_radioButtonDecode, horizontalCenter: false); outputLayout.Add(null); outputLayout.AddCentered(_dropDownServices, horizontalCenter: false); outputLayout.AddCentered(_buttonRun, horizontalCenter: false); outputLayout.EndHorizontal(); outputLayout.EndVertical(); outputLayout.AddSeparateRow(_textAreaOutput); var layout = new Splitter { Panel1 = inputLayout, Panel2 = outputLayout, Orientation = SplitterOrientation.Vertical, Position = 130 }; Content = layout; }
public DrawableSection() { var layout = new DynamicLayout { DefaultSpacing = new Size(5, 5), Padding = new Padding(10) }; layout.BeginVertical(); layout.BeginHorizontal(); layout.Add("Default"); layout.Add(this.Default(), xscale: true); layout.Add("With Background"); layout.Add(this.WithBackground(), xscale: true); layout.EndHorizontal(); layout.EndVertical(); layout.BeginVertical(); // use a separate containing panel to test calculations in those cases layout.AddRow("Large Canvas", new Panel { Content = this.LargeCanvas() }); layout.EndVertical(); layout.Add(null); Content = layout; }
public DrawableSection() { var layout = new DynamicLayout(); layout.BeginVertical(); layout.BeginHorizontal(); layout.Add(new Label { Text = "Default" }); layout.Add(this.Default(), xscale: true); layout.Add(new Label { Text = "With Background" }); layout.Add(this.WithBackground(), xscale: true); layout.EndHorizontal(); layout.EndVertical(); layout.BeginVertical(); // use a separate containing panel to test calculations in those cases layout.AddRow(new Label { Text = "Large Canvas" }, new Panel { Content = this.LargeCanvas () }); layout.EndVertical(); layout.Add(null); Content = layout; }
Control CreateViews(Image image) { var layout = new DynamicLayout(); layout.BeginHorizontal(); layout.Add("ImageView"); layout.AddAutoSized(new ImageView { Image = image }); layout.AddAutoSized(new ImageView { Image = image, Size = new Size(64, 64) }); layout.AddAutoSized(new ImageView { Image = image, Size = new Size(32, 32) }); layout.EndBeginHorizontal(); layout.Add("Drawable"); layout.AddAutoSized(new DrawableImageView { Image = image }); layout.AddAutoSized(new DrawableImageView { Image = image, MinimumSize = new Size(64, 64), ScaleImage = true }); layout.AddAutoSized(new DrawableImageView { Image = image, MinimumSize = new Size(32, 32), ScaleImage = true }); layout.EndBeginHorizontal(); layout.Add("Button"); layout.AddAutoSized(new Button { Image = image, Text = "Auto Size" }); layout.AddAutoSized(new Button { Image = image, Text = "64px Height", Height = 64 }); layout.AddAutoSized(new Button { Image = image, Text = "32px Height", Height = 32 }); layout.EndBeginHorizontal(); layout.EndHorizontal(); return layout; }
public OptionsPageView(OptionsPageModel model) { var layout = new DynamicLayout(); var infoLayout = new StackLayout { Spacing = 10 }; foreach (var option in model.Options) { var currentOption = option; option.Selected = option.Values.FirstOrDefault(); var infoLabel = new Label { Text = option.Selected?.Description }; infoLayout.Items.Add(infoLabel); layout.Add(new Label { Text = option.Name }); layout.BeginVertical(); layout.BeginHorizontal(); layout.Add(new Panel { Size = new Size(40, -1) }, xscale: false); var radioList = new RadioButtonList(); radioList.Orientation = Orientation.Vertical; radioList.ItemTextBinding = Binding.Property((OptionValue v) => v.Name); radioList.DataStore = option.Values; radioList.SelectedValueChanged += (sender, e) => { currentOption.Selected = radioList.SelectedValue as OptionValue; infoLabel.Text = currentOption.Selected?.Description; }; radioList.SelectedIndex = 0; layout.Add(radioList); layout.EndHorizontal(); layout.EndVertical(); } Information = infoLayout; Content = layout; }
public void AddingItemMultipleLevelsDeepShouldSetChildrenAndParent() { TestBase.Invoke(() => { var layout = new DynamicLayout(); var items = new List<Control>(); layout.BeginHorizontal(); Control ctl = new Button(); items.Add(ctl); layout.Add(ctl); layout.BeginVertical(); ctl = new Label(); items.Add(ctl); layout.Add(ctl); layout.EndVertical(); layout.EndHorizontal(); ctl = new TextBox(); items.Add(ctl); layout.Add(ctl); CollectionAssert.AreEqual(items, layout.Children, "#1. Items do not match"); foreach (var item in items) Assert.AreEqual(layout, item.Parent, "#2. Items should have parent set to dynamic layout"); layout.Clear(); foreach (var item in items) Assert.IsNull(item.Parent, "#3. Items should have parent removed when removed from dynamic layout"); }); }
static Form Test1(bool setSize, Action<Label[], Panel> layoutContent) { // Status bar Label[] status = { new Label(), new Label(), new Label(), new Label(), new Label() }; var statusLayout = new DynamicLayout(Padding.Empty, Size.Empty); statusLayout.BeginHorizontal(); for (var i = 0; i < status.Length; ++i) statusLayout.Add(status[i], xscale: true); statusLayout.EndHorizontal(); // Main panel var mainPanel = new Panel(); layoutContent(status, mainPanel); // Form's content var layout = new DynamicLayout(); layout.Add(mainPanel, yscale: true); layout.Add(statusLayout); layout.Generate(); var form = new Form { Content = layout }; if (setSize) form.ClientSize = new Size(800, 600); return form; }
Control EventLogSection() { var layout = new DynamicLayout { Size = new Size(100, 120), Spacing = Size.Empty }; layout.BeginHorizontal(); layout.Add(EventLog, true); layout.BeginVertical(new Padding(5, 0)); layout.Add(ClearButton()); layout.Add(MemoryButton()); layout.Add(null); layout.EndVertical(); layout.EndHorizontal(); return layout; }
void Init() { // _textBoxFindText var labelFindText = new Label { Text = StrRes.GetString("StrFindContent", "FindContent") }; _textBoxFindText = new TextBox(); // _buttonFindNext _buttonFindNext = new Button { Text = StrRes.GetString("StrFindNext", "FindNext") }; _buttonFindNext.Click += _buttonFindNext_Click; // _buttonCancel _buttonCancel = new Button { Text = StrRes.GetString("StrCancel","Cancel") }; _buttonCancel.Click += _buttonCancel_Click; // _checkBoxCaseSensitive _checkBoxCaseSensitive = new CheckBox { Text = StrRes.GetString("StrCaseSensitive", "Case Sensitive") }; // _radio _radioButtonUp = new RadioButton { Text = StrRes.GetString("StrUp", "Up") }; _radioButtonDown = new RadioButton(_radioButtonUp) { Text = StrRes.GetString("StrDown", "Down") }; _radioButtonDown.Checked = true; var groupLayout = new DynamicLayout {Padding = new Padding(5, 5), Spacing = new Size(5, 5)}; groupLayout.AddRow(_radioButtonUp, _radioButtonDown); var group = new GroupBox { Text = StrRes.GetString("StrDirection", "Direction") }; group.Content = groupLayout; var layout = new DynamicLayout { Padding = new Padding(5, 5), Spacing = new Size(5, 5) }; layout.BeginHorizontal(); // left start ---> layout.BeginVertical(xscale: true); layout.BeginHorizontal(); layout.Add(labelFindText); layout.Add(_textBoxFindText); layout.EndHorizontal(); layout.Add(null); layout.BeginHorizontal(); layout.Add(_checkBoxCaseSensitive); layout.Add(group); layout.EndHorizontal(); layout.EndVertical(); // <--- left end // right start ---> layout.BeginVertical(xscale: false, yscale: false); layout.Add(_buttonFindNext); layout.Add(null); layout.Add(_buttonCancel); layout.EndVertical(); // <--- right end layout.EndHorizontal(); Content = layout; Title = StrRes.GetString("StrFind", "Find"); Minimizable = false; Maximizable = false; Topmost = true; ClientSize = new Size(350, 90); Resizable = false; }
Control Buttons () { var layout = new DynamicLayout (new Panel (), spacing: Size.Empty); layout.BeginHorizontal (); layout.Add (null); layout.Add (BackButton ()); layout.Add (ForwardButton ()); layout.Add (LoadHtmlButton ()); layout.Add (LoadUrl ()); layout.Add (ReloadButton ()); layout.Add (StopButton ()); layout.Add (ExecuteScriptButton ()); layout.Add (PrintButton ()); layout.Add (null); layout.EndHorizontal (); return layout.Container; }
Control MainContent() { contentContainer = new Panel(); // set focus when the form is shown Shown += delegate { SectionList.Focus(); }; SectionList.SelectedItemChanged += (sender, e) => { try { var item = SectionList.SelectedItem; Control content = item != null ? item.CreateContent() : null; if (navigation != null) { if (content != null) navigation.Push(content, item != null ? item.Text : null); } else { contentContainer.Content = content; } } catch (Exception ex) { Log.Write(this, "Error loading section: {0}", ex.GetBaseException()); contentContainer.Content = null; } #if DEBUG GC.Collect(); GC.WaitForPendingFinalizers(); #endif }; if (Splitter.IsSupported()) { var splitter = new Splitter { Position = 200, FixedPanel = SplitterFixedPanel.Panel1, Panel1 = SectionList.Control, #if MOBILE // for now, don't show log in mobile Panel2 = contentContainer #else Panel2 = RightPane() #endif }; return splitter; } if (Navigation.IsSupported()) { navigation = new Navigation(SectionList.Control, "Eto.Test"); return navigation; } throw new EtoException("Platform must support splitter or navigation"); } Control RightPane() { return new Splitter { Orientation = SplitterOrientation.Vertical, FixedPanel = SplitterFixedPanel.Panel2, Panel1 = contentContainer, Panel2 = EventLogSection() }; } Control EventLogSection() { var layout = new DynamicLayout { Size = new Size(100, 120) }; layout.BeginHorizontal(); layout.Add(EventLog, true); layout.BeginVertical(); layout.Add(ClearButton()); layout.Add(null); layout.EndVertical(); layout.EndHorizontal(); return layout; } Control ClearButton() { var control = new Button { Text = "Clear" }; control.Click += (sender, e) => EventLog.Text = string.Empty; return control; } void GenerateMenuToolBar() { var about = new Actions.About(); var quit = new Actions.Quit(); #if DESKTOP var menu = new MenuBar(); // create standard system menu (e.g. for OS X) Application.Instance.CreateStandardMenu(menu.Items); // add our own items to the menu var file = menu.Items.GetSubmenu("&File", 100); menu.Items.GetSubmenu("&Edit", 200); menu.Items.GetSubmenu("&Window", 900); var help = menu.Items.GetSubmenu("&Help", 1000); if (Generator.IsMac) { // have a nice OS X style menu var main = menu.Items.GetSubmenu(Application.Instance.Name, 0); main.Items.Add(about, 0); main.Items.Add(quit, 1000); } else { // windows/gtk style window file.Items.Add(quit); help.Items.Add(about); } // optional, removes empty submenus and duplicate separators menu.Items.Trim(); Menu = menu; #endif // generate and set the toolbar var toolBar = new ToolBar(); toolBar.Items.Add(quit); toolBar.Items.Add(new ButtonToolItem(about)); ToolBar = toolBar; }
Control PageRange() { var layout = new DynamicLayout { DefaultSpacing = new Size(5, 5), Padding = new Padding(10) }; layout.AddRow(new Label { Text = "Print Selection" }, TableLayout.AutoSized(PrintSelection())); layout.BeginHorizontal(); layout.Add(new Label { Text = "Selected Start" }); layout.AddSeparateRow().Add(SelectedStart(), new Label { Text = "to" }, SelectedEnd()); layout.EndHorizontal(); layout.Add(null); return new GroupBox { Text = "Page Range", Content = layout }; }