public void Init(OnChange onChange, int itemCount, Vector2? normalizedPosition = null)
 {
     Clear();
     InitScroller();
     InitGrid();
     InitChildren(onChange, itemCount);
     InitTransform(normalizedPosition);
 }
 public void Setup(int active, int mask, List<TilerMap> layers, OnChange activeChange, OnChange visibleChange, OnOrderChange orderChange)
 {
     _active = active;
     _mask = mask;
     _layers = layers;
     _activeChange = activeChange;
     _visibleChange = visibleChange;
     _orderChange = orderChange;
 }
 public void Ready(bool isReady) => OnChange?.Invoke(isReady);
Example #4
0
 private void NotifyDataChanged() => OnChange?.Invoke();
Example #5
0
        /// <inheritdoc />
        protected override void BuildRenderTree(RenderTreeBuilder builder)
        {
            // Label
            BuildRenderTreeLabel(builder);

            if (HasInputGroup)
            {
                // <div>
                builder.OpenElement(0, Html.DIV);
                builder.AddAttribute(1, Html.CLASS, Bootstrap.INPUT_GROUP);
            }

            if (HasPrepend)
            {
                // <div>
                builder.OpenElement(2, Html.DIV);
                builder.AddAttribute(3, Html.CLASS, Bootstrap.INPUT_GROUP_PREPEND);

                // <span>
                builder.OpenElement(4, Html.SPAN);
                builder.AddAttribute(5, Html.CLASS, Bootstrap.INPUT_GROUP_TEXT);
                builder.AddContent(6, Prepend);
                builder.CloseElement();
                // </span>

                // </div>
                builder.CloseElement();
            }

            // Input
            builder.OpenElement(7, Html.INPUT);
            builder.AddMultipleAttributes(8, Attributes);
            builder.AddAttribute(9, Html.TYPE, "number");
            builder.AddAttribute(10, Html.VALUE, BindConverter.FormatValue(CurrentValueAsString));
            builder.AddAttribute(11, Html.CLASS, CssClass);             // Overwrite class in Attributes

            // Data Binding & OnChange
            builder.AddAttribute(12, Html.ONCHANGE, EventCallback.Factory.CreateBinder <string>(this, async(__value) =>
            {
                // Bind
                CurrentValueAsString = __value;

                // OnChange
                if (OnChange.HasDelegate)
                {
                    await OnChange.InvokeAsync(new ChangeEventArgs {
                        Value = __value
                    });
                }
            }, CurrentValueAsString));

            // OnBlur
            if (OnBlur.HasDelegate)
            {
                builder.AddAttribute(13, "onblur", EventCallback.Factory.Create(this, async(__value) =>
                {
                    await OnBlur.InvokeAsync(new EventArgs());
                }));
            }

            // OnFocus
            if (OnFocus.HasDelegate)
            {
                builder.AddAttribute(13, "onfocus", EventCallback.Factory.Create(this, async(__value) =>
                {
                    await OnFocus.InvokeAsync(new EventArgs());
                }));
            }

            // Disabled?
            if (Disabled ?? false)
            {
                builder.AddAttribute(20, Html.DISABLED, string.Empty);
            }

            // Help
            if (HasHelp)
            {
                builder.AddAttribute(21, Html.ARIA_DESCRIBEDBY, $"{Id}-help");
            }

            builder.CloseElement();

            if (HasAppend)
            {
                // <div>
                builder.OpenElement(22, Html.DIV);
                builder.AddAttribute(23, Html.CLASS, "input-group-append");

                // <span>
                builder.OpenElement(24, Html.SPAN);
                builder.AddAttribute(25, Html.CLASS, Bootstrap.INPUT_GROUP_TEXT);
                builder.AddContent(26, Append);
                builder.CloseElement();
                // </span>

                // </div>
                builder.CloseElement();
            }

            if (HasInputGroup)
            {
                // </div>
                builder.CloseElement();
            }

            // Help
            BuildRenderTreeHelp(builder);
        }
Example #6
0
 void InternalOnChange()
 {
     Assert.IsTrue(CheckSizes());
     Sortkeyframes();
     OnChange.SafeInvoke();
 }
Example #7
0
 public RandomizableFieldValue(string label, OnChange <T> onChange, GetValue <T> getValue, T min, T max, T d, OnChange <bool> onRandomizableChange, GetValue <bool> getRandomizableValue)
     : base(label, onChange, getValue, min, max, d)
 {
     this.OnRandomizableChange = onRandomizableChange;
     this.GetRandomizableValue = getRandomizableValue;
 }
 public void CompleteModifications()
 {
     OnChange.Invoke(Value);
 }
        public void Decode(byte[] bytes, Iterator it = null)
        {
            var decode = Decoder.GetInstance();

            if (it == null)
            {
                it = new Iterator();
            }

            var changes    = new List <DataChange>();
            var totalBytes = bytes.Length;

            // skip TYPE_ID of existing instances
            if (bytes[it.Offset] == (byte)SPEC.TYPE_ID)
            {
                it.Offset += 2;
            }

            while (it.Offset < totalBytes)
            {
                var index = bytes[it.Offset++];

                if (index == (byte)SPEC.END_OF_STRUCTURE)
                {
                    break;
                }

                var field     = fieldsByIndex[index];
                var fieldType = fieldTypes[field];

                System.Type childType;
                fieldChildTypes.TryGetValue(field, out childType);

                string childPrimitiveType;
                fieldChildPrimitiveTypes.TryGetValue(field, out childPrimitiveType);

                object value = null;

                object change    = null;
                bool   hasChange = false;

                if (fieldType == "ref")
                {
                    // child schema type
                    if (decode.NilCheck(bytes, it))
                    {
                        it.Offset++;
                        value = null;
                    }
                    else
                    {
                        value = this[field] ?? CreateTypeInstance(bytes, it, childType);
                        (value as Schema).Decode(bytes, it);
                    }

                    hasChange = true;
                }

                // Array type
                else if (fieldType == "array")
                {
                    change = new List <object>();

                    ISchemaCollection valueRef     = (ISchemaCollection)(this[field] ?? Activator.CreateInstance(childType));
                    ISchemaCollection currentValue = valueRef.Clone();

                    int newLength  = Convert.ToInt32(decode.DecodeNumber(bytes, it));
                    int numChanges = Math.Min(Convert.ToInt32(decode.DecodeNumber(bytes, it)), newLength);

                    hasChange = (numChanges > 0);

                    bool hasIndexChange = false;

                    // ensure current array has the same length as encoded one
                    if (currentValue.Count > newLength)
                    {
                        IDictionary items = currentValue.GetItems();

                        for (var i = newLength; i < currentValue.Count; i++)
                        {
                            var item = currentValue[i];
                            if (item is Schema)
                            {
                                (item as Schema).OnRemove?.Invoke();
                            }

                            items.Remove(i);
                            currentValue.InvokeOnRemove(item, i);
                        }
                    }

                    for (var i = 0; i < numChanges; i++)
                    {
                        var newIndex = Convert.ToInt32(decode.DecodeNumber(bytes, it));

                        int indexChangedFrom = -1;
                        if (decode.IndexChangeCheck(bytes, it))
                        {
                            decode.DecodeUint8(bytes, it);
                            indexChangedFrom = Convert.ToInt32(decode.DecodeNumber(bytes, it));
                            hasIndexChange   = true;
                        }

                        var isNew = (!hasIndexChange && currentValue[newIndex] == null) || (hasIndexChange && indexChangedFrom != -1);

                        if (currentValue.HasSchemaChild)
                        {
                            Schema item = null;

                            if (isNew)
                            {
                                item = (Schema)CreateTypeInstance(bytes, it, currentValue.GetChildType());
                            }
                            else if (indexChangedFrom != -1)
                            {
                                item = (Schema)valueRef[indexChangedFrom];
                            }
                            else
                            {
                                item = (Schema)valueRef[newIndex];
                            }

                            if (item == null)
                            {
                                item  = (Schema)CreateTypeInstance(bytes, it, currentValue.GetChildType());
                                isNew = true;
                            }

                            if (decode.NilCheck(bytes, it))
                            {
                                it.Offset++;
                                valueRef.InvokeOnRemove(item, newIndex);
                                continue;
                            }

                            item.Decode(bytes, it);
                            currentValue[newIndex] = item;
                        }
                        else
                        {
                            currentValue[newIndex] = decode.DecodePrimitiveType(childPrimitiveType, bytes, it);
                        }

                        if (isNew)
                        {
                            currentValue.InvokeOnAdd(currentValue[newIndex], newIndex);
                        }
                        else
                        {
                            currentValue.InvokeOnChange(currentValue[newIndex], newIndex);
                        }

                        (change as List <object>).Add(currentValue[newIndex]);
                    }

                    value = currentValue;
                }

                // Map type
                else if (fieldType == "map")
                {
                    ISchemaCollection valueRef     = (ISchemaCollection)(this[field] ?? Activator.CreateInstance(childType));
                    ISchemaCollection currentValue = valueRef.Clone();

                    int length = Convert.ToInt32(decode.DecodeNumber(bytes, it));
                    hasChange = (length > 0);

                    bool hasIndexChange = false;

                    OrderedDictionary items   = currentValue.GetItems() as OrderedDictionary;
                    string[]          mapKeys = new string[items.Keys.Count];
                    items.Keys.CopyTo(mapKeys, 0);

                    for (var i = 0; i < length; i++)
                    {
                        // `encodeAll` may indicate a higher number of indexes it actually encodes
                        // TODO: do not encode a higher number than actual encoded entries
                        if (it.Offset > bytes.Length || bytes[it.Offset] == (byte)SPEC.END_OF_STRUCTURE)
                        {
                            break;
                        }

                        string previousKey = null;
                        if (decode.IndexChangeCheck(bytes, it))
                        {
                            it.Offset++;
                            previousKey    = mapKeys[Convert.ToInt32(decode.DecodeNumber(bytes, it))];
                            hasIndexChange = true;
                        }

                        bool hasMapIndex  = decode.NumberCheck(bytes, it);
                        bool isSchemaType = childType != null;

                        string newKey = (hasMapIndex)
                ? mapKeys[Convert.ToInt32(decode.DecodeNumber(bytes, it))]
                : decode.DecodeString(bytes, it);

                        object item;
                        bool   isNew = (!hasIndexChange && valueRef[newKey] == null) || (hasIndexChange && previousKey == null && hasMapIndex);

                        if (isNew && isSchemaType)
                        {
                            item = (Schema)CreateTypeInstance(bytes, it, currentValue.GetChildType());
                        }
                        else if (previousKey != null)
                        {
                            item = valueRef[previousKey];
                        }
                        else
                        {
                            item = valueRef[newKey];
                        }

                        if (decode.NilCheck(bytes, it))
                        {
                            it.Offset++;

                            if (item != null)
                            {
                                (item as Schema).OnRemove?.Invoke();
                            }

                            valueRef.InvokeOnRemove(item, newKey);
                            items.Remove(newKey);
                            continue;
                        }
                        else if (!isSchemaType)
                        {
                            currentValue[newKey] = decode.DecodePrimitiveType(childPrimitiveType, bytes, it);
                        }
                        else
                        {
                            (item as Schema).Decode(bytes, it);
                            currentValue[newKey] = item;
                        }

                        if (isNew)
                        {
                            currentValue.InvokeOnAdd(currentValue[newKey], newKey);
                        }
                        else
                        {
                            currentValue.InvokeOnChange(currentValue[newKey], newKey);
                        }
                    }

                    value = currentValue;
                }

                // Primitive type
                else
                {
                    value     = decode.DecodePrimitiveType(fieldType, bytes, it);
                    hasChange = true;
                }

                if (hasChange)
                {
                    changes.Add(new DataChange
                    {
                        Field         = field,
                        Value         = (change != null) ? change : value,
                        PreviousValue = this[field]
                    });
                }

                this[field] = value;
            }

            if (changes.Count > 0)
            {
                OnChange?.Invoke(changes);
            }
        }
Example #10
0
        public void NotifyStateChanged()
        {
            Logging.LogVerbose($"Filter changed: {query}");

            OnChange?.Invoke();
        }
Example #11
0
 void FoodChanged() => OnChange.Invoke();
Example #12
0
 public void SetNextStep(IStep?step)
 {
     NextStep = step;
     OnChange?.Invoke();
 }
Example #13
0
        public void OnDeserializeDelta(NetworkReader reader)
        {
            // This list can now only be modified by synchronization
            IsReadOnly = true;
            bool raiseOnChange = false;

            int changesCount = (int)reader.ReadPackedUInt32();

            for (int i = 0; i < changesCount; i++)
            {
                var operation = (Operation)reader.ReadByte();

                // apply the operation only if it is a new change
                // that we have not applied yet
                bool   apply   = changesAhead == 0;
                TKey   key     = default;
                TValue item    = default;
                TValue oldItem = default;

                switch (operation)
                {
                case Operation.OP_ADD:
                    key  = DeserializeKey(reader);
                    item = DeserializeItem(reader);
                    if (apply)
                    {
                        objects[key] = item;
                    }
                    break;

                case Operation.OP_SET:
                    key  = DeserializeKey(reader);
                    item = DeserializeItem(reader);
                    if (apply)
                    {
                        oldItem      = objects[key];
                        objects[key] = item;
                    }
                    break;

                case Operation.OP_CLEAR:
                    if (apply)
                    {
                        objects.Clear();
                    }
                    break;

                case Operation.OP_REMOVE:
                    key  = DeserializeKey(reader);
                    item = DeserializeItem(reader);
                    if (apply)
                    {
                        objects.Remove(key);
                    }
                    break;
                }

                if (apply)
                {
                    RaiseEvents(operation, key, item, oldItem);
                    raiseOnChange = true;
                }
                // we just skipped this change
                else
                {
                    changesAhead--;
                }
            }

            if (raiseOnChange)
            {
                OnChange?.Invoke();
            }
        }
Example #14
0
 public void SetPreviousStep(IStep?step)
 {
     PreviousStep = step;
     OnChange?.Invoke();
 }
Example #15
0
 private void ProcessChanging(float amount)
 {
     gold += amount;
     OnChange?.Invoke();
 }
 void BananasChanged() => OnChange.Invoke();
Example #17
0
 public enumFloatMenu(string label, OnChange <E> onChange, E e) : base(label, null)
 {
     this.e      = e;
     base.action = () => onChange(this.e);
 }
Example #18
0
 /// <summary>
 /// Invokes OnChange event.
 /// </summary>
 private void InvokeChange() => OnChange?.Invoke(mapsets);
Example #19
0
 protected void OnChangeEvent(EventArgs e)
 {
     OnChange?.Invoke(this, e);
 }
Example #20
0
        public AtemClientExt(string deviceId, AtemClient client, IHubContext <DevicesHub> context, TransferJobMonitor transfers, HashSet <string> subscriptions)
        {
            _deviceId      = deviceId;
            _profile       = new DeviceProfileHandler();
            _subscriptions = subscriptions;
            _state         = new AtemState();
            _context       = context;
            _mediaCache    = new AtemMediaCache(transfers);

            Client               = client;
            Client.OnReceive    += _profile.HandleCommands;
            Client.OnConnection += sender =>
            {
                Connected = true;
                OnChange?.Invoke(this);
                SendState(GetState());
            };
            Client.OnDisconnect += sender =>
            {
                Connected = false;
                OnChange?.Invoke(this);
                SendState(null);
            };

            Client.OnReceive += (sender, commands) =>
            {
                var changedPaths = new HashSet <string>();
                var errors       = new List <string>();
                lock (_state)
                {
                    foreach (var command in commands)
                    {
                        var res = AtemStateBuilder.Update(_state, command);
                        changedPaths.AddRange(res.ChangedPaths);

                        if (!res.Success)
                        {
                            if (res.Errors.Count > 0)
                            {
                                errors.AddRange(res.Errors);
                            }
                            else
                            {
                                errors.Add($"Failed to update state for {command.GetType().Name}");
                            }
                        }
                    }
                }

                AtemState newState = GetState();

                /*
                 * var diffs = new Dictionary<string, object>();
                 * foreach (string path in changedPaths)
                 * {
                 *  diffs.Add(path, new object()); // TODO
                 * }*/

                SendStateDiff(GetState(), changedPaths);

                _mediaCache.EnsureMediaIsDownloaded(Client, newState);
            };


            Client.DataTransfer.OnJobStarted += (sender, job) => transfers.JobStarted(deviceId, job);
            Client.DataTransfer.OnJobQueued  += (sender, job) => transfers.JobQueued(deviceId, job);
        }
Example #21
0
 public void InvokeOnChange(object item, object index)
 {
     OnChange?.Invoke((T)item, (string)index);
 }
 /// <summary>
 /// Triggers OnChange event.
 /// </summary>
 public void FinishModifications()
 {
     OnChange.Invoke(Value);
 }
Example #23
0
 public void Change(ChangeType type, ChangeContext context, int index, object additionalInfo = null)
 {
     OnChange?.Invoke(this, new ChangeEventArgs(type, context, index, additionalInfo));
 }
Example #24
0
        protected override void UpdateAfterChildren()
        {
            base.UpdateAfterChildren();

            //have to run this after children flow
            cursorAndLayout.Refresh(delegate
            {
                textUpdateScheduler.Update();

                Vector2 cursorPos = Vector2.Zero;
                if (InternalText?.Length > 0)
                {
                    cursorPos.X = getPositionAt(selectionLeft);
                }

                float cursorPosEnd = getPositionAt(selectionEnd);

                float cursorWidth = 2;

                if (selectionLength > 0)
                {
                    cursorWidth = getPositionAt(selectionRight) - cursorPos.X;
                }

                float cursorRelativePositionAxesInBox = (cursorPosEnd - textContainerPosX) / DrawWidth;

                //we only want to reposition the view when the cursor reaches near the extremities.
                if (cursorRelativePositionAxesInBox < 0.1 || cursorRelativePositionAxesInBox > 0.9)
                {
                    textContainerPosX = cursorPosEnd - DrawWidth / 2;
                }

                textContainerPosX = MathHelper.Clamp(textContainerPosX, 0, Math.Max(0, textFlow.DrawWidth - DrawWidth));

                textContainer.MoveToX(-textContainerPosX, 300, EasingTypes.OutExpo);

                if (HasFocus)
                {
                    cursor.ClearTransformations();
                    cursor.MoveTo(cursorPos, 60, EasingTypes.Out);
                    cursor.ScaleTo(new Vector2(cursorWidth, 1), 60, EasingTypes.Out);

                    if (selectionLength > 0)
                    {
                        cursor.FadeTo(0.5f, 200, EasingTypes.Out);
                        cursor.FadeColour(new Color4(249, 90, 255, 255), 200, EasingTypes.Out);
                    }
                    else
                    {
                        cursor.FadeTo(0.5f, 200, EasingTypes.Out);
                        cursor.FadeColour(Color4.White, 200, EasingTypes.Out);
                        cursor.Transforms.Add(new TransformAlpha
                        {
                            StartValue = 0.5f,
                            EndValue   = 0.2f,
                            StartTime  = Time.Current,
                            EndTime    = Time.Current + 500,
                            Easing     = EasingTypes.InOutSine,
                            LoopCount  = -1,
                        });
                    }
                }

                OnChange?.Invoke(this, textAtLastLayout != InternalText);
                textAtLastLayout = InternalText;

                return(cursorPos);
            });
        }
Example #25
0
 internal override void ApplyOwner(IDocumentEssential owner)
 {
     Owner = owner;
     if (OnMouseEnter != null)
     {
         OnMouseEnter.ApplyOwner(owner);
     }
     if (OnMouseExit != null)
     {
         OnMouseExit.ApplyOwner(owner);
     }
     if (OnMouseDown != null)
     {
         OnMouseDown.ApplyOwner(owner);
     }
     if (OnMouseUp != null)
     {
         OnMouseUp.ApplyOwner(owner);
     }
     if (OnReceiveFocus != null)
     {
         OnReceiveFocus.ApplyOwner(owner);
     }
     if (OnLoseFocus != null)
     {
         OnLoseFocus.ApplyOwner(owner);
     }
     if (OnPageOpen != null)
     {
         OnPageOpen.ApplyOwner(owner);
     }
     if (OnPageClose != null)
     {
         OnPageClose.ApplyOwner(owner);
     }
     if (OnPageVisible != null)
     {
         OnPageVisible.ApplyOwner(owner);
     }
     if (OnPageInvisible != null)
     {
         OnPageInvisible.ApplyOwner(owner);
     }
     if (OnKeyPressed != null)
     {
         OnKeyPressed.ApplyOwner(owner);
     }
     if (OnBeforeFormatting != null)
     {
         OnBeforeFormatting.ApplyOwner(owner);
     }
     if (OnChange != null)
     {
         OnChange.ApplyOwner(owner);
     }
     if (OnOtherFieldChanged != null)
     {
         OnOtherFieldChanged.ApplyOwner(owner);
     }
     if (OnActivated != null)
     {
         OnActivated.ApplyOwner(owner);
     }
 }
 public void onChange(OnChange change)
 {
     changeListeners.Add(change);
 }
Example #27
0
 /// <summary>
 /// Invokes OnChange Action to notify subscribers state has changed.
 /// </summary>
 private void NotifyStateChanged() => OnChange?.Invoke();
        private void InitChildren(OnChange onChange, int itemCount)
        {
            _onChange = onChange;
            _itemCount = itemCount;
            _col = (int)((_scrollerRect.width + _spacing.x) / ItemSize.x);
            _row = (int)((_scrollerRect.height + _spacing.y) / ItemSize.y);
            if (_moveType == Movement.Horizontal)
            {
                _col += 2;
            }
            else
            {
                _row += 2;
            }
            _transCount = _col * _row;

            if (_transCount > _itemCount)
            {
                _transCount = _itemCount;
            }

            for (int i = 0; i < _transCount; i++)
            {
                Transform item = _grid.transform.AddChildFromPrefab(_itemPrefab, i.ToString());
                InitChild(item.GetComponent<RectTransform>(), i);
                _onChange(item, i);
                _transIndexSet.Add(i);
                _transDict.Add(i, item.GetComponent<RectTransform>());
            }
        }
Example #29
0
        /// <summary> Adds the events for this html element directly to the text writer output </summary>
        /// <param name="Output"> Output to write directly to </param>
        public void Add_Events_HTML(TextWriter Output)
        {
            if (!String.IsNullOrWhiteSpace(OnClick))
            {
                Output.Write("onclick=\"" + OnClick.Replace("\"", "'") + "\" ");
            }

            if (!String.IsNullOrWhiteSpace(OnContextMenu))
            {
                Output.Write("oncontextmenu=\"" + OnContextMenu.Replace("\"", "'") + "\" ");
            }

            if (!String.IsNullOrWhiteSpace(OnDblClick))
            {
                Output.Write("ondblclick=\"" + OnDblClick.Replace("\"", "'") + "\" ");
            }

            if (!String.IsNullOrWhiteSpace(OnMouseDown))
            {
                Output.Write("onmousedown=\"" + OnMouseDown.Replace("\"", "'") + "\" ");
            }

            if (!String.IsNullOrWhiteSpace(OnMouseEnter))
            {
                Output.Write("onmouseenter=\"" + OnMouseEnter.Replace("\"", "'") + "\" ");
            }

            if (!String.IsNullOrWhiteSpace(OnMouseLeave))
            {
                Output.Write("onmouseleave=\"" + OnMouseLeave.Replace("\"", "'") + "\" ");
            }

            if (!String.IsNullOrWhiteSpace(OnMouseMove))
            {
                Output.Write("onmousemove=\"" + OnMouseMove.Replace("\"", "'") + "\" ");
            }

            if (!String.IsNullOrWhiteSpace(OnMouseOver))
            {
                Output.Write("onmouseover=\"" + OnMouseOver.Replace("\"", "'") + "\" ");
            }

            if (!String.IsNullOrWhiteSpace(OnMouseOut))
            {
                Output.Write("onmouseout=\"" + OnMouseOut.Replace("\"", "'") + "\" ");
            }

            if (!String.IsNullOrWhiteSpace(OnMouseUp))
            {
                Output.Write("onmouseup=\"" + OnMouseUp.Replace("\"", "'") + "\" ");
            }

            if (!String.IsNullOrWhiteSpace(OnKeyDown))
            {
                Output.Write("onkeydown=\"" + OnKeyDown.Replace("\"", "'") + "\" ");
            }

            if (!String.IsNullOrWhiteSpace(OnKeyPress))
            {
                Output.Write("onkeypress=\"" + OnKeyPress.Replace("\"", "'") + "\" ");
            }

            if (!String.IsNullOrWhiteSpace(OnKeyUp))
            {
                Output.Write("onkeyup=\"" + OnKeyUp.Replace("\"", "'") + "\" ");
            }

            if (!String.IsNullOrWhiteSpace(OnLoad))
            {
                Output.Write("onload=\"" + OnLoad.Replace("\"", "'") + "\" ");
            }

            if (!String.IsNullOrWhiteSpace(OnSelect))
            {
                Output.Write("onselect=\"" + OnSelect.Replace("\"", "'") + "\" ");
            }

            if (!String.IsNullOrWhiteSpace(OnChange))
            {
                Output.Write("onchange=\"" + OnChange.Replace("\"", "'") + "\" ");
            }

            if (!String.IsNullOrWhiteSpace(OnWheel))
            {
                Output.Write("onwheel=\"" + OnWheel.Replace("\"", "'") + "\" ");
            }
        }
Example #30
0
 private void NotifyLoggedOut() => OnChange?.Invoke();
Example #31
0
 public static bool DrawBoolInput(float x, ref float y, string label, bool value, OnChange <bool> onChange, string tip = "", float buttonWidth = 100f)
 {
     DrawLabel(x, y, 240, label);
     if (tip != "")
     {
         TooltipHandler.TipRegion(new Rect(x, y, 240 + buttonWidth, 32), tip);
     }
     if (Widgets.ButtonText(new Rect(x + 240, y, buttonWidth, 32), value.ToString().ToString()))
     {
         value = !value;
         onChange(value);
     }
     y += 40;
     return(value);
 }
Example #32
0
 protected void NotifyStateChanged()
 {
     OnChange?.Invoke();
     State.NotifyStateChanged();
 }
Example #33
0
 public static void DrawEnumSelection <E>(float x, ref float y, string label, E value, GetLabel <E> getLabel, OnChange <E> onChange) where E : System.Enum
 {
     Widgets.Label(new Rect(x, y, 150, 28), label.Translate());
     if (Widgets.ButtonText(new Rect(160, y, 100, 28), getLabel(value)))
     {
         E   e;
         var values = typeof(E).GetEnumValues();
         List <FloatMenuOption> l = new List <FloatMenuOption>(values.Length);
         for (int i = 0; i < values.Length; ++i)
         {
             e = (E)values.GetValue(i);
             l.Add(new enumFloatMenu <E>(getLabel(e), onChange, e));
         }
         ;
         Find.WindowStack.Add(new FloatMenu(l));
     }
     y += 35;
 }
 public void Setup(Filter filter, OnChange change)
 {
     _filter = filter;
     _onChange = change;
 }