Пример #1
0
        public bool OnMouseMove(System.Windows.Forms.MouseEventArgs e)
        {
            bool handled = false;

            // if we aren't active do nothing.
            if ((!m_visible) || (!m_enabled))
            {
                return(false);
            }

            for (int index = m_ChildWidgets.Count - 1; index >= 0; index--)
            {
                IWidget currentWidget = m_ChildWidgets[index] as IWidget;

                if (currentWidget != null && currentWidget is IInteractive)
                {
                    IInteractive currentInteractive = m_ChildWidgets[index] as IInteractive;

                    handled = currentInteractive.OnMouseMove(e);
                    if (handled)
                    {
                        return(handled);
                    }
                }
            }

            return(handled);
        }
Пример #2
0
        public bool OnMouseMove(System.Windows.Forms.MouseEventArgs e)
        {
            bool handled = false;

            if (m_visible)
            {
                // if we're in the client area
                if (e.X >= this.AbsoluteLocation.X &&
                    e.X <= this.AbsoluteLocation.X + ClientSize.Width &&
                    e.Y >= this.AbsoluteLocation.Y &&
                    e.Y <= this.AbsoluteLocation.Y + NODE_HEIGHT)
                {
                    if (!m_isMouseOver)
                    {
                        if (m_enterAction != null)
                        {
                            m_enterAction(e);
                        }
                    }
                    this.OnMouseEnter(e);

//					m_isMouseOver = true;
                    handled = true;
                }
                else
                {
                    if (m_isMouseOver)
                    {
                        if (m_leaveAction != null)
                        {
                            m_leaveAction(e);
                        }
                    }
                    this.OnMouseLeave(e);

//					m_isMouseOver = false;
                }
            }
            else
            {
                m_isMouseOver = false;
            }

            // call all the children because they need to have a chance to detect mouse leaving.
            for (int i = 0; i < m_subNodes.Count; i++)
            {
                if (m_subNodes[i] is IInteractive)
                {
                    IInteractive currentInteractive = m_subNodes[i] as IInteractive;
                    if (currentInteractive.OnMouseMove(e))
                    {
                        handled = true;
                    }
                }
            }

            return(handled);
        }
Пример #3
0
        public bool OnMouseMove(System.Windows.Forms.MouseEventArgs e)
        {
            for (int index = 0; index < m_ChildWidgets.Count; index++)
            {
                IWidget currentWidget = m_ChildWidgets[index] as IWidget;

                if (currentWidget != null && currentWidget is IInteractive)
                {
                    IInteractive currentInteractive = m_ChildWidgets[index] as IInteractive;

                    bool handled = currentInteractive.OnMouseMove(e);
                    if (handled)
                    {
                        return(handled);
                    }
                }
            }

            return(false);
        }
Пример #4
0
        /// <summary>
        /// Mouse move event handler.
        /// </summary>
        /// <param name="e">Event args</param>
        /// <returns>If this widget handled this event</returns>
        public bool OnMouseMove(System.Windows.Forms.MouseEventArgs e)
        {
            // if we aren't active do nothing.
            if ((!this.m_visible) || (!this.m_enabled))
            {
                return(false);
            }

            int deltaX = e.X - this.m_LastMousePosition.X;
            int deltaY = e.Y - this.m_LastMousePosition.Y;

            this.m_LastMousePosition = new Point(e.X, e.Y);

            int widgetTop    = this.Top;
            int widgetBottom = this.Bottom;
            int widgetLeft   = this.Left;
            int widgetRight  = this.Right;

            // Handle each child if we're in the client area
            if (e.X >= widgetLeft &&
                e.X <= widgetRight &&
                e.Y >= widgetTop &&
                e.Y <= widgetBottom)
            {
                for (int i = 0; i < this.m_ChildWidgets.Count; i++)
                {
                    if (this.m_ChildWidgets[i] is IInteractive)
                    {
                        IInteractive currentInteractive = this.m_ChildWidgets[i] as IInteractive;

                        if (currentInteractive.OnMouseMove(e))
                        {
                            return(true);
                        }
                    }
                }
            }

            return(false);
        }
Пример #5
0
        public bool OnMouseMove(MouseEventArgs e)
        {
            bool handled = false;
            int  deltaX  = e.X - m_LastMousePosition.X;
            int  deltaY  = e.Y - m_LastMousePosition.Y;

            if (isResizingTop || isResizingUL || isResizingUR)
            {
                m_Location.Y  += deltaY;
                m_Size.Height -= deltaY;
            }
            else if (isResizingBottom || isResizingLL || isResizingLR)
            {
                m_Size.Height += deltaY;
            }
            else if (isResizingRight || isResizingUR || isResizingLR)
            {
                m_Size.Width += deltaX;
            }
            else if (isResizingLeft || isResizingUL || isResizingLL)
            {
                m_Location.X += deltaX;
                m_Size.Width -= deltaX;
            }
            else if (m_IsDragging)
            {
                m_Location.X += deltaX;
                m_Location.Y += deltaY;

                if (m_Location.X < 0)
                {
                    m_Location.X = 0;
                }
                if (m_Location.Y < 0)
                {
                    m_Location.Y = 0;
                }
                if (m_Location.Y + m_Size.Height
                    > DrawArgs.StaticParentControl.Height)
                {
                    m_Location.Y = DrawArgs.StaticParentControl.Height - m_Size.Height;
                }
                if (m_Location.X + m_Size.Width
                    > DrawArgs.StaticParentControl.Width)
                {
                    m_Location.X = DrawArgs.StaticParentControl.Width - m_Size.Width;
                }

                handled = true;
            }

            if (m_Size.Width
                < minSize.Width)
            {
                m_Size.Width = minSize.Width;
            }

            if (m_Size.Height
                < minSize.Height)
            {
                m_Size.Height = minSize.Height;
            }

            m_LastMousePosition = new Point(e.X, e.Y);

            for (int i = 0; i < m_ChildWidgets.Count; i++)
            {
                if (m_ChildWidgets[i] is IInteractive)
                {
                    IInteractive currentInteractive = m_ChildWidgets[i] as IInteractive;
                    handled = currentInteractive.OnMouseMove(e);
                }
            }

            bool inClientArea = false;

            if (e.X >= m_Location.X && e.X <= m_Location.X + m_Size.Width && e.Y >= m_Location.Y &&
                e.Y <= m_Location.Y + m_Size.Height)
            {
                inClientArea = true;
            }

            if (!handled && inClientArea)
            {
                handled = true;
            }
            return(handled);
        }
Пример #6
0
        public bool OnMouseMove(System.Windows.Forms.MouseEventArgs e)
        {
            if (!Visible)
            {
                return(false);
            }

            bool handled = false;
            int  deltaX  = e.X - m_LastMousePosition.X;
            int  deltaY  = e.Y - m_LastMousePosition.Y;

            if (isResizingTop || isResizingUL || isResizingUR)
            {
                ClientLocation = new System.Drawing.Point(ClientLocation.X, ClientLocation.Y + deltaY);
                m_Size.Height -= deltaY;
            }
            else if (isResizingBottom || isResizingLL || isResizingLR)
            {
                m_Size.Height += deltaY;
            }
            else if (isResizingRight || isResizingUR || isResizingLR)
            {
                m_Size.Width += deltaX;
            }
            else if (isResizingLeft || isResizingUL || isResizingLL)
            {
                ClientLocation = new System.Drawing.Point(ClientLocation.X + deltaX, ClientLocation.Y);
                m_Size.Width  -= deltaX;
            }
            else if (m_IsDragging)
            {
                ClientLocation = new System.Drawing.Point(ClientLocation.X + deltaX, ClientLocation.Y + deltaY);

                if (ClientLocation.X < 0)
                {
                    ClientLocation = new System.Drawing.Point(0, ClientLocation.Y);
                }
                if (ClientLocation.Y < 0)
                {
                    ClientLocation = new System.Drawing.Point(ClientLocation.X, 0);
                }
                if (ClientLocation.Y + m_Size.Height > DrawArgs.ParentControl.Height)
                {
                    ClientLocation = new System.Drawing.Point(ClientLocation.X, DrawArgs.ParentControl.Height - m_Size.Height);
                }
                if (ClientLocation.X + m_Size.Width > DrawArgs.ParentControl.Width)
                {
                    ClientLocation = new System.Drawing.Point(DrawArgs.ParentControl.Width - m_Size.Width, ClientLocation.Y);
                }

                handled = true;
            }

            if (m_Size.Width < minSize.Width)
            {
                m_Size.Width = minSize.Width;
            }

            if (m_Size.Height < minSize.Height)
            {
                m_Size.Height = minSize.Height;
            }

            m_LastMousePosition = new System.Drawing.Point(e.X, e.Y);

            for (int i = 0; i < m_ChildWidgets.Count; i++)
            {
                if (m_ChildWidgets[i] is IInteractive)
                {
                    IInteractive currentInteractive = m_ChildWidgets[i] as IInteractive;
                    handled = currentInteractive.OnMouseMove(e);
                }
            }

            bool inClientArea = false;

            if (e.X >= ClientLocation.X &&
                e.X <= ClientLocation.X + m_Size.Width &&
                e.Y >= ClientLocation.Y &&
                e.Y <= ClientLocation.Y + m_Size.Height)
            {
                inClientArea = true;
            }


            if (!handled && inClientArea)
            {
                handled = true;
            }
            return(handled);
        }