Example #1
0
        Control Default()
        {
            var layout = new DynamicLayout {
                DefaultSpacing = new Size(5, 5)
            };

            var first = new RadioButton {
                Text = "First"
            };
            var second = new RadioButton(first)
            {
                Text = "Second"
            };
            var third = new RadioButton(first)
            {
                Text = "Third"
            };

            layout.AddRow(first, second, third);
            LogEvents(first);
            LogEvents(second);
            LogEvents(third);

            return(layout);
        }
Example #2
0
        public static TextArea CreateAndAddMultilineMonoSpaceTextBoxRow(this DynamicLayout container, String text, int height, bool ro, Action <TextArea, EventArgs> command)
        {
            var edittext = new TextArea {
                Text = text, ReadOnly = ro, Height = height
            };

            if (GlobalSettings.Settings.RunningPlatform() == GlobalSettings.Settings.Platform.Mac)
            {
                edittext.Font = new Font("Menlo", GlobalSettings.Settings.ResultsReportFontSize);
            }
            else
            {
                edittext.Font = Fonts.Monospace(GlobalSettings.Settings.ResultsReportFontSize);
            }

            if (command != null)
            {
                edittext.TextChanged += (sender, e) => command.Invoke((TextArea)sender, e);
            }

            var tr = new TableRow(edittext);

            container.AddRow(tr);
            container.CreateAndAddEmptySpace();

            return(edittext);
        }
Example #3
0
        void Init()
        {
            textBox_url              = new TextBox();
            textBox_url.TextChanged += textBox_url_TextChanged;
            textBox_url.Text         = "http://";

            textBox_save      = new TextBox();
            textBox_save.Text = _saveDir;

            button_wget = new Button
            {
                Text = "Wget"
            };
            button_wget.Click += button_wget_Click;

            var layout = new DynamicLayout {
                Padding = new Padding(20, 10), Spacing = new Size(5, 5)
            };

            var layout_left = new DynamicLayout();

            layout_left.AddColumn(textBox_url, textBox_save);
            layout.AddRow(layout_left, button_wget);

            Content = layout;
        }
Example #4
0
        public TextureBrushesSection()
        {
            var layout = new DynamicLayout();

            for (var i = 0; i < 10; ++i)
            {
                var w   = image.Size.Width / 3;               // same as height
                var img = image;
                if (i > 0)
                {
                    img = img.Clone(new Rectangle((i - 1) % 3 * w, (i - 1) / 3 * w, w, w));
                }

                var brush    = new TextureBrush(img);
                var drawable = new Drawable {
                    Size = image.Size * 2
                };

                drawable.Paint += (s, e) => {
                    var destRect = new RectangleF(new PointF(100, 100), image.Size);
                    var temp     = brush.Transform;                 // save state
                    brush.Transform = Matrix.FromRotation(90);
                    e.Graphics.TranslateTransform(destRect.Location);
                    e.Graphics.FillRectangle(brush, new RectangleF(destRect.Size));
                    brush.Transform = temp;
                };
                layout.AddRow(drawable);
            }
            layout.Add(null);
            Content = layout;
        }
        private TabPage CreateFromFileTab()
        {
            var fileTab = new TabPage {
                Text = FromFileTabName
            };
            var fileLayout = new DynamicLayout(fileTab);

            var browseLabel = new Label {
                Text = "Select Clippings File: ", Size = new Size(150, 20)
            };

            _fileSelectTextBox = new TextBox {
                Size = new Size(480, 20)
            };

            var browseButton = new Button {
                Text = "Browse"
            };

            browseButton.Click += browseButton_Click;

            fileLayout.BeginVertical();
            fileLayout.BeginHorizontal();
            fileLayout.AddRow(browseLabel, _fileSelectTextBox, browseButton);
            fileLayout.EndHorizontal();
            fileLayout.EndVertical();

            return(fileTab);
        }
Example #6
0
        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;
        }
        public MainForm()
        {
            this.ClientSize = new Size(800, 600);
            this.Title      = "Kindle Clippings Parser";
            this.Icon       = Common.BookIcon;

            CreateInputSection();
            CreateOutputSection();

            var layout = new DynamicLayout(this);

            layout.AddRow(_inputSection);
            layout.AddRow(_outputSection);

            PopulateDevices();
        }
        private void CreateInputSection()
        {
            var inGrp = new GroupBox {
                Text = "Input"
            };

            var layout = new DynamicLayout(inGrp);

            layout.BeginVertical();

            _tabGroup = new TabControl();

            var fileTab   = CreateFromFileTab();
            var deviceTab = CreateFromDeviceTab();

            _tabGroup.TabPages.Add(deviceTab);
            _tabGroup.TabPages.Add(fileTab);

            layout.AddRow(_tabGroup);

            var parseButton = new Button {
                Text = "Parse"
            };

            parseButton.Click += parseButton_Click;

            layout.BeginHorizontal();
            layout.AddCentered(parseButton);
            layout.EndHorizontal();

            layout.EndVertical();

            _inputSection = inGrp;
        }
Example #9
0
        private void InitializeComponent()
        {
            layout = new DynamicLayout();

            panelLabel         = new Panel();
            panelLabel.Padding = new Padding(5);

            stack             = new StackLayout();
            stack.Orientation = Orientation.Horizontal;

            label      = new Label();
            label.Font = new Font(label.Font.Family, label.Font.Size - 1, FontStyle.Bold);
            stack.Items.Add(new StackLayoutItem(label, true));

            imageSettings         = new ImageView();
            imageSettings.Image   = Global.GetEtoIcon("Icons.Settings.png");
            imageSettings.Visible = false;
            stack.Items.Add(new StackLayoutItem(imageSettings, false));

            panelLabel.Content = stack;

            layout.AddRow(panelLabel);

            Content = layout;

            imageSettings.MouseDown += ImageSettings_MouseDown;
        }
Example #10
0
        private TabPage CreateFromDeviceTab()
        {
            var deviceTab = new TabPage {
                Text = FromDeviceTabName
            };
            var deviceLayout = new DynamicLayout(deviceTab);

            var selectDeviceLabel = new Label {
                Text = "Select Device: ", Size = new Size(150, 20)
            };

            _deviceSelectBox = new ComboBox {
                Size = new Size(480, 20)
            };

            var refreshButton = new Button {
                Text = "Refresh"
            };

            refreshButton.Click += refreshButton_Click;

            deviceLayout.BeginVertical();
            deviceLayout.BeginHorizontal();
            deviceLayout.AddRow(selectDeviceLabel, _deviceSelectBox, refreshButton);
            deviceLayout.EndHorizontal();
            deviceLayout.EndVertical();

            return(deviceTab);
        }
Example #11
0
        public FlagsPad(CharacterHandler handler)
        {
            this.Handler = handler;
#if DESKTOP
            //this.MinimumSize = new Size (200, 0);
#endif

            handler.InsertModeChanged += new EventHandler <EventArgs>(delegate
            {
                Update();
            }).MakeWeak(e => handler.InsertModeChanged -= e);

            handler.CurrentPage.FontChanged += new EventHandler <EventArgs>(delegate
            {
                Update();
            }).MakeWeak(e => handler.CurrentPage.FontChanged -= e);


            var layout = new DynamicLayout {
                Padding = new Padding(0, 5)
            };

            layout.AddRow(FontLabel(), InsertLabel());

            Content = layout;

            Update();
        }
Example #12
0
        public ColourEditor(CharacterHandler handler)
        {
            this.handler = handler;
            Title        = "Palette Editor";
#if DESKTOP
            Resizable = true;
#endif
            this.Palette = handler.CurrentPage.Palette.Clone();
            var layout = new DynamicLayout();

            layout.Add(new Label
            {
                Text            = "Double click a colour to change it. Note that most formats only support up to 16 colours, except for Tundra and Ansi format",
                Wrap            = WrapMode.Word,
                HorizontalAlign = HorizontalAlign.Center,
                VerticalAlign   = VerticalAlign.Middle,
                Size            = new Size(50, 50)
            });

            layout.BeginVertical(xscale: true, yscale: true);
            layout.BeginHorizontal();
            layout.Add(ColoursHolder(), true);
            layout.Add(ColourButtons());
            layout.EndHorizontal();
            layout.EndVertical();

            layout.BeginVertical();
            layout.AddRow(SetDefaultButton(), null, CancelButton(), OkButton());
            layout.EndVertical();

            Content = layout;

            UpdateColours();
        }
Example #13
0
        public GridViewSection()
        {
            var layout = new DynamicLayout(this);

            layout.AddRow(new Label {
                Text = "Default"
            }, Default());
            layout.AddRow(new Label {
                Text = "No Header,\nNon-Editable"
            }, NoHeader());
#if DESKTOP
            layout.AddRow(new Label {
                Text = "Context Menu\n&& Multi-Select"
            }, WithContextMenu());
#endif
        }
Example #14
0
        public DropDownSection()
        {
            var layout = new DynamicLayout {
                DefaultSpacing = new Size(5, 5), Padding = new Padding(10)
            };

            layout.AddRow("Default", Default(), null);

            layout.AddRow("Set Initial Value", TableLayout.AutoSized(SetInitialValue()));

            layout.AddRow("EnumDropDown<Key>", TableLayout.AutoSized(EnumCombo()));

            layout.Add(null, null, true);

            Content = layout;
        }
Example #15
0
        public static Label CreateAndAddThreeLabelsRow(this DynamicLayout container, String text1, String text2, String text3)
        {
            var txt = new Label {
                Text = text1, VerticalAlignment = VerticalAlignment.Center
            };

            txt.Font = new Font(SystemFont.Default, GetEditorFontSize());
            var txt2 = new Label {
                Text = text2, Width = (int)(sf * 140), VerticalAlignment = VerticalAlignment.Center, TextAlignment = TextAlignment.Right
            };

            txt2.Font = new Font(SystemFont.Default, GetEditorFontSize());
            var txt3 = new Label {
                Text = text3, Width = (int)(sf * 140), VerticalAlignment = VerticalAlignment.Center
            };

            txt3.Font = new Font(SystemFont.Default, GetEditorFontSize());

            var tr = new TableRow(txt, null, txt2, new Label {
                Text = " "
            }, txt3);

            container.AddRow(tr);
            container.CreateAndAddEmptySpace();

            return(txt2);
        }
Example #16
0
        public static TextBox CreateAndAddDoubleTextBoxRow(this DynamicLayout container, String numberformat, String text, String currval1, Double currval2, Action <TextBox, EventArgs> command, Action <TextBox, EventArgs> command2)
        {
            var txt = new Label {
                Text = text, VerticalAlignment = VerticalAlignment.Center
            };
            var edittext = new TextBox {
                Text = currval1, Width = 100
            };
            var edittext2 = new TextBox {
                Text = currval2.ToString(numberformat), Width = 100
            };

            if (command != null)
            {
                edittext.TextChanged += (sender, e) => command.Invoke((TextBox)sender, e);
            }
            if (command2 != null)
            {
                edittext2.TextChanged += (sender, e) => command2.Invoke((TextBox)sender, e);
            }

            var tr = new TableRow(txt, null, edittext, edittext2);

            container.AddRow(tr);
            container.CreateAndAddEmptySpace();

            return(edittext2);
        }
        public ChannelListDialog(Server server)
        {
            this.ClientSize = new Size(600, 400);
            this.Resizable  = true;
            this.Title      = "Channel List";
            this.server     = server;

            grid = new GridView {
                AllowMultipleSelection = false
            };
            grid.MouseDoubleClick += HandleMouseDoubleClick;
            grid.Columns.Add(new GridColumn {
                DataCell = new TextBoxCell("Name"), HeaderText = "Channel", Width = 150, AutoSize = false
            });
            grid.Columns.Add(new GridColumn {
                DataCell = new TextBoxCell("UserCount"), HeaderText = "Users", Width = 60, AutoSize = false
            });
            grid.Columns.Add(new GridColumn {
                DataCell = new TextBoxCell("Topic"), HeaderText = "Topic", Width = 350, AutoSize = false
            });

            var layout = new DynamicLayout();

            layout.Add(grid, yscale: true);
            layout.BeginVertical();
            layout.AddRow(null, this.CancelButton(), this.OkButton("Join Channel", CanJoin));
            layout.EndVertical();

            Content = layout;
        }
Example #18
0
        private DynamicLayout GenGeneralTab()
        {
            var layout = new DynamicLayout();

            layout.Width = 400;

            layout.DefaultSpacing = new Size(4, 4);
            layout.DefaultPadding = new Padding(4);


            layout.AddRow(GenGeneralPanel());
            layout.AddRow(GenRadiancePanel());
            layout.AddRow(GenEnergyPanel());
            layout.Add(null);
            return(layout);
        }
Example #19
0
        public static DropDown CreateAndAddDropDownRow(this DynamicLayout container, String text, List <String> options, int position, Action <DropDown, EventArgs> command)
        {
            var txt = new Label {
                Text = text, VerticalAlignment = VerticalAlignment.Center
            };
            var drop = new DropDown();

            if (!Eto.Forms.Application.Instance.Platform.IsGtk)
            {
                drop.Width = 200;
            }

            foreach (var item in options)
            {
                drop.Items.Add(new ListItem()
                {
                    Key = item, Text = item
                });
            }

            drop.SelectedIndex = position;

            if (command != null)
            {
                drop.SelectedIndexChanged += (sender, e) => command.Invoke((DropDown)sender, e);
            }

            var tr = new TableRow(txt, null, drop);

            container.AddRow(tr);
            container.CreateAndAddEmptySpace();

            return(drop);
        }
Example #20
0
        public static Button CreateAndAddButtonRow(this DynamicLayout container, String buttonlabel, String imageResID, Action <Button, EventArgs> command)
        {
            var btn = new Button {
                Text = buttonlabel
            };

            btn.Font = new Font(SystemFont.Default, GetEditorFontSize());
            if (GlobalSettings.Settings.EditorTextBoxFixedSize)
            {
                btn.Width = 140;
            }

            if (imageResID != null)
            {
                btn.Image = new Bitmap(Eto.Drawing.Bitmap.FromResource(imageResID), 22, 22, ImageInterpolation.Default);
            }

            if (command != null)
            {
                btn.Click += (sender, e) => command.Invoke((Button)sender, e);
            }

            var tr = new TableRow(btn);

            container.AddRow(tr);
            container.CreateAndAddEmptySpace();

            return(btn);
        }
Example #21
0
        Control Default()
        {
            var control = new ListBox
            {
                Size = new Size(100, 150)
            };

            LogEvents(control);

            for (int i = 0; i < 10; i++)
            {
                control.Items.Add(new ListItem {
                    Text = "Item " + i
                });
            }

            var layout = new DynamicLayout();

            layout.Add(control);
            layout.BeginVertical();
            layout.AddRow(null, AddRowsButton(control), RemoveRowsButton(control), ClearButton(control), null);
            layout.EndVertical();

            return(layout);
        }
Example #22
0
        public static ListBox CreateAndAddListBoxRow(this DynamicLayout container, int height, String[] listitems, Action <ListBox, EventArgs> command)
        {
            var lbox = new ListBox {
                Height = height
            };

            lbox.Font = new Font(SystemFont.Default, GetEditorFontSize());

            foreach (var item in listitems)
            {
                lbox.Items.Add(item);
            }

            if (command != null)
            {
                lbox.SelectedIndexChanged += (sender, e) => command.Invoke((ListBox)sender, e);
            }

            var tr = new TableRow(lbox);

            container.AddRow(tr);
            container.CreateAndAddEmptySpace();

            return(lbox);
        }
Example #23
0
        public static TextBox CreateAndAddStringEditorRow2(this DynamicLayout container, String text, String placeholder, String currval, Action <TextBox, EventArgs> command)
        {
            var txt = new Label {
                Text = text, VerticalAlignment = VerticalAlignment.Center
            };

            txt.Font = new Font(SystemFont.Default, GetEditorFontSize());
            var edittext = new TextBox {
                Text = currval, PlaceholderText = placeholder
            };

            edittext.Font = new Font(SystemFont.Default, GetEditorFontSize());

            if (command != null)
            {
                edittext.TextChanged += (sender, e) => command.Invoke((TextBox)sender, e);
            }

            var tr = new TableRow(txt, GetPlaceHolderLabel(), edittext);

            container.AddRow(tr);
            container.CreateAndAddEmptySpace();

            return(edittext);
        }
Example #24
0
        public static NumericStepper CreateAndAddNumericEditorRow(this DynamicLayout container, String text, double currval, double minval, double maxval, int decimalplaces, Action <NumericStepper, EventArgs> command)
        {
            var txt = new Label {
                Text = text, VerticalAlignment = VerticalAlignment.Center
            };

            txt.Font = new Font(SystemFont.Default, GetEditorFontSize());
            var editor = new NumericStepper {
                Value = currval, DecimalPlaces = decimalplaces, MinValue = minval, MaxValue = maxval
            };

            editor.Font = new Font(SystemFont.Default, GetEditorFontSize());
            if (GlobalSettings.Settings.EditorTextBoxFixedSize)
            {
                editor.Width = 140;
            }

            if (command != null)
            {
                editor.ValueChanged += (sender, e) => command.Invoke((NumericStepper)sender, e);
            }

            var tr = new TableRow(txt, null, editor);

            container.AddRow(tr);
            container.CreateAndAddEmptySpace();

            return(editor);
        }
Example #25
0
        public static TextBox CreateAndAddTextBoxRow2(this DynamicLayout container, String numberformat, String text, Double currval, Action <TextBox, EventArgs> command)
        {
            var txt = new Label {
                Text = text, VerticalAlignment = VerticalAlignment.Center
            };

            txt.Font = new Font(SystemFont.Default, GetEditorFontSize());
            var edittext = new TextBox {
                Text = currval.ToString(numberformat), Style = "textbox-rightalign"
            };

            edittext.Font = new Font(SystemFont.Default, GetEditorFontSize());
            if (GlobalSettings.Settings.EditorTextBoxFixedSize)
            {
                edittext.Width = 140;
            }

            if (command != null)
            {
                edittext.TextChanged += (sender, e) => command.Invoke((TextBox)sender, e);
            }

            var tr = new TableRow(txt, edittext);

            container.AddRow(tr);
            container.CreateAndAddEmptySpace();

            return(edittext);
        }
Example #26
0
        public static ColorPicker CreateAndAddColorPickerRow(this DynamicLayout container, String text, Color currval, Action <ColorPicker, EventArgs> command)
        {
            var txt = new Label {
                Text = text, VerticalAlignment = VerticalAlignment.Center
            };

            txt.Font = new Font(SystemFont.Default, GetEditorFontSize());
            var editor = new ColorPicker {
                Value = currval
            };

            if (GlobalSettings.Settings.EditorTextBoxFixedSize)
            {
                editor.Width = 140;
            }

            if (command != null)
            {
                editor.ValueChanged += (sender, e) => command.Invoke((ColorPicker)sender, e);
            }

            var tr = new TableRow(txt, null, editor);

            container.AddRow(tr);
            container.CreateAndAddEmptySpace();

            return(editor);
        }
Example #27
0
        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
            });
        }
Example #28
0
        public BrushPad(Tools.Brush tool)
        {
            this.tool = tool;
            var page = Handler.CurrentPage;

            page.FontChanged += new EventHandler <EventArgs>(delegate
            {
                Update();
            }).MakeWeak(e => page.FontChanged -= e);
            Handler.DrawAttributeChanged      += new EventHandler <EventArgs>(delegate
            {
                Update();
            }).MakeWeak(e => Handler.DrawAttributeChanged -= e);

            var layout = new DynamicLayout {
                Padding = Padding.Empty, Spacing = Size.Empty
            };

            layout.Add(new Label {
                Text = "Brush", HorizontalAlign = HorizontalAlign.Center, Font = new Font(SystemFont.Default, 7)
            });

            layout.AddCentered(GradientPreview(), Padding.Empty, Size.Empty);

            layout.BeginVertical(new Padding(2, 5), Size.Empty);
            layout.AddRow(UpButton(), null, DownButton());
            layout.EndVertical();
            layout.AddCentered(SelectButton(), Padding.Empty, Size.Empty);

            Content = layout;

            this.Update();
        }
        public Dialog_BoundaryCondition_Outdoors(HB.Outdoors boundaryCondition)
        {
            try
            {
                Padding     = new Padding(5);
                Resizable   = true;
                Title       = $"Energy Boundary Condition - {DialogHelper.PluginName}";
                WindowStyle = WindowStyle.Default;
                MinimumSize = new Size(450, 300);
                this.Icon   = DialogHelper.HoneybeeIcon;

                var layout = new DynamicLayout()
                {
                    Padding = new Padding(15)
                };


                var bcLayout = PanelHelper.CreateOutdoorLayout(boundaryCondition);
                layout.AddRow(bcLayout);

                DefaultButton = new Button {
                    Text = "OK"
                };
                DefaultButton.Click += (sender, e) => Close(boundaryCondition);

                AbortButton = new Button {
                    Text = "Cancel"
                };
                AbortButton.Click += (sender, e) => Close();

                var buttons = new TableLayout
                {
                    Padding = new Padding(5, 10, 5, 5),
                    Spacing = new Size(10, 10),
                    Rows    = { new TableRow(null, this.DefaultButton, this.AbortButton, null) }
                };

                layout.AddSeparateRow(buttons);
                layout.AddRow(null);
                //Create layout
                Content = layout;
            }
            catch (Exception e)
            {
                throw e;
            }
        }
Example #30
0
        void Init()
        {
            _tbxShellData = new TextArea {
                Size = new Size(-1, 200)
            };
            _tbxMsg             = new TextBox();
            _btnShowMsgInStatus = new Button {
                Text = "Show Msg In Status", Width = 150
            };
            _btnShowMsgInStatus.Click += btn_showMsgInStatus_Click;
            _btnShowMessageBox         = new Button {
                Text = "Show Msg In Message", Width = 150
            };
            _btnShowMessageBox.Click += btn_showMessageBox_Click;
            _btnCreateNewTabPage      = new Button {
                Text = "Create New TabPage", Width = 150
            };
            _btnCreateNewTabPage.Click += btn_createNewTabPage_Click;

            // Test
            var btnTest = new Button {
                Text = "Test", Width = 150
            };

            btnTest.Click += btnTest_Click;

            var layout = new DynamicLayout {
                Padding = new Padding(10, 10), Size = new Size(10, 10)
            };

            layout.AddRow(new Label()
            {
                Text = "ShellData"
            });
            layout.AddRow(_tbxShellData);
            layout.AddSeparateRow(new Label()
            {
                Text = "Msg", VerticalAlign = VerticalAlign.Middle
            }, _tbxMsg, null);
            layout.AddAutoSized(_btnShowMsgInStatus);
            layout.AddAutoSized(_btnShowMessageBox);
            layout.AddAutoSized(_btnCreateNewTabPage);
            layout.AddAutoSized(btnTest);
            layout.Add(null);

            this.Content = layout;
        }