예제 #1
0
 public void Timer()
 {
     if (focusedGadget != null)
     {
         focusedGadget.HandleTimer(focusedGadget.ScreenToGadget(mousePos), mouseButton);
     }
 }
예제 #2
0
        public bool MouseButtonUp(int x, int y, MouseButton button)
        {
            bool   result = false;
            Point  pos    = new Point(x, y);
            Gadget gadget = null;
            Window window = FindWindow(pos);

            if (window != null)
            {
                window.ClearDraggingAndSizing();
                gadget = window.FindGadget(pos);
            }
            dragging   = false;
            dragGadget = null;
            dragWindow = null;
            if (selectedGadget != null)
            {
                if (!selectedGadget.RelVerify || (selectedGadget == gadget))
                {
                    result = selectedGadget.HandleMouseButtonUp(selectedGadget.ScreenToGadget(pos), button);
                }
            }
            SetSelectedWindow(null);
            SetSelectedGadget(null);
            mousePos             = pos;
            mouseButton         &= ~button;
            engine.GUIUseseMouse = !result;
            return(result);
        }
예제 #3
0
        public bool MouseMove(int x, int y)
        {
            bool result = false;

            Hover = true;
            Point  pos    = new Point(x, y);
            Gadget gadget = null;
            Window window = FindWindow(pos);

            if (dragging && dragGadget != null)
            {
                result = dragGadget.HandleMouseDrag(dragGadget.ScreenToGadget(pos), pos - mousePos, mouseButton);
            }
            if (!result && dragging && dragWindow != null)
            {
                result = dragWindow.HandleMouseDrag(dragWindow.ScreenToGadget(pos), pos - mousePos, mouseButton);
            }
            if (window != null)
            {
                gadget = window.FindGadget(pos);
            }
            if (!result && gadget != null)
            {
                result = gadget.HandleMouseMove(gadget.ScreenToGadget(pos), mouseButton);
            }
            SetHoverWindow(window);
            SetHoverGadget(gadget);
            mousePos = pos;
            return(result);
        }
예제 #4
0
        public bool MouseButtonDown(int x, int y, MouseButton button)
        {
            bool   result = false;
            Point  pos    = new Point(x, y);
            Gadget gadget = null;
            Window window = FindWindow(pos);

            if (window != null)
            {
                window.ClearDraggingAndSizing();
                gadget = window.FindGadget(pos);
                if (button == MouseButton.Left)
                {
                    dragGadget = gadget;
                    if (dragGadget == this)
                    {
                        dragGadget = null;
                    }
                    dragging = dragGadget != null;
                    if (dragging)
                    {
                        dragWindow = dragGadget.Window;
                    }
                    SetFocusedWindow(window);
                    SetFocusedGadget(gadget);
                }
                else
                {
                    dragging   = false;
                    dragGadget = null;
                    dragWindow = null;
                }
            }
            else
            {
                SetFocusedWindow(null);
                SetFocusedGadget(null);
            }
            if (gadget != null)
            {
                result = gadget.HandleMouseButtonDown(gadget.ScreenToGadget(pos), button);
            }
            SetSelectedWindow(window);
            SetSelectedGadget(gadget);
            mousePos             = pos;
            mouseButton         |= button;
            engine.GUIUseseMouse = result;
            return(result);
        }