Esempio n. 1
0
        /// <summary>
        /// Called when a key is pressed, including mouse buttons. Returns true if this control consumed the event, otherwise false.
        /// </summary>
        /// <param name="E"></param>
        /// <returns></returns>
        public virtual bool OnKey(OnKeyEventArgs E)
        {
            if (E.Consumed)
            {
                return(false);
            }

            foreach (var C in Children)
            {
                C.OnKey(E);

                if (E.Consumed)
                {
                    return(false);
                }
            }

            if (E.Key == Key.MouseLeft)
            {
                if (IsInside(E.MousePos))
                {
                    if (E.Pressed)
                    {
                        WasMousePressedDown = true;
                    }
                    else if (WasMousePressedDown)
                    {
                        WasMousePressedDown = false;
                        OnMouseClick(E);
                    }
                }
                else
                {
                    WasMousePressedDown = false;
                }
            }

            return(false);
        }
Esempio n. 2
0
 public override void OnMouseClick(OnKeyEventArgs E)
 {
     Checked = !Checked;
     OnToggled?.Invoke(this, new OnCheckBoxToggledEventArgs(GUI, Checked));
 }
Esempio n. 3
0
 /// <summary>
 /// Called when a pressed key is being released from the control.
 /// Mouse does not have to be inside of the control for this event to occur
 /// </summary>
 /// <param name="E"></param>
 public virtual void OnEndHold(OnKeyEventArgs E)
 {
 }
Esempio n. 4
0
 /// <summary>
 /// Called when a mouse key is being pressed on the control
 /// </summary>
 /// <param name="E"></param>
 public virtual void OnBeginHold(OnKeyEventArgs E)
 {
 }
Esempio n. 5
0
 /// <summary>
 /// Called when mouse is pressed and then released inside of the control. Pressed is always false here.
 /// </summary>
 /// <param name="E"></param>
 public virtual void OnMouseClick(OnKeyEventArgs E)
 {
 }