示例#1
0
            public override void OnLoaded()
            {
                base.OnLoaded();

                var box = (OutputBox)GetBox(0);

                if (Values[0] == null)
                {
                    box.Enabled = false;
                    return;
                }
                var type = Values[0].GetType();

                if (!type.IsEnum)
                {
                    box.Enabled = false;
                    return;
                }
                _picker = new EnumComboBox(type)
                {
                    EnumTypeValue = Values[0],
                    Bounds        = new Rectangle(FlaxEditor.Surface.Constants.NodeMarginX, FlaxEditor.Surface.Constants.NodeMarginY + FlaxEditor.Surface.Constants.NodeHeaderSize, 160, 16),
                    Parent        = this,
                };
                _picker.ValueChanged += () => SetValue(0, _picker.EnumTypeValue);
                Title = type.Name;
                ResizeAuto();
                _picker.Width   = Width - 30;
                box.CurrentType = new ScriptType(type);
            }
示例#2
0
        Control PenCapControl()
        {
            var control = new EnumComboBox <PenLineCap>();

            control.SelectedValueBinding.Bind(this, r => r.LineCap, (r, val) => { r.LineCap = val; Refresh(); });
            return(control);
        }
示例#3
0
        static Control PrintSelection()
        {
            var control = new EnumComboBox <PrintSelection>();

            control.SelectedValueBinding.Bind <PrintSettings>(r => r.PrintSelection, (r, v) => r.PrintSelection = v);
            return(control);
        }
示例#4
0
        //-----------------------------------------------------------------------------
        // Constructor
        //-----------------------------------------------------------------------------

        public PropertyGridControl(EditorControl editorControl, PropertyGrid propertyGrid)
        {
            this.editorControl = editorControl;
            this.propertyGrid  = propertyGrid;

            propertiesContainer         = new PropertiesContainer(null);
            propertyGrid.SelectedObject = propertiesContainer;

            // Create property editor types.
            typeEditors                    = new Dictionary <string, CustomPropertyEditor>();
            typeEditors["sprite"]          = new ResourcePropertyEditor <Sprite>();
            typeEditors["animation"]       = new ResourcePropertyEditor <Animation>();
            typeEditors["collision_model"] = new ResourcePropertyEditor <CollisionModel>();
            typeEditors["song"]            = new ResourcePropertyEditor <Song>();
            typeEditors["sound"]           = new ResourcePropertyEditor <Sound>();
            typeEditors["zone"]            = new ResourcePropertyEditor <Zone>();
            typeEditors["reward"]          = new RewardPropertyEditor(editorControl.RewardManager);
            typeEditors["text_message"]    = new TextMessagePropertyEditor();
            typeEditors["script"]          = new ScriptPropertyEditor();
            typeEditors["sprite_index"]    = new SpriteIndexComboBox();
            typeEditors["direction"]       = new DirectionPropertyEditor();
            typeEditors["angle"]           = null;
            typeEditors["enum"]            = new EnumComboBox();
            typeEditors["enum_flags"]      = null;
            typeEditors["dungeon"]         = new DungeonPropertyEditor();
            typeEditors["level"]           = new LevelPropertyEditor();

            /*
             * // Initialize property type editors.
             * foreach (KeyValuePair<string, CustomPropertyEditor> entry in typeEditors) {
             *      if (entry.Value != null)
             *              entry.Value.Initialize(this);
             * }*/
        }
示例#5
0
        Control ImagePositionControl()
        {
            var control = new EnumComboBox <ButtonImagePosition>();

            control.Bind(r => r.SelectedValue, this, r => r.ImagePosition);
            return(control);
        }
示例#6
0
		Control PenCapControl()
		{
			var control = new EnumComboBox<PenLineCap>();
			control.Bind(c => c.SelectedValue, this, r => r.LineCap);
			control.SelectedValueChanged += Refresh;
			return control;
		}
示例#7
0
        public void Initialize(EditorControl editorControl)
        {
            this.editorControl = editorControl;

            // Create custom property editor types.
            typeEditors["sprite"]          = new ResourcePropertyEditor <Sprite>();
            typeEditors["animation"]       = new ResourcePropertyEditor <Animation>();
            typeEditors["collision_model"] = new ResourcePropertyEditor <CollisionModel>();
            typeEditors["song"]            = new ResourcePropertyEditor <Song>();
            typeEditors["sound"]           = new ResourcePropertyEditor <Sound>();
            typeEditors["zone"]            = new ResourcePropertyEditor <Zone>();
            typeEditors["reward"]          = new RewardPropertyEditor(editorControl.RewardManager);
            typeEditors["text_message"]    = new TextMessagePropertyEditor();
            typeEditors["script"]          = new ScriptPropertyEditor();
            typeEditors["sprite_index"]    = new SpriteIndexComboBox();
            typeEditors["direction"]       = new DirectionPropertyEditor();
            typeEditors["angle"]           = null;
            typeEditors["enum"]            = new EnumComboBox();
            typeEditors["enum_flags"]      = null;
            typeEditors["dungeon"]         = new DungeonPropertyEditor();
            typeEditors["level"]           = new LevelPropertyEditor();

            // Initialize the property editors.
            foreach (CustomPropertyEditor editor in typeEditors.Values.Where(e => e != null))
            {
                editor.Initialize(this);
            }
        }
示例#8
0
        Control PrintSelection()
        {
            var control = new EnumComboBox <PrintSelection>();

            control.Bind(r => r.SelectedValue, (PrintSettings s) => s.PrintSelection);
            return(control);
        }
示例#9
0
		Control MessageBoxButtonsCombo()
		{
			var control = new EnumComboBox<MessageBoxButtons>();
			var binding = new ObjectBinding<MessageBoxSection, MessageBoxButtons>(this, r => r.MessageBoxButtons, (r, val) => r.MessageBoxButtons = val);
			control.SelectedValueBinding.Bind(binding);
			return control;
		}
示例#10
0
        Control PenCapControl()
        {
            var control = new EnumComboBox <PenLineCap>();

            control.Bind(c => c.SelectedValue, this, r => r.LineCap);
            control.SelectedValueChanged += Refresh;
            return(control);
        }
示例#11
0
        Control GradientWrapControl()
        {
            var control = new EnumComboBox <GradientWrapMode> ();

            control.Bind(c => c.SelectedValue, this, c => c.GradientWrap);
            control.SelectedValueChanged += Refresh;
            return(control);
        }
示例#12
0
        Control MessageBoxDefaultButtonCombo()
        {
            var control = new EnumComboBox <MessageBoxDefaultButton>();
            var binding = new ObjectBinding <MessageBoxSection, MessageBoxDefaultButton>(this, r => r.MessageBoxDefaultButton, (r, val) => r.MessageBoxDefaultButton = val);

            control.SelectedValueBinding.Bind(binding);
            return(control);
        }
示例#13
0
        Control EnumCombo()
        {
            var control = new EnumComboBox <Key> ();

            LogEvents(control);
            control.SelectedKey = ((int)Key.E).ToString();
            return(control);
        }
		Control Orientation(RadioButtonList list)
		{
			var control = new EnumComboBox<RadioButtonListOrientation>();
			control.SelectedValue = list.Orientation;
			control.SelectedValueChanged += delegate
			{
				list.Orientation = control.SelectedValue;
			};
			return TableLayout.AutoSized(control, centered: true);
		}
示例#15
0
        public RuleEditor(BrowserInfo[] browsers)
        {
            InitializeComponent();

            ecbRuleType = new EnumComboBox<RuleType>(cmbRuleType);
            ecbRuleType.SelectedItem = RuleType.Regex;
            cmbRuleType = ecbRuleType;

            ShowBrowsers(browsers);
        }
示例#16
0
        Control Orientation(RadioButtonList list)
        {
            var control = new EnumComboBox <RadioButtonListOrientation>();

            control.SelectedValue         = list.Orientation;
            control.SelectedValueChanged += delegate
            {
                list.Orientation = control.SelectedValue;
            };
            return(TableLayout.AutoSized(control, centered: true));
        }
        Control BadgeSelector()
        {
            var control = new EnumComboBox <BadgeDisplayMode>();

            /*
             * control.Items.Add ("All Messages", BadgeDisplayMode.All.ToString());
             * control.Items.Add ("Higlighted Messages only", BadgeDisplayMode.Highlighted.ToString());
             * control.Items.Add ("None", BadgeDisplayMode.None.ToString ());
             */
            control.SelectedValueBinding.Bind(config, r => r.BadgeDisplay, (r, v) => r.BadgeDisplay = v);
            return(control);
        }
示例#18
0
        Control BadgeSelector()
        {
            var control = new EnumComboBox<BadgeDisplayMode>();

            /*
            control.Items.Add ("All Messages", BadgeDisplayMode.All.ToString());
            control.Items.Add ("Higlighted Messages only", BadgeDisplayMode.Highlighted.ToString());
            control.Items.Add ("None", BadgeDisplayMode.None.ToString ());
             */
            control.Bind(r => r.SelectedValue, config, r => r.BadgeDisplay, DualBindingMode.OneWay);
            return control;
        }
        private Widget CreateEditorWidget()
        {
            // Create the text editor with the resulting buffer.
            editorView = new EditorView();
            editorView.Controller.PopulateContextMenu += OnPopulateContextMenu;

            // Update the theme with some additional colors.
            SetupTheme();

            // Wrap the text editor in a scrollbar.
            var scrolledWindow = new ScrolledWindow();

            scrolledWindow.VscrollbarPolicy = PolicyType.Always;
            scrolledWindow.Add(editorView);

            // Create the indicator bar that is 10 px wide.
            indicatorView = new IndicatorView(editorView);
            indicatorView.SetSizeRequest(20, 1);

            // Create the drop down list with the enumerations.
            var lineStyleCombo = new EnumComboBox(typeof(DemoLineStyleType));

            lineStyleCombo.Sensitive = false;

            // Add the editor and bar to the current tab.
            var editorBand = new HBox(false, 0);

            editorBand.PackStart(scrolledWindow, true, true, 0);
            editorBand.PackStart(indicatorView, false, false, 4);

            // Controls band
            var controlsBand = new HBox(false, 0);

            controlsBand.PackStart(lineStyleCombo, false, false, 0);
            controlsBand.PackStart(new Label(), true, true, 0);

            // Create a vbox and use it to add the combo boxes.
            var verticalLayout = new VBox(false, 4);

            verticalLayout.BorderWidth = 4;
            verticalLayout.PackStart(editorBand, true, true, 0);
            verticalLayout.PackStart(controlsBand, false, false, 4);

            // Create the first buffer.
            editorView.SetLineBuffer(CreateEditableLineBuffer());

            // Return the resulting layout.
            return(verticalLayout);
        }
示例#20
0
        public Control Create(InputBox box, ref Rectangle bounds)
        {
            var value   = GetValue(box);
            var control = new EnumComboBox(box.CurrentType.Type)
            {
                Location      = new Vector2(bounds.X, bounds.Y),
                Size          = new Vector2(60.0f, bounds.Height),
                EnumTypeValue = value ?? box.CurrentType.CreateInstance(),
                Parent        = box.Parent,
                Tag           = box,
            };

            control.EnumValueChanged += OnEnumValueChanged;
            return(control);
        }
示例#21
0
        internal static bool Show(Form owner, string colName, ref ListVieweHelper.EOperator op, ref string text)
        {
            using (FrmEditColumnFilter frm = new FrmEditColumnFilter())
            {
                frm.ctlTitleBar1.SubText += " for " + colName;

                EnumComboBox.Populate(frm._lstNumComp, op);
                frm._txtNumComp.Text = text;

                if (UiControls.ShowWithDim(owner, frm) == DialogResult.OK)
                {
                    op   = frm.GetSelectedOperator();
                    text = frm._txtNumComp.Text;
                    return(true);
                }

                return(false);
            }
        }
        public DemoComponents()
        {
            // Create the general frame
            uint row   = 1;
            var  table = new LabelWidgetTable(5, 2);

            table.BorderWidth = 5;

            // Just a text entry
            var nameEntry = new Entry("Bob");

            table.AttachExpanded(row++, "Name", nameEntry);

            // An unexpanded enumeration combo box
            var ecb = new EnumComboBox(typeof(ButtonsType));

            ecb.ActiveEnum = ButtonsType.YesNo;
            table.Attach(row++, "EnumComboBox", ecb);

            // An unexpanded described
            testEnumCombo          = new EnumComboBox(typeof(ExampleEnumeration));
            testEnumCombo.Changed += OnTestEnumChanged;
            table.Attach(row++, "ExampleEnumeration", testEnumCombo);

            // Add the string entry
            var sle = new StringListEntry();

            sle.Values = new[]
            {
                "Line 1", "Line 2", "Line 3",
            };
            sle.CompletionStore.AppendValues("List 4");
            sle.CompletionStore.AppendValues("List 5");
            sle.CompletionStore.AppendValues("List 6");
            sle.CompletionStore.AppendValues("List 7");
            table.AttachExpanded(row++, "StringListEntry", sle);

            // Return it
            PackStart(table, false, false, 0);
            PackStart(new Label(""), true, true, 0);
        }
示例#23
0
        private FrmEditGroupBase(GroupInfoBase group, bool readOnly)
            : this()
        {
            this._group = group;

            this._txtTitle.Text         = group.OverrideDisplayName;
            this._txtTitle.Watermark    = group.DefaultDisplayName;
            this._txtAbvTitle.Text      = group.OverrideShortName;
            this._txtAbvTitle.Watermark = group.DefaultShortName;
            this._txtComments.Text      = group.Comment;
            this._txtId.Text            = group.Id.ToString();
            this._txtDisplayOrder.Value = group.DisplayPriority;
            this._txtTimeRange.Text     = group.Range.ToString();

            this._ecbIcon = EnumComboBox.Create(this._lstIcon, group.GraphIcon);
            this._ecbFill = EnumComboBox.Create(this._lstStyle, group.HatchStyle);

            this._colour = group.Colour;

            this.UpdateButtonImage();

            bool   exp          = group is GroupInfo;
            string txtGroup     = exp ? "group" : "batch";
            string txtGroupLong = exp ? "experimental group" : "batch";
            string txtContext   = readOnly ? "View" : "Edit";

            this._lblTimeRange.Text   = exp ? "Time range" : "Acquisition range";
            this.ctlTitleBar1.Text    = $"{txtContext} {txtGroup}";
            this.ctlTitleBar1.SubText = $"{txtContext} the details for the {txtGroupLong}";

            if (readOnly)
            {
                UiControls.MakeReadOnly(this);
            }

            // UiControls.CompensateForVisualStyles(this);
        }
示例#24
0
        private void OnEnumValueChanged(EnumComboBox control)
        {
            var box = (InputBox)control.Tag;

            box.ParentNode.SetValue(box.Archetype.ValueIndex, control.EnumTypeValue);
        }
        private void CreateControlIfPropertyIsEnum(PropertyInfo property)
        {
            var enumAttribute =
                Attribute.GetCustomAttribute(property, typeof(EnumAttribute)) as
                EnumAttribute;

            if (enumAttribute != null)
            {
                var value = Convert.ChangeType(settings.GetPropertyValue<object>(property), enumAttribute.EnumType);
                var comboField = new EnumComboBox
                {
                    Name = property.Name,
                    Size = new Size(180, 20),
                };
                comboField.SetEnum(enumAttribute.EnumType);
                comboField.SelectedEnumItem = (value.ToString() != "None") ? value : enumAttribute.Default;

                holder.Controls.Add(comboField);
            }
        }
示例#26
0
            private void OnEditClicked(ContextMenuButton button)
            {
                var keyType = _editor.Values.Type.GetGenericArguments()[0];

                if (keyType == typeof(string) || keyType.IsPrimitive)
                {
                    var popup = RenamePopup.Show(Parent, Rectangle.Margin(Bounds, Margin), Text, false);
                    popup.Validate += (renamePopup, value) =>
                    {
                        object newKey;
                        if (keyType.IsPrimitive)
                        {
                            newKey = JsonSerializer.Deserialize(value, keyType);
                        }
                        else
                        {
                            newKey = value;
                        }
                        return(!((IDictionary)_editor.Values[0]).Contains(newKey));
                    };
                    popup.Renamed += renamePopup =>
                    {
                        object newKey;
                        if (keyType.IsPrimitive)
                        {
                            newKey = JsonSerializer.Deserialize(renamePopup.Text, keyType);
                        }
                        else
                        {
                            newKey = renamePopup.Text;
                        }

                        _editor.ChangeKey(_key, newKey);
                        _key = newKey;
                        Text = _key.ToString();
                    };
                }
                else if (keyType.IsEnum)
                {
                    var popup  = RenamePopup.Show(Parent, Rectangle.Margin(Bounds, Margin), Text, false);
                    var picker = new EnumComboBox(keyType)
                    {
                        AnchorPreset  = AnchorPresets.StretchAll,
                        Offsets       = Margin.Zero,
                        Parent        = popup,
                        EnumTypeValue = _key,
                    };
                    picker.ValueChanged += () =>
                    {
                        popup.Hide();
                        object newKey = picker.EnumTypeValue;
                        if (!((IDictionary)_editor.Values[0]).Contains(newKey))
                        {
                            _editor.ChangeKey(_key, newKey);
                            _key = newKey;
                            Text = _key.ToString();
                        }
                    };
                }
                else
                {
                    throw new NotImplementedException("Missing editing for dictionary key type " + keyType);
                }
            }
示例#27
0
 private ListVieweHelper.EOperator GetSelectedOperator()
 {
     return(EnumComboBox.Get(this._lstNumComp, (ListVieweHelper.EOperator)(-1)));
 }
示例#28
0
 /// <summary>
 /// Initializes a new instance of the <see cref="EnumElement"/> class.
 /// </summary>
 /// <param name="type">The enum type.</param>
 /// <param name="customBuildEntriesDelegate">The custom entries layout builder. Allows to hide existing or add different enum values to editor.</param>
 /// <param name="formatMode">The formatting mode.</param>
 public EnumElement(Type type, EnumComboBox.BuildEntriesDelegate customBuildEntriesDelegate = null, EnumDisplayAttribute.FormatMode formatMode = EnumDisplayAttribute.FormatMode.Default)
 {
     EnumComboBox = new EnumComboBox(type, customBuildEntriesDelegate, formatMode);
 }
示例#29
0
		Control EnumCombo()
		{
			var control = new EnumComboBox<Keys>();
			LogEvents(control);
			control.SelectedKey = ((int)Keys.E).ToString();
			return control;
		}
示例#30
0
        /// <summary>
        /// CONSTRUCTOR
        /// </summary>
        private FrmEditPeakFilterCondition(Form owner, Core core, PeakFilter.Condition defaults, bool readOnly)
            : this()
        {
            this._core     = core;
            this._readOnly = readOnly;

            this.ctlTitleBar1.Text = readOnly ? "View Condition" : "Edit Condition";

            // Setup boxes
            this._cbPeaks    = DataSet.ForPeaks(core).CreateConditionBox(this._txtIsInSet, this._btnIsInSet);
            this._cbFlags    = DataSet.ForUserFlags(core).CreateConditionBox(this._txtIsFlaggedWith, this._btnIsFlaggedWith);
            this._cbClusters = DataSet.ForClusters(core).CreateConditionBox(this._txtIsInCluster, this._btnIsInCluster);

            this._lsoFlags  = EnumComboBox.Create(this._lstFlagComparator, Filter.ESetOperator.Any);
            this._lsoPats   = EnumComboBox.Create(this._lstClusterComparator, Filter.ELimitedSetOperator.Any);
            this._lsoPeaks  = EnumComboBox.Create(this._lstPeakComparator, Filter.EElementOperator.Is);
            this._lsoFilter = EnumComboBox.Create(this._lstFilterOp, Filter.EElementOperator.Is);
            this._lsoStats  = EnumComboBox.Create(this._lstStatisticComparator, Filter.EStatOperator.LessThan);
            this._lstIsStatistic.Items.AddRange(IVisualisableExtensions.WhereEnabled(core.Statistics).ToArray());

            this._ecbFilter = DataSet.ForPeakFilter(core).CreateComboBox(this._lstFilter, null, EditableComboBox.EFlags.IncludeAll);

            this._isInitialised = true;

            if (defaults == null)
            {
                this.checkBox1.Checked = false;
                this._radAnd.Checked   = true;
                this._txtComp_TextChanged(null, null);
            }
            else
            {
                // Not
                this.checkBox1.Checked = defaults.Negate;
                this._radAnd.Checked   = defaults.CombiningOperator == Filter.ELogicOperator.And;
                this._radOr.Checked    = defaults.CombiningOperator == Filter.ELogicOperator.Or;

                if (defaults is PeakFilter.ConditionCluster)
                {
                    PeakFilter.ConditionCluster def = (PeakFilter.ConditionCluster)defaults;

                    List <Cluster> strong;

                    if (!def.Clusters.TryGetStrong(out strong))
                    {
                        this.ShowWeakFailureMessage("clusters");
                    }

                    this._chkIsInCluster.Checked   = true;
                    this._lsoPats.SelectedItem     = def.ClustersOp;
                    this._cbClusters.SelectedItems = strong;
                }
                else if (defaults is PeakFilter.ConditionPeak)
                {
                    PeakFilter.ConditionPeak def = (PeakFilter.ConditionPeak)defaults;

                    List <Peak> strong;

                    if (!def.Peaks.TryGetStrong(out strong))
                    {
                        this.ShowWeakFailureMessage("peaks");
                    }

                    this._chkIsInSet.Checked    = true;
                    this._lsoPeaks.SelectedItem = def.PeaksOp;
                    this._cbPeaks.SelectedItems = strong;
                }
                else if (defaults is PeakFilter.ConditionFlags)
                {
                    PeakFilter.ConditionFlags def = (PeakFilter.ConditionFlags)defaults;

                    List <UserFlag> strong;

                    if (!def.Flags.TryGetStrong(out strong))
                    {
                        this.ShowWeakFailureMessage("peaks");
                    }

                    this._chkIsFlaggedWith.Checked = true;
                    this._lsoFlags.SelectedItem    = def.FlagsOp;
                    this._cbFlags.SelectedItems    = strong;
                }
                else if (defaults is PeakFilter.ConditionStatistic)
                {
                    PeakFilter.ConditionStatistic def = (PeakFilter.ConditionStatistic)defaults;

                    ConfigurationStatistic strong;

                    if (!def.Statistic.TryGetTarget(out strong))
                    {
                        this.ShowWeakFailureMessage("statistics");
                    }

                    ConfigurationStatistic stat = def.Statistic.GetTarget();

                    if (stat == null)
                    {
                        FrmMsgBox.ShowError(this, "The statistic specified when this condition was created has since been removed. Please select a different statistic.");
                    }

                    this._chkIsStatistic.Checked      = true;
                    this._lsoStats.SelectedItem       = def.StatisticOp;
                    this._lstIsStatistic.SelectedItem = stat;
                    this._txtStatisticValue.Text      = def.StatisticValue.ToString();
                }
                else if (defaults is PeakFilter.ConditionFilter)
                {
                    PeakFilter.ConditionFilter def = (PeakFilter.ConditionFilter)defaults;

                    this._radFilter.Checked      = true;
                    this._lsoFilter.SelectedItem = def.FilterOp ? Filter.EElementOperator.Is : Filter.EElementOperator.IsNot;
                    this._ecbFilter.SelectedItem = def.Filter;
                }
                else
                {
                    throw new SwitchException(defaults.GetType());
                }
            }

            if (readOnly)
            {
                UiControls.MakeReadOnly(this);
            }
        }
示例#31
0
            public override void OnDestroy()
            {
                _picker = null;

                base.OnDestroy();
            }
示例#32
0
        /// <summary>
        /// Constructs the dialog box.
        /// </summary>
        public ConfigDialog()
        {
            // Set up our controls
            Title = Locale.Translate("Configuration Dialog");
            AddButton("Close", ResponseType.Close);
            //Response += new ResponseHandler (on_dialog_response);

            // Add the dialog table
            LabelWidgetTable table = new LabelWidgetTable(2, 2);
            uint             row   = 0;

            VBox.Add(table);

            // Put in a list of themes
            int i = 0;

            themes = ComboBox.NewText();

            foreach (Theme theme in Theme.GetThemes())
            {
                themes.AppendText(theme.ThemeName);

                if (theme.ThemeName == Game.Config.ThemeName)
                {
                    themes.Active = 0;
                }

                i++;
            }

            themes.Changed += OnChanged;

            // Languages
            languages = ComboBox.NewText();
            languages.AppendText("en-US");
            languages.Active   = 0;
            languages.Changed += OnChanged;

            // Selection type
            selectionType            = new EnumComboBox(typeof(SelectionType));
            selectionType.ActiveEnum = Game.Config.SelectionType;
            selectionType.Changed   += OnChanged;

            // Board size
            boardSize          = new SpinButton(3f, 27f, 1f);
            boardSize.Value    = Game.Config.BoardSize;
            boardSize.Changed += OnChanged;

            // Frames per second
            fps          = new SpinButton(1f, 60f, 1f);
            fps.Value    = Game.Config.FramesPerSecond;
            fps.Changed += OnChanged;

            // Start with theme configuration
            table.AttachExpanded(row++, "Theme", themes);
            table.AttachExpanded(row++, "Board Size", boardSize);
            table.AttachExpanded(row++, "Selection Type", selectionType);
            table.AttachExpanded(row++, "Language", languages);
            table.AttachExpanded(row++, "FPS", fps);

            // Finish up
            ShowAll();
        }
示例#33
0
		Control ImagePositionControl()
		{
			var control = new EnumComboBox<ButtonImagePosition>();
			control.Bind(r => r.SelectedValue, this, r => r.ImagePosition);
			return control;
		}
示例#34
0
文件: BrushSection.cs 项目: Exe0/Eto
		Control GradientWrapControl ()
		{
			var control = new EnumComboBox<GradientWrapMode> ();
			control.Bind (c => c.SelectedValue, this, c => c.GradientWrap);
			control.SelectedValueChanged += Refresh;
			return control;
		}
        private bool TryInvoke <T>(RadioButton radioButton, ConditionBox <T> conditionBox, EnumComboBox <Filter.EElementOperator> enumBox, Type type, out ObsFilter.Condition result)
        {
            if (!radioButton.Checked)
            {
                result = null;
                return(false);
            }

            Filter.ELogicOperator op = this._radAnd.Checked ? Filter.ELogicOperator.And : Filter.ELogicOperator.Or;

            bool negate = this.checkBox1.Checked;

            var sel = conditionBox.GetSelectionOrNull();

            this._checker.Check(conditionBox.TextBox, conditionBox.SelectionValid, "Select a condition");

            var en = enumBox.SelectedItem;

            this._checker.Check(enumBox.ComboBox, enumBox.HasSelection, "Select a condition");

            if (sel == null || !en.HasValue)
            {
                result = null;
                return(true);
            }

            Type[] types = { typeof(Filter.ELogicOperator), typeof(bool), typeof(Filter.EElementOperator), typeof(IEnumerable <T>) };
            result = (ObsFilter.Condition)type.GetConstructor(types).Invoke(new object[] { op, negate, en.Value, sel });
            return(true);
        }
示例#36
0
		Control PenCapControl()
		{
			var control = new EnumComboBox<PenLineCap>();
			control.SelectedValueBinding.Bind(this, r => r.LineCap, (r,val) => { r.LineCap = val; Refresh(); });
			return control;
		}
示例#37
0
            private unsafe void UpdateBoxes()
            {
                var       valueBox  = (InputBox)GetBox(0);
                const int firstBox  = 2;
                const int maxBoxes  = 40;
                bool      isInvalid = false;
                var       data      = Utils.GetEmptyArray <byte>();

                if (valueBox.HasAnyConnection)
                {
                    var valueType = valueBox.CurrentType;
                    if (valueType.IsEnum)
                    {
                        // Get enum entries
                        var entries = new List <EnumComboBox.Entry>();
                        EnumComboBox.BuildEntriesDefault(valueType.Type, entries);

                        // Setup switch value inputs
                        int        id   = firstBox;
                        ScriptType type = new ScriptType();
                        for (; id < maxBoxes; id++)
                        {
                            var box = GetBox(id);
                            if (box == null)
                            {
                                break;
                            }
                            if (box.HasAnyConnection)
                            {
                                type = box.Connections[0].CurrentType;
                                break;
                            }
                        }
                        id = firstBox;
                        for (; id < entries.Count + firstBox; id++)
                        {
                            var e   = entries[id - firstBox];
                            var box = AddBox(false, id, id - 1, e.Name, type, true);
                            if (!string.IsNullOrEmpty(e.Tooltip))
                            {
                                box.TooltipText = e.Tooltip;
                            }
                        }
                        for (; id < maxBoxes; id++)
                        {
                            var box = GetBox(id);
                            if (box == null)
                            {
                                break;
                            }
                            RemoveElement(box);
                        }

                        // Setup output
                        var outputBox = (OutputBox)GetBox(1);
                        outputBox.CurrentType = type;

                        // Build data about enum entries values for the runtime
                        if (Values[0] is byte[] dataPrev && dataPrev.Length == entries.Count * 4)
                        {
                            data = dataPrev;
                        }
                        else
                            data = new byte[entries.Count * 4];
                        fixed(byte *dataPtr = data)
                        {
                            int *dataValues = (int *)dataPtr;

                            for (int i = 0; i < entries.Count; i++)
                            {
                                dataValues[i] = entries[i].Value;
                            }
                        }
                    }
                    else
                    {
                        // Not an enum
                        isInvalid = true;
                    }
                }
        /// <summary>
        /// Ctor.
        /// </summary>
        private FrmEditObsFilterCondition(Form owner, Core core, ObsFilter.Condition defaults, bool readOnly)
            : this()
        {
            this._core     = core;
            this._readOnly = readOnly;

            this.ctlTitleBar1.Text = readOnly ? "View Condition" : "Edit Condition";

            // Setup boxes
            this._cbAq    = DataSet.ForAcquisitions(core).CreateConditionBox(this._txtAq, this._btnAq);
            this._cbBatch = DataSet.ForBatches(core).CreateConditionBox(this._txtBatch, this._btnBatch);
            this._cbCond  = DataSet.ForConditions(core).CreateConditionBox(this._txtCond, this._btnCond);
            this._cbGroup = DataSet.ForGroups(core).CreateConditionBox(this._txtGroup, this._btnGroup);
            this._cbObs   = DataSet.ForObservations(core).CreateConditionBox(this._txtObs, this._btnObs);
            this._cbRep   = DataSet.ForReplicates(core).CreateConditionBox(this._txtRep, this._btnRep);
            this._cbTime  = DataSet.ForTimes(core).CreateConditionBox(this._txtTime, this._btnTime);

            this._lsoAq    = EnumComboBox.Create(this._lstAq, Filter.EElementOperator.Is);
            this._lsoBatch = EnumComboBox.Create(this._lstBatch, Filter.EElementOperator.Is);
            this._lsoCond  = EnumComboBox.Create(this._lstCond, Filter.EElementOperator.Is);
            this._lsoGroup = EnumComboBox.Create(this._lstGroup, Filter.EElementOperator.Is);
            this._lsoObs   = EnumComboBox.Create(this._lstObs, Filter.EElementOperator.Is);
            this._lsoRep   = EnumComboBox.Create(this._lstRep, Filter.EElementOperator.Is);
            this._lsoTime  = EnumComboBox.Create(this._lstDay, Filter.EElementOperator.Is);

            this._isInitialised = true;

            if (defaults == null)
            {
                this.checkBox1.Checked = false;
                this._radAnd.Checked   = true;
                this.something_Changed(null, null);
            }
            else
            {
                // Not
                this.checkBox1.Checked = defaults.Negate;
                this._radAnd.Checked   = defaults.CombiningOperator == Filter.ELogicOperator.And;
                this._radOr.Checked    = defaults.CombiningOperator == Filter.ELogicOperator.Or;

                if (defaults      is ObsFilter.ConditionAcquisition)
                {
                    var def = (ObsFilter.ConditionAcquisition)defaults;
                    this._chkAq.Checked      = true;
                    this._lsoAq.SelectedItem = def.Operator;
                    this._cbAq.SelectedItems = def.Possibilities;
                }
                else if (defaults is ObsFilter.ConditionBatch)
                {
                    var def = (ObsFilter.ConditionBatch)defaults;
                    this._chkBatch.Checked      = true;
                    this._lsoBatch.SelectedItem = def.Operator;
                    this._cbBatch.SelectedItems = def.Possibilities;
                }
                else if (defaults is ObsFilter.ConditionGroup)
                {
                    var def = (ObsFilter.ConditionGroup)defaults;
                    this._chkGroup.Checked      = true;
                    this._lsoGroup.SelectedItem = def.Operator;
                    this._cbGroup.SelectedItems = def.Possibilities;
                }
                else if (defaults is ObsFilter.ConditionRep)
                {
                    var def = (ObsFilter.ConditionRep)defaults;
                    this._chkRep.Checked      = true;
                    this._lsoRep.SelectedItem = def.Operator;
                    this._cbRep.SelectedItems = def.Possibilities;
                }
                else if (defaults is ObsFilter.ConditionTime)
                {
                    var def = (ObsFilter.ConditionTime)defaults;
                    this._chkTime.Checked      = true;
                    this._lsoTime.SelectedItem = def.Operator;
                    this._cbTime.SelectedItems = def.Possibilities;
                }
                else if (defaults is ObsFilter.ConditionObservation)
                {
                    var def = (ObsFilter.ConditionObservation)defaults;
                    this._chkObs.Checked      = true;
                    this._lsoObs.SelectedItem = def.Operator;
                    this._cbObs.SelectedItems = def.Possibilities;
                }
                else if (defaults is ObsFilter.ConditionCondition)
                {
                    var def = (ObsFilter.ConditionCondition)defaults;
                    this._chkCond.Checked      = true;
                    this._lsoCond.SelectedItem = def.Operator;
                    this._cbCond.SelectedItems = def.Possibilities;
                }
                else
                {
                    throw new SwitchException(defaults.GetType());
                }
            }

            if (readOnly)
            {
                UiControls.MakeReadOnly(this);
            }
        }
示例#39
0
		Control PrintSelection()
		{
			var control = new EnumComboBox<PrintSelection>();
			control.Bind(r => r.SelectedValue, (PrintSettings s) => s.PrintSelection);
			return control;
		}
示例#40
0
        private void OnEnumValueChanged(EnumComboBox control)
        {
            var box = (InputBox)control.Tag;

            box.Value = control.EnumTypeValue;
        }
示例#41
0
		static Control PrintSelection()
		{
			var control = new EnumComboBox<PrintSelection>();
			control.SelectedValueBinding.Bind<PrintSettings>(r => r.PrintSelection, (r, v) => r.PrintSelection = v);
			return control;
		}