Пример #1
0
            /// <inheritdoc/>
            protected internal override InspectableState Refresh()
            {
                CharRange newValue = GetValue <CharRange>();

                rangeStartField.Value = newValue.start;
                rangeEndField.Value   = newValue.end;

                return(base.Refresh());
            }
        /// <summary>Initializes the struct with default values.</summary>
        public static CharRange Default()
        {
            CharRange value = new CharRange();

            value.start = 0;
            value.end   = 0;

            return(value);
        }
Пример #3
0
            /// <inheritdoc/>
            protected override GUILayoutX CreateGUI(GUILayoutY layout)
            {
                GUILayoutX titleLayout = layout.AddLayoutX();

                rangeStartField = new GUIIntField(new LocEdString(SeqIndex + ". Start"));
                rangeEndField   = new GUIIntField(new LocEdString("End"));

                titleLayout.AddElement(rangeStartField);
                titleLayout.AddElement(rangeEndField);

                rangeStartField.OnChanged += x =>
                {
                    CharRange range = GetValue <CharRange>();
                    range.start = x;
                    SetValue(range);

                    MarkAsModified();
                };

                rangeEndField.OnChanged += x =>
                {
                    CharRange range = GetValue <CharRange>();
                    range.end = x;
                    SetValue(range);

                    MarkAsModified();
                };

                rangeStartField.OnFocusLost += ConfirmModify;
                rangeStartField.OnConfirmed += ConfirmModify;

                rangeEndField.OnFocusLost += ConfirmModify;
                rangeEndField.OnConfirmed += ConfirmModify;

                return(titleLayout);
            }