コード例 #1
0
 private void CreateWidgetsForSingleField(CookingRulesMap rulesMap, string path, Meta.Item yi)
 {
     Widget headerWidget;
     Widget overridesWidget;
     var    fieldRootWidget = new Widget {
         Layout = new VBoxLayout(),
         Nodes  =
         {
             (headerWidget        = new Widget     {
                 Layout           = new HBoxLayout {
                     IgnoreHidden = false,
                 },
                 // TODO: maybe some Metrics.ScrollView.SliderWidth ? (though ScrollView is decorated in DesktopTheme which is inside Lime)
                 Padding          = new Thickness  {
                     Right        =     10.0f
                 },
             }),
             (overridesWidget     = new Widget     {
                 Visible          = cookingRulesFoldState.TryGetValue(yi, out bool v) ? v : false,
                 Layout           = new VBoxLayout(),
                 Padding          = new Thickness  {
                     Left         = 30.0f
                 }
             }),
コード例 #2
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();
            }
コード例 #3
0
            public AnimationRow(Model3DAttachment.Animation animation, ObservableCollection <Model3DAttachment.Animation> options)
                : base(animation, options)
            {
                var isDefault = animation.Name == Model3DAttachment.DefaultAnimationName;

                deleteButton.Visible = !isDefault;
                Layout = new VBoxLayout();
                var expandedButton = new ThemedExpandButton {
                    MinMaxSize = new Vector2(AttachmentMetrics.ExpandButtonSize),
                    Anchors    = Anchors.Left
                };

                Padding = new Thickness(AttachmentMetrics.Spacing);
                Header.Nodes.Add(expandedButton);

                var animationNamePropEditor = new StringPropertyEditor(
                    new PropertyEditorParams(
                        Header,
                        animation,
                        nameof(Model3DAttachment.Animation.Name))
                {
                    ShowLabel = false
                });

                animationNamePropEditor.ContainerWidget.MinMaxWidth = AttachmentMetrics.EditorWidth;

                Header.AddNode(new BlendingCell(Source, nameof(Model3DAttachment.Animation.Blending)));

                var expandableContentWrapper = new Widget {
                    Layout = new VBoxLayout {
                        Spacing = AttachmentMetrics.Spacing
                    },
                    LayoutCell = new LayoutCell {
                        StretchY = 0
                    },
                    Padding = new Thickness {
                        Left   = AttachmentMetrics.ExpandContentPadding,
                        Top    = AttachmentMetrics.Spacing,
                        Bottom = AttachmentMetrics.Spacing
                    },
                    Visible = false,
                };

                BuildList <Model3DAttachment.MarkerData, MarkerRow>(
                    animation.Markers,
                    expandableContentWrapper,
                    "Markers",
                    () => new Model3DAttachment.MarkerData {
                    Marker = new Marker {
                        Id    = "Marker",
                        Frame = 0,
                    }
                },
                    MarkerRow.CreateHeader());

                BuildList <Model3DAttachment.MarkerBlendingData, MarkerBlendingRow>(
                    animation.MarkersBlendings,
                    expandableContentWrapper,
                    "Marker Blendings",
                    () => new Model3DAttachment.MarkerBlendingData {
                    SourceMarkerId = "Marker2",
                    DestMarkerId   = "Marker1"
                },
                    MarkerBlendingRow.CreateHeader());
                if (!isDefault)
                {
                    BuildList <Model3DAttachment.NodeData, NodeRow>(
                        animation.Nodes,
                        expandableContentWrapper,
                        "Nodes",
                        () => new Model3DAttachment.NodeData {
                        Id = "NodeId"
                    },
                        NodeRow.CreateHeader());

                    BuildList <Model3DAttachment.NodeData, NodeRow>(
                        animation.IgnoredNodes,
                        expandableContentWrapper,
                        "Ignored Nodes",
                        () => new Model3DAttachment.NodeData {
                        Id = "NodeId"
                    },
                        NodeRow.CreateHeader());
                }


                Nodes.Add(expandableContentWrapper);
                expandableContentWrapper.AddChangeWatcher(
                    () => expandedButton.Expanded,
                    (v) => expandableContentWrapper.Visible = v);
                CompoundPresenter.Add(Presenters.StripePresenter);
            }