Esempio n. 1
0
        public Button(View parent, View layoutParent = null, string id = null, Template template = null, Action <View> initializer = null) :
            base(parent, layoutParent, id, template ?? ButtonTemplates.Default, initializer)
        {
            // constructing Label (Label)
            Label = new Label(this, this, "Label", LabelTemplate);

            // binding <Label Offset="{TextOffset}">
            Bindings.Add(new Binding(new List <BindingPath> {
                new BindingPath(new List <string> {
                    "TextOffset"
                }, new List <Func <BindableObject> > {
                    () => this
                })
            }, new BindingPath(new List <string> {
                "Label", "Offset"
            }, new List <Func <BindableObject> > {
                () => this, () => Label
            }), () => Label.Offset = TextOffset, () => { }, false));
            Click.RegisterHandler(this, "ButtonMouseClick");
            MouseEnter.RegisterHandler(this, "ButtonMouseEnter");
            MouseExit.RegisterHandler(this, "ButtonMouseExit");
            MouseDown.RegisterHandler(this, "ButtonMouseDown");
            MouseUp.RegisterHandler(this, "ButtonMouseUp");
            this.AfterInitializeInternal();
        }
Esempio n. 2
0
        /// <summary>
        /// Raises the <see cref="MouseExit"/> event.
        /// </summary>
        /// <param name="state">Current mouse state in relation to this console.</param>
        protected virtual void OnMouseExit(MouseScreenObjectState state)
        {
            // Force mouse off just in case
            IsMouseOver = false;

            MouseExit?.Invoke(this, state);
        }
Esempio n. 3
0
 public void OnPointerExit(PointerEventData eventData)
 {
     if (MouseExit != null)
     {
         MouseExit.Invoke(this, eventData);
     }
 }
Esempio n. 4
0
        /// <summary>
        /// Called when the mouse exits the area of the control. Raises the MouseExit event and calls the <see cref="DetermineAppearance"/> method.
        /// </summary>
        /// <param name="state">The current mouse data</param>
        protected virtual void OnMouseExit(Input.MouseConsoleState state)
        {
            isMouseOver = false;
            MouseExit?.Invoke(this, new MouseEventArgs(state));

            DetermineAppearance();
        }
Esempio n. 5
0
        /// <summary>
        /// Raises the <see cref="MouseExit"/> event.
        /// </summary>
        /// <param name="state">Current mouse state in relation to this console.</param>
        protected virtual void OnMouseExit(MouseConsoleState state)
        {
            // Force mouse off just in case
            IsMouseOver = false;

            MouseExit?.Invoke(this, new MouseEventArgs(state));
        }
Esempio n. 6
0
 public ListItem(View parent, View layoutParent = null, string id = null, Template template = null, Action <View> initializer = null) :
     base(parent, layoutParent, id, template ?? ListItemTemplates.Default, initializer)
 {
     Click.RegisterHandler(this, "ListItemMouseClick");
     MouseEnter.RegisterHandler(this, "ListItemMouseEnter");
     MouseExit.RegisterHandler(this, "ListItemMouseExit");
     MouseDown.RegisterHandler(this, "ListItemMouseDown");
     MouseUp.RegisterHandler(this, "ListItemMouseUp");
     this.AfterInitializeInternal();
 }
Esempio n. 7
0
        public Button(View parent, View layoutParent = null, string id = null, Template template = null, bool deferInitialization = false) :
            base(parent, layoutParent, id, template ?? ButtonTemplates.Default, deferInitialization)
        {
            if (deferInitialization)
            {
                return;
            }

            // constructing Label (Label)
            Label = new Label(this, this, "Label", LabelTemplate);

            // binding <Label Offset="{TextOffset}">
            Bindings.Add(new Binding(new List <BindingPath> {
                new BindingPath(new List <string> {
                    "TextOffset"
                }, new List <Func <object> > {
                    () => this
                })
            }, new BindingPath(new List <string> {
                "Label", "Offset"
            }, new List <Func <object> > {
                () => this, () => Label
            }), () => Label.Offset = TextOffset, () => { }, false));

            // binding <Label IsActive="{DisplayLabel}">
            Bindings.Add(new Binding(new List <BindingPath> {
                new BindingPath(new List <string> {
                    "DisplayLabel"
                }, new List <Func <object> > {
                    () => this
                })
            }, new BindingPath(new List <string> {
                "Label", "IsActive"
            }, new List <Func <object> > {
                () => this, () => Label
            }), () => Label.IsActive = DisplayLabel, () => { }, false));
            this.StateAnimations.Clear();
            var stateAnimation0 = new StateAnimation(AnyStateName, "Highlighted");

            stateAnimation0.Add(new Animator <UnityEngine.Color>(this, 0.05f, 0f, false, false, 0f, false, EasingFunctions.Get("Linear"), Delight.ColorValueConverter.Interpolator, x => this.BackgroundColor = x, () => this.BackgroundColor, () => Button.BackgroundColorProperty.NotifyPropertyChanged(this), Button.BackgroundColorProperty, AnyStateName, "Highlighted"));
            stateAnimation0.Add(new Animator <UnityEngine.Color>(this, 0.05f, 0f, false, false, 0f, false, EasingFunctions.Get("Linear"), Delight.ColorValueConverter.Interpolator, x => this.FontColor       = x, () => this.FontColor, () => Button.FontColorProperty.NotifyPropertyChanged(this), Button.FontColorProperty, AnyStateName, "Highlighted"));
            this.StateAnimations.Add(stateAnimation0);
            var stateAnimation1 = new StateAnimation("Highlighted", DefaultStateName);

            stateAnimation1.Add(new Animator <UnityEngine.Color>(this, 0.5f, 0f, false, false, 0f, false, EasingFunctions.Get("Linear"), Delight.ColorValueConverter.Interpolator, x => this.BackgroundColor = x, () => this.BackgroundColor, () => Button.BackgroundColorProperty.NotifyPropertyChanged(this), Button.BackgroundColorProperty, "Highlighted", DefaultStateName));
            stateAnimation1.Add(new Animator <UnityEngine.Color>(this, 0.5f, 0f, false, false, 0f, false, EasingFunctions.Get("Linear"), Delight.ColorValueConverter.Interpolator, x => this.FontColor       = x, () => this.FontColor, () => Button.FontColorProperty.NotifyPropertyChanged(this), Button.FontColorProperty, "Highlighted", DefaultStateName));
            this.StateAnimations.Add(stateAnimation1);
            Click.RegisterHandler(this, "ButtonMouseClick");
            MouseEnter.RegisterHandler(this, "ButtonMouseEnter");
            MouseExit.RegisterHandler(this, "ButtonMouseExit");
            MouseDown.RegisterHandler(this, "ButtonMouseDown");
            MouseUp.RegisterHandler(this, "ButtonMouseUp");
            this.AfterInitializeInternal();
        }
Esempio n. 8
0
        private void OnMouseExit()
        {
            this.isHovered = false;

            OnPointerExit();

            MouseExit?.Invoke();

            if (this.showTooltip)
            {
                ObjectTooltip.Instance.Hide();
            }
        }
Esempio n. 9
0
 public GridSplitterHandle(View parent, View layoutParent = null, string id = null, Template template = null, Action <View> initializer = null) :
     base(parent, layoutParent, id, template ?? GridSplitterHandleTemplates.Default, initializer)
 {
     // constructing Image (SplitterHandle)
     SplitterHandle = new Image(this, this, "SplitterHandle", SplitterHandleTemplate);
     Drag.RegisterHandler(this, "OnDrag");
     BeginDrag.RegisterHandler(this, "OnBeginDrag");
     InitializePotentialDrag.RegisterHandler(this, "OnInitializePotentialDrag");
     EndDrag.RegisterHandler(this, "OnEndDrag");
     MouseEnter.RegisterHandler(this, "OnMouseEnter");
     MouseExit.RegisterHandler(this, "OnMouseExit");
     ContentContainer = SplitterHandle;
     this.AfterInitializeInternal();
 }
Esempio n. 10
0
        public ListItem(View parent, View layoutParent = null, string id = null, Template template = null, bool deferInitialization = false) :
            base(parent, layoutParent, id, template ?? ListItemTemplates.Default, deferInitialization)
        {
            if (deferInitialization)
            {
                return;
            }

            Click.RegisterHandler(this, "ListItemMouseClick");
            MouseEnter.RegisterHandler(this, "ListItemMouseEnter");
            MouseExit.RegisterHandler(this, "ListItemMouseExit");
            MouseDown.RegisterHandler(this, "ListItemMouseDown");
            MouseUp.RegisterHandler(this, "ListItemMouseUp");
            SetListItemState = new AttachedProperty <System.Boolean>(this, "SetListItemState");
            this.AfterInitializeInternal();
        }
Esempio n. 11
0
 private void OnMouseExit()
 {
     //int d = (Text.text == ">2") ? 3 : int.Parse(Text.text);
     MouseExit?.Invoke();
 }
Esempio n. 12
0
 internal void DispatchMouseExit(Point mousePosition)
 {
     MouseExit?.Invoke(this, mousePosition);
 }
Esempio n. 13
0
 public void OnMouseExit()
 {
     MouseExit?.Invoke(this, new EventArgs());
 }
Esempio n. 14
0
 private void OnMouseExit()
 {
     MouseExit.Invoke();
 }
Esempio n. 15
0
 protected override void OnCursorExit() => MouseExit?.Invoke(this, EventArgs.Empty);
Esempio n. 16
0
 private void OnMouseLeave()
 {
     MouseExit?.Invoke(this, new MouseClickEventArgs(-1));
     lastMouseOver = null;
 }
Esempio n. 17
0
        internal bool HandledMouseMove()
        {
            if (!Visible || !enabled)
            {
                return(false);
            }

            var mousePos       = Input.Manager.MousePosition;
            var globalPosition = GlobalPosition;

            if (!(
                    mousePos.X >= globalPosition.X && mousePos.X <= globalPosition.X + Size.X &&
                    mousePos.Y >= globalPosition.Y && mousePos.Y <= globalPosition.Y + Size.Y
                    ))
            {
                if (MouseInBounds)
                {
                    MouseInBounds     = false;
                    MouseDirectlyOver = false;

                    if (RegisterEventTypes.HasFlag(EventType.MouseEnterExit))
                    {
                        OnMouseExit();
                        MouseExit?.Invoke(this, EventArgs.Empty);
                    }
                }

                return(false);
            }

            var ret = false;

            MouseDirectlyOver = true;

            if (!MouseInBounds)
            {
                MouseInBounds = true;

                if (RegisterEventTypes.HasFlag(EventType.MouseEnterExit))
                {
                    OnMouseEnter();
                    MouseEnter?.Invoke(this, EventArgs.Empty);
                    ret = true;
                }
            }

            for (var index = children.Count - 1; index >= 0; --index)
            {
                if (children[index].HandledMouseMove())
                {
                    if (MouseDirectlyOver)
                    {
                        MouseDirectlyOver = false;
                    }

                    return(true);
                }
            }

            return(ret);
        }
Esempio n. 18
0
 private void OnMouseExit()
 {
     MouseExit?.Invoke(this, EventArgs.Empty);
 }