Beispiel #1
0
        public virtual bool MouseDown()
        {
            bool answer = false;

            if (Unclickable)
            {
                answer = false;
            }
            else if (mouseOver)
            {
                mouseDown = true;
                answer    = true;
                if (Enabled)
                {
                    if (onMouseDown != null)
                    {
                        onMouseDown.Invoke(this);
                    }
                    Focus();
                }
            }

            if (Elements != null)
            {
                for (int i = 0; i < Elements.Count; i++)
                {
                    if (Elements[i].MouseDown())
                    {
                        answer = true;
                    }
                }
            }
            return(answer);
        }
Beispiel #2
0
        public virtual bool MouseUp()
        {
            bool answer = false;

            if (Unclickable)
            {
                answer = false;
            }
            else if (mouseDown)
            {
                mouseDown = false;
                if (mouseInside)
                {
                    if (onClick != null && mouseOver)
                    {
                        onClick.Invoke(this);
                    }
                    answer = true;
                }
                if (onMouseUp != null)
                {
                    onMouseUp.Invoke(this);
                }
                //if (mouseOver) answer = true;
            }

            if (Elements != null)
            {
                for (int i = 0; i < Elements.Count; i++)
                {
                    if (Elements[i].MouseUp())
                    {
                        answer = true;                                                                             // Makes sure every element receives the message that the mouse is out
                    }
                }
            }
            return(answer);
        }