Esempio n. 1
0
 public PanelTabBar()
 {
     Layout  = new HBoxLayout();
     Padding = new Thickness {
         Bottom = 10f
     };
 }
Esempio n. 2
0
        private void init()
        {
            HBoxLayout _layoutTop = new HBoxLayout();

            AddElementToRootLayout(_layoutTop);

            groupBoxConfigDB.Header  = "Base de données";
            groupBoxConfigDB.Content = _layoutFormConfigDB;
            _layoutTop.Add(groupBoxConfigDB);

            _layoutFormConfigDB.Add("ip", ip, 25);
            _layoutFormConfigDB.Add("Nom utilisateur", userName, 25);
            _layoutFormConfigDB.Add("Mot de pass", pass, 25);
            _layoutFormConfigDB.Add("Nom DB", dbName, 25);

            dbName.Text = "cfl";

            HBoxLayout _layoutBottom = new HBoxLayout();

            AddElementToRootLayout(_layoutBottom);

            // buttons

            VBoxLayout __layoutLeft = new VBoxLayout();

            _layoutBottom.Add(__layoutLeft);

            // textbox_sql

            textbox_sql = new TextBox();
            textbox_sql.AcceptsReturn = true;

            _layoutBottom.Add(textbox_sql);
        }
Esempio n. 3
0
            public ProgressBarField()
            {
                Layout = new HBoxLayout {
                    Spacing = 6
                };
                MinMaxHeight = Theme.Metrics.DefaultButtonSize.Y;

                var bar  = new ThemedFrame();
                var rect = new Widget();

                rect.CompoundPresenter.Add(new WidgetFlatFillPresenter(Lime.Theme.Colors.SelectedBorder));
                rect.Tasks.AddLoop(() => {
                    rect.Size = new Vector2(bar.Width * Mathf.Clamp((float)CurrentPosition / MaxPosition, 0, 1), bar.ContentHeight);
                });
                bar.AddNode(rect);

                textFieldA = new ThemedSimpleText {
                    VAlignment = VAlignment.Center,
                    HAlignment = HAlignment.Center,
                };
                textFieldB = new ThemedSimpleText {
                    VAlignment = VAlignment.Center,
                    HAlignment = HAlignment.Center,
                };

                AddNode(bar);
                AddNode(textFieldA);
                AddNode(textFieldB);

                HideAndClear();
            }
Esempio n. 4
0
            public RulerRowView(Ruler ruler, Action onDelete, Action onEdit)
            {
                ThemedDeleteButton deleteButton;
                ThemedSimpleText   label;

                Layout          = new HBoxLayout();
                Nodes.Add(label = new ThemedSimpleText {
                    Padding = new Thickness {
                        Left = 10
                    },
                });
                this.AddChangeWatcher(() => ruler.Name, (name) => label.Text = name);
                Nodes.Add(new Widget());
                Nodes.Add(editButton = new ToolbarButton()
                {
                    Anchors       = Anchors.Right,
                    LayoutCell    = new LayoutCell(Alignment.LeftTop),
                    Texture       = IconPool.GetTexture("Tools.Edit"),
                    Highlightable = false,
                });
                Nodes.Add(deleteButton = new ThemedDeleteButton {
                    Anchors    = Anchors.Right,
                    LayoutCell = new LayoutCell(Alignment.LeftTop)
                });
                deleteButton.Clicked = onDelete;
                editButton.Clicked   = onEdit;
                MinMaxHeight         = RowHeight;
            }
Esempio n. 5
0
            public MarkerRow(
                Model3DAttachment.MarkerData marker,
                ObservableCollection <Model3DAttachment.MarkerData> markers) : base(marker, markers)
            {
                Layout = new HBoxLayout();
                var markerIdPropEditor = new StringPropertyEditor(
                    Decorate(new PropertyEditorParams(
                                 Header,
                                 Source.Marker,
                                 nameof(Marker.Id))));

                markerIdPropEditor.ContainerWidget.MinMaxWidth = AttachmentMetrics.EditorWidth;

                new IntPropertyEditor(
                    Decorate(new PropertyEditorParams(
                                 Header,
                                 Source.Marker,
                                 nameof(Marker.Frame))));

                var actionPropEditor = new EnumPropertyEditor <MarkerAction>(
                    Decorate(new PropertyEditorParams(
                                 Header,
                                 Source.Marker,
                                 nameof(Marker.Action))));

                actionPropEditor.ContainerWidget.MinMaxWidth = AttachmentMetrics.ControlWidth;
                var jumpToPropEditor = new ThemedComboBox {
                    LayoutCell = new LayoutCell(Alignment.Center)
                };
                var previousMarkerId = Source.Marker.Id;

                jumpToPropEditor.Changed += args => {
                    if ((string)args.Value != Source.Marker.JumpTo)
                    {
                        history.DoTransaction(() => Core.Operations.SetProperty.Perform(Source.Marker, nameof(Marker.JumpTo), args.Value));
                    }
                };
                Header.AddNode(jumpToPropEditor);
                jumpToPropEditor.Clicked += () => {
                    jumpToPropEditor.Items.Clear();
                    foreach (var item in markers)
                    {
                        jumpToPropEditor.Items.Add(new CommonDropDownList.Item(item.Marker.Id));
                    }
                };
                jumpToPropEditor.AddChangeWatcher(() => Source.Marker.JumpTo, v => jumpToPropEditor.Text = v);
                jumpToPropEditor.AddChangeWatcher(() => Source.Marker.Id, v => {
                    foreach (var m in markers.Where(md => md.Marker.JumpTo == previousMarkerId).Select(md => md.Marker))
                    {
                        m.JumpTo = v;
                    }
                    previousMarkerId = v;
                });
                jumpToPropEditor.Value       = Source.Marker.JumpTo;
                jumpToPropEditor.MinMaxWidth = AttachmentMetrics.ControlWidth;
                Header.AddNode(new BlendingCell(Source, nameof(Model3DAttachment.MarkerData.Blending)));
            }
Esempio n. 6
0
        private void init()
        {
            HBoxLayout __layout = new HBoxLayout();

            __layout.Add(__label);
            __layout.Add(__textBox);
            __textBox.TextChanged += TextBox_TextChanged;

            Header = __layout;
        }
Esempio n. 7
0
 public Toolbar()
 {
     Padding      = new Thickness(4);
     MinMaxHeight = Metrics.ToolbarHeight;
     MinWidth     = 50;        // TimelineMetrics.ToolbarMinWidth;
     Presenter    = new SyncDelegatePresenter <Widget>(Render);
     Layout       = new HBoxLayout {
         Spacing = 2, DefaultCell = new DefaultLayoutCell(Alignment.Center)
     };
 }
Esempio n. 8
0
 public PathArrowButton(Func <string, bool> openPath, string path = null) : base()
 {
     this.path      = path;
     this.openPath  = openPath;
     MinMaxHeight   = 20;
     Presenter      = new PathButtonPresenter();
     base.Presenter = Presenter;
     if (path == null)
     {
         Updating += (float delta) => {
             var prevState = State;
             if (Expanded)
             {
                 State = PathBarButtonState.Press;
             }
             else
             {
                 if (IsMouseOverThisOrDescendant())
                 {
                     if (WasClicked())
                     {
                         State = PathBarButtonState.Press;
                     }
                     else
                     {
                         State = PathBarButtonState.Hover;
                     }
                 }
                 else
                 {
                     State = PathBarButtonState.Normal;
                 }
             }
             if (prevState != State)
             {
                 Presenter.SetState(State);
             }
         };
     }
     Gestures.Add(new ClickGesture(0, FlipState));
     Layout         = new HBoxLayout();
     MinMaxSize     = new Vector2(11, 20);
     Nodes.Add(icon = new Image {
         LayoutCell = new LayoutCell {
             Alignment = new Alignment {
                 X = HAlignment.Center, Y = VAlignment.Center
             }
         },
         MinMaxSize = new Vector2(11, 6),
         Texture    = IconPool.GetTexture("Filesystem.PathSeparatorCollapsed")
     });
     Expanded = false;
 }
Esempio n. 9
0
        public PathBar(Func <string, bool> openPath, FilesystemModel filesystemModel)
        {
            this.filesystemModel = filesystemModel;
            this.openPath        = openPath;
            Layout     = new HBoxLayout();
            LayoutCell = new LayoutCell(Alignment.LeftCenter);
            Padding    = new Thickness(1);

            this.AddChangeWatcher(() => filesystemModel.CurrentPath, (p) => {
                UpdatePathBar();
            });
        }
Esempio n. 10
0
        public FilesystemItem(string path)
        {
            FilesystemPath = path;
            this.Input.AcceptMouseThroughDescendants = true;
            SimpleText text = null;

            MinMaxSize = new Vector2(ItemWidth, IconSize);
            Layout     = new HBoxLayout {
                Spacing = Spacing
            };
            Padding       = new Thickness(2);
            HitTestTarget = true;
            var isRoot = false;

            if (new DirectoryInfo(FilesystemPath).Parent == null)
            {
                isRoot = true;
            }

            Nodes.AddRange(
                new Image {
                LayoutCell = new LayoutCell {
                    Stretch   = Vector2.Zero,
                    Alignment = new Alignment {
                        X = HAlignment.Right, Y = VAlignment.Center
                    }
                },
                MinMaxSize = new Vector2(IconSize, IconSize),
                Texture    = SystemIconTextureProvider.Instance.GetTexture(FilesystemPath),
            },
                (text = new ThemedSimpleText {
                ForceUncutText = false,
                OverflowMode = TextOverflowMode.Ellipsis,
                Text =
                    isRoot ?
                    FilesystemPath.Remove(FilesystemPath.Length - 1) :
                    Path.GetFileName(FilesystemPath),
                LayoutCell = new LayoutCell {
                    Alignment = new Alignment {
                        X = HAlignment.Right, Y = VAlignment.Bottom
                    }
                }
            }),
                new Widget {
                LayoutCell = new LayoutCell {
                    StretchX = float.MaxValue
                },
                MinWidth      = 0,
                HitTestTarget = true
            }
                );
            text.Width = text.MinMaxWidth = Mathf.Min(ItemWidth - (IconSize + ItemPadding * 2 + Spacing + 2), text.MeasureUncutText().X);
        }
Esempio n. 11
0
 public CheckBoxWithLabel(string text)
 {
     Layout = new HBoxLayout {
         Spacing = 8
     };
     AddNode(CheckBox = new ThemedCheckBox());
     Label            = new ThemedSimpleText(text)
     {
         HitTestTarget = true,
         Clicked       = CheckBox.Toggle
     };
     AddNode(Label);
 }
Esempio n. 12
0
            public NodeRow(Model3DAttachment.NodeData source, ObservableCollection <Model3DAttachment.NodeData> sourceCollection) : base(source, sourceCollection)
            {
                Layout  = new HBoxLayout();
                Padding = new Thickness(AttachmentMetrics.Spacing);
                var nodeIdPropEditor = new StringPropertyEditor(
                    Decorate(new PropertyEditorParams(
                                 Header,
                                 source,
                                 nameof(Model3DAttachment.NodeData.Id))));

                nodeIdPropEditor.ContainerWidget.MinMaxWidth = AttachmentMetrics.EditorWidth;
                Presenter = Presenters.StripePresenter;
            }
Esempio n. 13
0
            public MarkerRow(
                Model3DAttachment.MarkerData marker,
                ObservableCollection <Model3DAttachment.MarkerData> markers) : base(marker, markers)
            {
                Layout = new HBoxLayout();
                var markerIdPropEditor = new StringPropertyEditor(
                    new PropertyEditorParams(
                        Header,
                        Source.Marker,
                        nameof(Marker.Id))
                {
                    ShowLabel = false
                });

                markerIdPropEditor.ContainerWidget.MinMaxWidth = AttachmentMetrics.EditorWidth;

                var framePropEditor = new IntPropertyEditor(
                    new PropertyEditorParams(
                        Header,
                        Source.Marker,
                        nameof(Marker.Frame))
                {
                    ShowLabel = false
                });

                var actionPropEditor = new EnumPropertyEditor <MarkerAction>(
                    new PropertyEditorParams(
                        Header,
                        Source.Marker,
                        nameof(Marker.Action))
                {
                    ShowLabel = false
                });

                actionPropEditor.ContainerWidget.MinMaxWidth = AttachmentMetrics.ControlWidth;

                var jumpToPropEditor = new StringPropertyEditor(
                    new PropertyEditorParams(
                        Header,
                        Source.Marker,
                        nameof(Marker.JumpTo))
                {
                    ShowLabel = false
                });

                jumpToPropEditor.ContainerWidget.MinMaxWidth = AttachmentMetrics.ControlWidth;
                Header.AddNode(new BlendingCell(Source, nameof(Model3DAttachment.MarkerData.Blending)));
            }
Esempio n. 14
0
 public RulerRowView(RulerData overlay, IList <RulerData> overlays) : base()
 {
     Layout          = new HBoxLayout();
     Nodes.Add(Label = new ThemedSimpleText {
         Padding = new Thickness {
             Left = 10
         },
     });
     this.AddChangeWatcher(() => overlay.Name, (name) => Label.Text = name);
     Nodes.Add(new Widget());
     Nodes.Add(deleteButton = new ThemedDeleteButton {
         Anchors    = Anchors.Right,
         LayoutCell = new LayoutCell(Alignment.LeftTop)
     });
     CompoundPresenter.Add(StripePresenter);
     deleteButton.Clicked = () => overlays.Remove(overlay);
     MinMaxHeight         = 20;
 }
Esempio n. 15
0
        private void init()
        {
            // compilation

            __compiler = new Compiler(true);
            __ctrl_userCommunication = new ctrl_userCommunication(__codeEditor);
            __codeEditor.init(__compiler, __syntaxTreeVisualizer, __ctrl_userCommunication);


            HBoxLayout _layoutMain = new HBoxLayout();

            AddElementToRootLayout(__layoutTop);
            AddElementToRootLayout(_layoutMain);

            // menu

            __layoutTop.Add(__buttonShowTree);
            __buttonShowTree.Click += buttonShowTreeClicked;
            __layoutTop.Add(__buttonEvaluate);
            __buttonEvaluate.Click += buttonEvaluateClicked;

            //

            __layoutLeft.MaxWidth = 120;

            _layoutMain.Add(__layoutLeft);
            _layoutMain.Add(__layoutCenter);
            _layoutMain.Add(__layoutRight);

            __layoutCenter.Add(__codeEditor);

            __syntaxTreeVisualizer.Visibility = Visibility.Hidden;
            __layoutRight.Add(__syntaxTreeVisualizer);

            __layoutRight.Add(__layoutTreesObjectEditors);

            HBoxLayout _layout_bottomCenter = new HBoxLayout()
            {
                MaxHeight = 200
            };

            _layout_bottomCenter.Add(__ctrl_userCommunication);
            __layoutCenter.Add(_layout_bottomCenter);
        }
Esempio n. 16
0
 public PluginCheckBoxWidget(OrangePluginPanel.PluginCheckBox pluginCheckBox)
 {
     Layout = new HBoxLayout {
         Spacing = 8
     };
     CheckBox          = new ThemedCheckBox();
     Checked           = pluginCheckBox.Active;
     CheckBox.Changed += args => {
         pluginCheckBox.Active = Checked;
         pluginCheckBox.Toogle();
     };
     AddNode(CheckBox);
     Label = new ThemedSimpleText(pluginCheckBox.Label)
     {
         HitTestTarget = true,
         Clicked       = CheckBox.Toggle
     };
     AddNode(Label);
 }
Esempio n. 17
0
        public FileChooser()
        {
            Layout = new HBoxLayout {
                Spacing = 4
            };
            editor = new ThemedEditBox {
                LayoutCell = new LayoutCell(Alignment.Center)
            };
            AddNode(editor);
            var button = new ThemedButton {
                Text        = "...",
                MinMaxWidth = 20,
                LayoutCell  = new LayoutCell(Alignment.Center)
            };

            AddNode(button);
            editor.Submitted += ChooseFileByUser;
            button.Clicked   += ButtonClicked;
        }
Esempio n. 18
0
        public FileChooser()
        {
            Layout = new HBoxLayout {
                Spacing = 4
            };
            editor = new ThemedEditBox {
                LayoutCell = new LayoutCell(Alignment.Center)
            };
            AddNode(editor);
            var button = new ThemedButton {
                Text        = "...",
                MinMaxWidth = 20,
                LayoutCell  = new LayoutCell(Alignment.Center)
            };

            AddNode(button);
            editor.Submitted += ChooseFileByUser;
            button.Clicked   += () => ShowOpenCitrusProjectDialog(ChooseFileByUser, InitialDirectory);
        }
Esempio n. 19
0
        public PathBarButton(Func <string, bool> openPath, string path) : base()
        {
            Layout        = new HBoxLayout();
            HitTestTarget = true;

            folderButton = new PathFolderButton(openPath, path);
            arrowButton  = new PathArrowButton(openPath, path);

            Nodes.Add(folderButton);
            Nodes.Add(arrowButton);

            Updating += (float delta) => {
                if (arrowButton.Expanded)
                {
                    state = PathBarButtonState.Press;
                }
                else
                {
                    if (IsMouseOverThisOrDescendant())
                    {
                        if (
                            folderButton.WasClicked() ||
                            arrowButton.WasClicked()
                            )
                        {
                            state = PathBarButtonState.Press;
                        }
                        else
                        {
                            state = PathBarButtonState.Hover;
                        }
                    }
                    else
                    {
                        state = PathBarButtonState.Normal;
                    }
                }
                folderButton.SetState(state);
                arrowButton.SetState(state);
            };
        }
Esempio n. 20
0
            public MaterialEffectRow(
                Model3DAttachment.MaterialEffect source,
                ObservableCollection <Model3DAttachment.MaterialEffect> sourceCollection) : base(source, sourceCollection)
            {
                Layout = new HBoxLayout();
                var namePropEditor = new StringPropertyEditor(
                    new PropertyEditorParams(
                        Header,
                        Source,
                        nameof(Model3DAttachment.MaterialEffect.Name))
                {
                    ShowLabel = false
                });

                namePropEditor.ContainerWidget.MinMaxWidth = AttachmentMetrics.ControlWidth;

                var materialNamePropEditor = new StringPropertyEditor(
                    new PropertyEditorParams(
                        Header,
                        Source,
                        nameof(Model3DAttachment.MaterialEffect.MaterialName))
                {
                    ShowLabel = false
                });

                materialNamePropEditor.ContainerWidget.MinMaxWidth = AttachmentMetrics.ControlWidth;

                var pathPropEditor = new StringPropertyEditor(
                    new PropertyEditorParams(
                        Header,
                        Source,
                        nameof(Model3DAttachment.MaterialEffect.Path))
                {
                    ShowLabel = false
                });

                pathPropEditor.ContainerWidget.MinMaxWidth = 2 * AttachmentMetrics.EditorWidth;

                Header.AddNode(new BlendingCell(Source, nameof(Model3DAttachment.MaterialEffect.Blending)));
            }
Esempio n. 21
0
 public BlendingCell(object obj, string propName)
 {
     Layout       = new HBoxLayout();
     MinMaxHeight = 20;
     Anchors      = Anchors.LeftRightTopBottom;
     property     = new Property <BlendingOption>(obj, propName);
     AddButton    = new ThemedAddButton {
         Anchors = Anchors.Center,
         Clicked = () =>
                   history.DoTransaction(
             () => Core.Operations.SetProperty.Perform(obj, propName, new BlendingOption())),
         LayoutCell = new LayoutCell {
             Alignment = Alignment.Center
         }
     };
     RemoveButton = new ThemedTabCloseButton {
         Clicked = () =>
                   history.DoTransaction(() => Core.Operations.SetProperty.Perform(obj, propName, null))
     };
     Nodes.Add(AddButton);
     AddChangeWatcher(() => property.Value, (v) => {
         Nodes.Clear();
         if (v == null)
         {
             Nodes.Add(AddButton);
         }
         else
         {
             new BlendingPropertyEditor(new PropertyEditorParams(this, obj, propName)
             {
                 ShowLabel      = false,
                 History        = history,
                 PropertySetter = SetProperty
             });
             Nodes.Add(RemoveButton);
         }
     });
 }
Esempio n. 22
0
            public MarkerBlendingRow(Model3DAttachment.MarkerBlendingData source, ObservableCollection <Model3DAttachment.MarkerBlendingData> sourceCollection) : base(source, sourceCollection)
            {
                Layout = new HBoxLayout();
                var destMarkerPropEditor = new StringPropertyEditor(
                    new PropertyEditorParams(
                        Header,
                        Source,
                        nameof(Model3DAttachment.MarkerBlendingData.DestMarkerId))
                {
                    ShowLabel = false
                });

                destMarkerPropEditor.ContainerWidget.MinMaxWidth = AttachmentMetrics.EditorWidth;

                var sourceMarkerPropEditor = new StringPropertyEditor(
                    new PropertyEditorParams(
                        Header,
                        Source,
                        nameof(Model3DAttachment.MarkerBlendingData.SourceMarkerId))
                {
                    ShowLabel = false
                });

                sourceMarkerPropEditor.ContainerWidget.MinMaxWidth = AttachmentMetrics.EditorWidth;

                var blendingOptionEditBox = new BlendingPropertyEditor(
                    new PropertyEditorParams(
                        Header,
                        Source,
                        nameof(Model3DAttachment.MarkerBlendingData.Blending))
                {
                    ShowLabel = false
                });

                blendingOptionEditBox.ContainerWidget.MinMaxWidth = AttachmentMetrics.ControlWidth;
            }
Esempio n. 23
0
 public Toolbar()
 {
     Padding      = new Thickness(4);
     MinMaxHeight = Metrics.ToolbarHeight;
     MinWidth     = 50;
     Presenter    = new SyncDelegatePresenter <Widget>(Render);
     Layout       = new HBoxLayout {
         Spacing     = 2,
         DefaultCell = new DefaultLayoutCell(Alignment.Center)
     };
     Nodes.AddRange(
         new Widget {
         Layout = new VBoxLayout(),
         Nodes  =
         {
             (Content        = new Widget     {
                 Layout      = new HBoxLayout {
                     Spacing = 2
                 }
             })
         }
     }
         );
 }
Esempio n. 24
0
            }; // class FontInfo

            // Constructor.
            public FontDialogForm(FontControl dialog)
            {
                // Record the parent for later access.
                this.dialog = dialog;

                // Create the initial font cache.
                fonts = new Hashtable();
                FontInfo info = new FontInfo(dialog.Font, false);

                fonts.Add(info, info);

                // Set the title.
                Text = "Title";

                // Construct the layout boxes for the font dialog.
                hbox               = new HBoxLayout();
                hbox.Dock          = DockStyle.Fill;
                vbox1              = new VBoxLayout();
                vbox2              = new VBoxLayout();
                vbox3              = new VBoxLayout();
                hbox2              = new HBoxLayout();
                grid               = new GridLayout(2, 3);
                grid.StretchColumn = 0;
                effects            = new System.Windows.Forms.GroupBox();
                effects.Text       = "Effects";
                effects.Width      = 80;
                hbox.Controls.Add(vbox1);
                hbox.Controls.Add(vbox2);
                hbox.StretchControl = vbox1;
                hbox2.Controls.Add(grid);
                hbox2.Controls.Add(effects);
                hbox2.StretchControl = grid;
                vbox1.Controls.Add(hbox2);
                vbox1.StretchControl = hbox2;
                effects.Controls.Add(vbox3);
                vbox3.Dock = DockStyle.Fill;

                // Create the main display area.
                Label label;

                label         = new Label();
                label.Text    = "Name";
                name          = new TextBox();
                name.ReadOnly = true;
                nameList      = new ListBox();
                grid.SetControl(0, 0, label);
                grid.SetControl(0, 1, name);
                grid.SetControl(0, 2, nameList);
                label          = new Label();
                label.Text     = "Size";
                size           = new TextBox();
                size.Width     = 40;
                size.ReadOnly  = true;
                sizeList       = new ListBox();
                sizeList.Width = 40;
                grid.SetControl(1, 0, label);
                grid.SetControl(1, 1, size);
                grid.SetControl(1, 2, sizeList);

                // Create the buttons.
                okButton          = new Button();
                okButton.Text     = "OK";
                cancelButton      = new Button();
                cancelButton.Text = "Cancel";
                applyButton       = new Button();
                applyButton.Text  = "Apply";
                helpButton        = new Button();
                helpButton.Text   = "Help";
                vbox2.Controls.Add(okButton);
                vbox2.Controls.Add(cancelButton);
                vbox2.Controls.Add(applyButton);
                vbox2.Controls.Add(helpButton);
                vbox2.Controls.Add(new EmptyControl());
                AcceptButton = okButton;
                CancelButton = cancelButton;

                // Create the effects controls.
                bold           = new CheckBox();
                bold.Text      = "Bold";
                italic         = new CheckBox();
                italic.Text    = "Italic";
                underline      = new CheckBox();
                underline.Text =
                    "Underline";
                strikeout      = new CheckBox();
                strikeout.Text =
                    "Strikeout";
                Control spacing = new Control();

                vbox3.Spacing = 0;
                vbox3.Controls.Add(bold);
                vbox3.Controls.Add(italic);
                vbox3.Controls.Add(underline);
                vbox3.Controls.Add(strikeout);
                vbox3.Controls.Add(spacing);

                // Create the sample box.
                sample           = new Control();
                sample.ForeColor = SystemColors.WindowText;
                sample.BackColor = SystemColors.Window;
                //sample.BorderStyleInternal = BorderStyle.Fixed3D;
                sample.Height = 60;
                vbox1.Controls.Add(sample);

                // Add the top-level hbox to the dialog and set the size.
                Controls.Add(hbox);
                Size drawsize = hbox.RecommendedSize;

                if (drawsize.Width < 450)
                {
                    drawsize.Width = 450;
                }
                if (drawsize.Height < 280)
                {
                    drawsize.Height = 280;
                }
                ClientSize    = drawsize;
                MinimumSize   = drawsize;
                MinimizeBox   = false;
                ShowInTaskbar = false;

                // Fill in the font names and sizes.
                nameList.BeginUpdate();
                foreach (FontFamily family in FontFamily.Families)
                {
                    nameList.Items.Add(family.Name);
                }
                nameList.EndUpdate();
                sizeList.BeginUpdate();
                foreach (int value in sizes)
                {
                    sizeList.Items.Add(value);
                }
                sizeList.EndUpdate();

                // Hook up interesting events.
                okButton.Click     += new EventHandler(AcceptDialog);
                cancelButton.Click += new EventHandler(CancelDialog);
                applyButton.Click  += new EventHandler(ApplyButtonClicked);
                helpButton.Click   += new EventHandler(HelpButtonClicked);
                nameList.SelectedIndexChanged
                    += new EventHandler(NameIndexChanged);
                sizeList.SelectedIndexChanged
                    += new EventHandler(SizeIndexChanged);
                bold.CheckedChanged
                    += new EventHandler(FontStyleChanged);
                italic.CheckedChanged
                    += new EventHandler(FontStyleChanged);
                underline.CheckedChanged
                    += new EventHandler(FontStyleChanged);
                strikeout.CheckedChanged
                             += new EventHandler(FontStyleChanged);
                sample.Paint += new PaintEventHandler(PaintSample);

                // Match the requested settings from the dialog parent.
                UpdateDialog();
            }
Esempio n. 25
0
        public ZoomWidget()
        {
            MinMaxHeight = FrameHeight;
            LayoutCell   = new LayoutCell(new Alignment {
                X = HAlignment.Center, Y = VAlignment.Bottom
            }, 1, 0);
            Layout = new HBoxLayout {
                Spacing = 8
            };
            Padding       = new Thickness(10, 0);
            Anchors       = Anchors.LeftRight | Anchors.Bottom;
            HitTestTarget = true;

            slider = new ThemedSlider {
                MinMaxSize = new Vector2(100, 2),
                Size       = new Vector2(100, 2),
                Y          = FrameHeight / 2,
                LayoutCell = new LayoutCell(Alignment.RightCenter, 1),
                Anchors    = Anchors.Right,
                RangeMin   = 0,
                RangeMax   = zoomTable.Count - 1,
                Step       = 1
            };
            slider.CompoundPresenter.Add(new SliderCenterPresenter(FindNearest(1f, 0, zoomTable.Count), zoomTable.Count));

            var zoomInButton = new ToolbarButton {
                MinMaxSize = new Vector2(FrameHeight),
                Size       = new Vector2(FrameHeight),
                LayoutCell = new LayoutCell(Alignment.RightCenter),
                Anchors    = Anchors.Right,
                Clicked    = () => {
                    if (CurrentSliderValue <= SceneView.Scene.Scale.X)
                    {
                        slider.Value = (slider.Value + slider.Step).Clamp(slider.RangeMin, slider.RangeMax);
                    }
                    Zoom(CurrentSliderValue);
                },
                Texture = IconPool.GetTexture("SceneView.ZoomIn"),
            };
            var zoomOutButton = new ToolbarButton {
                MinMaxSize = new Vector2(FrameHeight),
                Size       = new Vector2(FrameHeight),
                LayoutCell = new LayoutCell(Alignment.RightCenter),
                Anchors    = Anchors.Right,
                Clicked    = () => {
                    if (CurrentSliderValue >= SceneView.Scene.Scale.X)
                    {
                        slider.Value = (slider.Value - slider.Step).Clamp(slider.RangeMin, slider.RangeMax);
                    }
                    Zoom(CurrentSliderValue);
                },
                Texture = IconPool.GetTexture("SceneView.ZoomOut"),
            };

            var zoomEditor = new ThemedEditBox {
                LayoutCell  = new LayoutCell(Alignment.RightCenter),
                Anchors     = Anchors.Right,
                MinMaxWidth = 50
            };

            zoomEditor.Submitted += value => {
                var success = float.TryParse(value.TrimEnd('%'), out var zoom) && zoomTable.Count > 0;
                if (success)
                {
                    Zoom(Mathf.Clamp(zoom / 100, zoomTable[0], zoomTable[zoomTable.Count - 1]));
                }
            };

            this.AddChangeWatcher(() => SceneView.Scene.Scale.X, value => {
                var index       = FindNearest(value, 0, zoomTable.Count);
                slider.Value    = index;
                zoomEditor.Text = $"{value * 100f}%";
            });
            slider.Changed += () => Zoom(CurrentSliderValue);
            AddNode(new Widget {
                LayoutCell = new LayoutCell(Alignment.LeftCenter, 1)
            });
            AddNode(zoomEditor);
            AddNode(zoomOutButton);
            AddNode(slider);
            AddNode(zoomInButton);
        }
Esempio n. 26
0
 public LinkIndicatorButtonContainer()
 {
     Layout = new HBoxLayout();
     AddNode(container);
 }