Exemplo n.º 1
0
        /// <summary>
        /// Updates button skin to reflect current mouse state.
        /// </summary>
        /// <param name="args">Mouse event arguments.</param>
        protected override void OnMouseUp(MouseEventArgs args)
        {
            if (args.Button == MouseButtons.Left)
            {
                // Check that the mouse was depressed inside the button
                if (CheckCoordinates(args.Position.X, args.Position.Y))
                {
                    this.isChecked = !this.isChecked;

                    CurrentSkinState = SkinState.Hover;

                    if (this.isChecked)
                        CurrentSkinState = SkinState.CheckedHover;
                }
                else
                {
                    CurrentSkinState = SkinState.Normal;

                    if (this.isChecked)
                        CurrentSkinState = SkinState.Checked;
                }
            }

            base.OnMouseUp(args);
        }
Exemplo n.º 2
0
        //-------------------------------------------------------------------------
        public override bool injectMouseMove(MouseEventArgs e)
        {
            _interfaceMgr.injectMouseMove(e.Position);

            return base.injectMouseMove(e);
        }
Exemplo n.º 3
0
        /// <summary>
        /// Updates button skin to reflect current mouse state.
        /// </summary>
        /// <param name="args">Mouse event arguments.</param>
        protected override void OnMouseOut(MouseEventArgs args)
        {
            base.OnMouseOut(args);

            CurrentSkinState = SkinState.Normal;

            if (this.isChecked)
                CurrentSkinState = SkinState.Checked;
        }
Exemplo n.º 4
0
        /// <summary>
        /// Add highlight.
        /// </summary>
        /// <param name="args">Mouse event arguments.</param>
        protected override void OnMouseOver(MouseEventArgs args)
        {
            base.OnMouseOver(args);

            AddHighlight();
        }
Exemplo n.º 5
0
        /// <summary>
        /// If any menu is currently open, automatically open popups when the
        /// mouse hovers over the menu item.
        /// </summary>
        /// <param name="args">Mouse event arguments.</param>
        protected override void MouseMoveIntercept(MouseEventArgs args)
        {
            if (this.isPopUpShown && CheckCoordinates(args.Position.X, args.Position.Y))
            {
                foreach (MenuItem item in this.menuItems)
                {
                    if (item.CheckCoordinates(args.Position.X, args.Position.Y))
                    {
                        if (item != this.selectedMenuItem)
                        {
                            if (this.selectedMenuItem != null)
                                this.selectedMenuItem.ClosePopUp();

                            item.SelectByMove();
                        }
                        break;
                    }
                }
            }
        }
Exemplo n.º 6
0
 protected void OnButtonMouseOver(MouseEventArgs args)
 {
     if (!this.isListBoxOpen)
         this.button.CurrentSkinState = SkinState.Hover;
 }
Exemplo n.º 7
0
        /// <summary>
        /// Open popup menu if there is one.
        /// </summary>
        /// <param name="args"></param>
        protected override void OnMouseDown(MouseEventArgs args)
        {
            base.OnMouseDown(args);

            if (args.Button == MouseButtons.Left)
                Select();
        }
Exemplo n.º 8
0
 /// <summary>
 /// Invokes MouseOut event.
 /// </summary>
 /// <param name="args">Event arguments.</param>
 internal void InvokeMouseOut(MouseEventArgs args)
 {
     this.isMouseOver = false;
     MouseOut.Invoke(args);
 }
Exemplo n.º 9
0
 /// <summary>
 /// Invokes MouseOver event.
 /// </summary>
 /// <param name="args">Event arguments.</param>
 internal void InvokeMouseOver(MouseEventArgs args)
 {
     this.isMouseOver = true;
     MouseOver.Invoke(args);
 }
Exemplo n.º 10
0
        /// <summary>
        /// Used for click event. Override to handle event.
        /// </summary>
        /// <param name="args">Mouse event arguments.</param>
        protected virtual void OnMouseUp(MouseEventArgs args)
        {
            if (this.isPressed)
            {
                if (args.Button == MouseButtons.Left)
                {
                    this.isPressed = false;

                    // Check if button was clicked
                    if (CheckCoordinates(args.Position.X, args.Position.Y))
                    {
                        if (Click != null)
                            Click.Invoke(this);
                    }
                }
            }
        }
Exemplo n.º 11
0
        /// <summary>
        /// Asks children for their mouse status, and invokes MouseOut event
        /// for this control if necessary.
        /// </summary>
        /// <param name="args">Mouse event arguments.</param>
        /// <returns>Control asking for MouseOver event, otherwise null.</returns>
        internal UIComponent CheckMouseStatus(MouseEventArgs args)
        {
            UIComponent result = null;

            // Check if control can receive MouseOver and MouseOut events
            if (this.Visible)
            {
                // Check if MouseOut event should be invoked
                bool mouseOver = CheckCoordinates(args.Position.X, args.Position.Y);
                if (this.isMouseOver)
                {
                    if (!mouseOver)
                    {
                        this.isMouseOver = false;
                        MouseOut.Invoke(args);
                    }
                }

                if (mouseOver)
                {
                    float zTemp = 0.0f;

                    // Ask each child to check it's mouse status
                    foreach (UIComponent control in this.controls)
                    {
                        // Keep track of highest z-order
                        if (control.ZOrder >= zTemp)
                        {
                            UIComponent child = control.CheckMouseStatus(args);

                            if (child != null)
                            {
                                // MouseOut last result
                                if (result != null && result.IsMouseOver)
                                    result.InvokeMouseOut(args);

                                // Set result and update highest z-order
                                result = child;
                                zTemp = control.ZOrder;
                            }
                        }
                    }

                    // If no child requires the event, see if this control can
                    // take it.
                    if (result == null && this.canHaveFocus)
                        result = this;
                }
                else
                {
                    // Ensure each control can receive MouseOut event
                    foreach (UIComponent control in this.controls)
                        control.CheckMouseStatus(args);
                }
            }

            return result;
        }
Exemplo n.º 12
0
 /// <summary>
 /// Does nothing, override to handle event.
 /// </summary>
 /// <param name="args">Mouse event arguments.</param>
 protected virtual void OnMouseOver(MouseEventArgs args)
 {
 }
Exemplo n.º 13
0
 /// <summary>
 /// Does nothing, override to handle event.
 /// </summary>
 /// <param name="args">Mouse event arguments.</param>
 protected virtual void OnMouseMove(MouseEventArgs args)
 {
 }
Exemplo n.º 14
0
 /// <summary>
 /// Check if mouse button was released on top of a menu item.
 /// </summary>
 /// <param name="args">Mouse event arguments.</param>
 protected override void MouseUpIntercept(MouseEventArgs args)
 {
     if (this.isPopUpShown && CheckCoordinates(args.Position.X, args.Position.Y))
     {
         // Check if a child menu item should be clicked
         foreach (MenuItem item in this.menuItems)
         {
             if (item.CheckCoordinates(args.Position.X, args.Position.Y))
             {
                 item.InvokeClick();
                 break;
             }
         }
     }
 }
Exemplo n.º 15
0
 /// <summary>
 /// MouseMove input event handler function.
 /// </summary>
 /// <param name="e">MouseEvent arguments.</param>
 /// <returns>True if handled.</returns>
 public override bool injectMouseMove(InputEventSystem.MouseEventArgs e)
 {
     return(base.injectMouseMove(e));
 }
Exemplo n.º 16
0
 /// <summary>
 /// Receives all MouseDown events, and checks if control is focused and
 /// should receive event.
 /// </summary>
 /// <param name="args">Mouse event arguments.</param>
 protected virtual void MouseDownIntercept(MouseEventArgs args)
 {
     if (this.Visible)
     {
         // Check coordinates as well because modal mode messes up the
         // MouseDown event.
         if (this.guiManager.GetFocus() == this &&
             CheckCoordinates(args.Position.X, args.Position.Y)
             )
             MouseDown.Invoke(args);
     }
 }
Exemplo n.º 17
0
 protected void OnButtonMouseOut(MouseEventArgs args)
 {
     if (!this.isListBoxOpen)
         this.button.CurrentSkinState = SkinState.Normal;
 }
Exemplo n.º 18
0
 /// <summary>
 /// Receives all MouseUp events, and checks if control is focused and
 /// should receive event.
 /// </summary>
 /// <param name="args">Mouse event arguments.</param>
 protected virtual void MouseUpIntercept(MouseEventArgs args)
 {
     if (this.Visible)
     {
         if (this.guiManager.GetFocus() == this)
             MouseUp.Invoke(args);
     }
 }
Exemplo n.º 19
0
        /// <summary>
        /// Closes popup menu if parent is a menu bar, and user has clicked
        /// enough times.
        /// </summary>
        /// <param name="args">Mouse event arguments.</param>
        protected override void MouseUpIntercept(MouseEventArgs args)
        {
            if (args.Button == MouseButtons.Left)
            {
                // Check that the mouse was depressed inside the button
                if (CheckCoordinates(args.Position.X, args.Position.Y))
                {
                    if (this.isPopUpShown && this.canClose)
                    {
                        this.numClicks++;

                        if (this.numClicks > 1)
                        {
                            ClosePopUp();
                            AddHighlight();
                        }
                    }
                }
            }
        }
Exemplo n.º 20
0
 /// <summary>
 /// Used for click event. Override to handle event.
 /// </summary>
 /// <param name="args">Mouse event arguments.</param>
 protected virtual void OnMouseDown(MouseEventArgs args)
 {
     if (args.Button == MouseButtons.Left)
         this.isPressed = true;
 }
Exemplo n.º 21
0
        /// <summary>
        /// Remove highlight.
        /// </summary>
        /// <param name="args">Mouse event arguments.</param>
        protected override void OnMouseOut(MouseEventArgs args)
        {
            base.OnMouseOut(args);

            if (!this.isPopUpShown)
                RemoveHighlight();
        }
Exemplo n.º 22
0
 /// <summary>
 /// Updates button skin to reflect current mouse state.
 /// </summary>
 /// <param name="args">Mouse event arguments.</param>
 protected override void OnMouseDown(MouseEventArgs args)
 {
     base.OnMouseDown(args);
     if (args.Button == MouseButtons.Left)
         this.buttonBar.CurrentSkinState = SkinState.Pressed;
 }
Exemplo n.º 23
0
        /// <summary>
        /// Checks that the mouse position is inside the menu structure. If it
        /// isn't, then the menu is closed.
        /// </summary>
        /// <param name="args">Mouse event arguments.</param>
        protected void CheckMenuMouseStatus(MouseEventArgs args)
        {
            if (this.isPopUpShown)
            {
                bool onMenu = false;

                foreach (MenuItem item in this.menuItems)
                {
                    if (item.CheckMenuCoordinates(args.Position.X, args.Position.Y))
                    {
                        onMenu = true;
                        break;
                    }
                }

                // Check if menu should be closed
                if (!onMenu && this.selectedMenuItem != null)
                    this.selectedMenuItem.ClosePopUp();
            }
        }
Exemplo n.º 24
0
 /// <summary>
 /// Updates button skin to reflect current mouse state.
 /// </summary>
 /// <param name="args">Mouse event arguments.</param>
 protected override void OnMouseOut(MouseEventArgs args)
 {
     base.OnMouseOut(args);
     this.buttonBar.CurrentSkinState = SkinState.Normal;
 }
Exemplo n.º 25
0
 /// <summary>
 /// Close menu if mouse is released outside the menu structure.
 /// </summary>
 /// <param name="args">Mouse event arguments.</param>
 protected override void MouseUpIntercept(MouseEventArgs args)
 {
     CheckMenuMouseStatus(args);
 }
Exemplo n.º 26
0
        /// <summary>
        /// Updates button skin to reflect current mouse state.
        /// </summary>
        /// <param name="args">Mouse event arguments.</param>
        protected override void OnMouseOver(MouseEventArgs args)
        {
            base.OnMouseOver(args);

            if (IsPressed)
                this.buttonBar.CurrentSkinState = SkinState.Pressed;
            else
                this.buttonBar.CurrentSkinState = SkinState.Hover;
        }
Exemplo n.º 27
0
        /// <summary>
        /// Updates button skin to reflect current mouse state.
        /// </summary>
        /// <param name="args">Mouse event arguments.</param>
        protected override void OnMouseDown(MouseEventArgs args)
        {
            base.OnMouseDown(args);

            if (args.Button == MouseButtons.Left)
            {
                CurrentSkinState = SkinState.Pressed;

                if (this.isChecked)
                    CurrentSkinState = SkinState.CheckedPressed;
            }
        }
Exemplo n.º 28
0
 /// <summary>
 /// Updates button skin to reflect current mouse state.
 /// </summary>
 /// <param name="args">Mouse event arguments.</param>
 protected override void OnMouseUp(MouseEventArgs args)
 {
     base.OnMouseUp(args);
     if (args.Button == MouseButtons.Left)
     {
         if (CheckCoordinates(args.Position.X, args.Position.Y))
             this.buttonBar.CurrentSkinState = SkinState.Hover;
         else
             this.buttonBar.CurrentSkinState = SkinState.Normal;
     }
 }
Exemplo n.º 29
0
        /// <summary>
        /// Updates button skin to reflect current mouse state.
        /// </summary>
        /// <param name="args">Mouse event arguments.</param>
        protected override void OnMouseOver(MouseEventArgs args)
        {
            base.OnMouseOver(args);

            if (IsPressed)
            {
                CurrentSkinState = SkinState.Pressed;

                if (this.isChecked)
                    CurrentSkinState = SkinState.CheckedPressed;
            }
            else
            {
                CurrentSkinState = SkinState.Hover;

                if (this.isChecked)
                    CurrentSkinState = SkinState.CheckedHover;
            }
        }
Exemplo n.º 30
0
        /// <summary>
        /// Open listbox when button is pressed.
        /// </summary>
        /// <param name="args">Mouse event arguments.</param>
        protected void OnButtonMouseDown(MouseEventArgs args)
        {
            if (args.Button == MouseButtons.Left)
            {
                if (!this.isListBoxOpen && this.listBox.Count > 0)
                {
                    this.listBox.X = AbsolutePosition.X;
                    this.listBox.Y = AbsolutePosition.Y + Height - 1;
                    this.listBox.Width = Width;

                    GUIManager.Add(this.listBox);

                    this.button.CurrentSkinState = SkinState.Pressed;

                    this.isListBoxOpen = true;
                }
                else
                    CloseListBox();
            }
        }
Exemplo n.º 31
0
 /// <summary>
 /// Local MouseDown event handler. This function should inject this event
 /// to any components that check for input.
 /// </summary>
 /// <param name="e">Key event arguments</param>
 public override bool injectMouseDown(MouseEventArgs e)
 {
     return _user.injectMouseDown(e);
 }
Exemplo n.º 32
0
 /// <summary>
 /// Local MouseUp event handler. This function should inject this event
 /// to any components that check for input.
 /// </summary>
 /// <param name="e">Key event arguments</param>
 public override bool injectMouseUp(InputEventSystem.MouseEventArgs e)
 {
     return(_user.injectMouseUp(e));
 }