コード例 #1
0
        // /////////////////////////////////////////////////////////////////////////////////

        // /////////////////////////////////////////////////////////////////////////////////
        /// <summary>
        /// Called when the mouse has left a hover state.  Override to add
        /// mouse hover handling code.
        /// </summary>
        internal protected virtual void OnMouseHoverEnd(MouseData mouseData)
        {
            if (MouseHoverEnd != null)
            {
                MouseHoverEnd(this, new MouseEventArgs(mouseData));
            }
        }
コード例 #2
0
ファイル: InputManager.cs プロジェクト: vanattab/ochregui
        // /////////////////////////////////////////////////////////////////////////////////
        #endregion
        #region Mouse Input
        // /////////////////////////////////////////////////////////////////////////////////
        private void PollMouse(uint totalElapsed)
        {
            MouseData mouse = new MouseData(TCODMouse.getStatus());

            CheckMouseButtons(mouse);

            // check for mouse move
            //if (mouse.Position != lastMousePosition)
            //{
            //    DoMouseMove(mouse);

            //    lastMousePosition = mouse.Position;
            //    lastMouseMoveTime = totalElapsed;
            //}
            if (mouse.PixelPosition != lastMousePixelPosition)
            {
                DoMouseMove(mouse);

                lastMousePosition      = mouse.Position;
                lastMousePixelPosition = mouse.PixelPosition;
                lastMouseMoveTime      = totalElapsed;
            }

            // check for hover
            if ((totalElapsed - lastMouseMoveTime) > hoverMSTol &&
                isHovering == false)
            {
                StartHover(mouse);
            }
        }
コード例 #3
0
ファイル: InputManager.cs プロジェクト: vanattab/ochregui
        // /////////////////////////////////////////////////////////////////////////////////

        // /////////////////////////////////////////////////////////////////////////////////
        private void StartDrag(MouseData mouse)
        {
            isDragging = true;

            // TODO fix this, it does not pass origin of drag as intended
            attachedComponent.OnMouseDragBegin(mouse.Position);
        }
コード例 #4
0
ファイル: Window.cs プロジェクト: vanattab/ochregui
        // /////////////////////////////////////////////////////////////////////////////////

        // /////////////////////////////////////////////////////////////////////////////////
        /// <summary>
        /// Base method propagates messages to children controls and managers.  Override to
        /// add custom handling.
        /// </summary>
        internal protected override void OnMouseMoved(MouseData mouseData)
        {
            base.OnMouseMoved(mouseData);

            foreach (Manager m in managerList)
            {
                m.OnMouseMoved(mouseData);
            }

            Control checkUnderMouse = GetTopControlAt(mouseData.Position);

            if (checkUnderMouse != CurrentUnderMouse)
            {
                // check for Leave and Enter actions

                if (CurrentUnderMouse != null && CurrentUnderMouse.IsActive)
                {
                    CurrentUnderMouse.OnMouseLeave();
                }

                if (checkUnderMouse != null && checkUnderMouse.IsActive)
                {
                    checkUnderMouse.OnMouseEnter();
                }

                CurrentUnderMouse = checkUnderMouse;
            }

            if (CurrentUnderMouse != null && CurrentUnderMouse.IsActive)
            {
                CurrentUnderMouse.OnMouseMoved(mouseData);
            }
        }
コード例 #5
0
        // /////////////////////////////////////////////////////////////////////////////////

        // /////////////////////////////////////////////////////////////////////////////////
        /// <summary>
        /// Called when a previously pressed mouse button has been released.  Override to
        /// add mouse button handling code.
        /// </summary>
        internal protected virtual void OnMouseButtonUp(MouseData mouseData)
        {
            if (MouseButtonUp != null)
            {
                MouseButtonUp(this, new MouseEventArgs(mouseData));
            }
        }
コード例 #6
0
        /// <summary>
        /// Construct a MouseEventArgs given the MouseData
        /// </summary>
        /// <param name="mouseData"></param>
        public MouseEventArgs(MouseData mouseData)
        {
            if (mouseData == null)
            {
                throw new ArgumentNullException("mouseData");
            }

            this.mouseData = mouseData;
        }
コード例 #7
0
ファイル: InputManager.cs プロジェクト: vanattab/ochregui
        // /////////////////////////////////////////////////////////////////////////////////

        // /////////////////////////////////////////////////////////////////////////////////
        private void DoMouseButtonUp(MouseData mouse)
        {
            if (isDragging)
            {
                StopDrag(mouse);
            }

            attachedComponent.OnMouseButtonUp(mouse);
        }
コード例 #8
0
        // /////////////////////////////////////////////////////////////////////////////////

        // /////////////////////////////////////////////////////////////////////////////////
        /// <summary>
        /// Base method sets the IsBeingPushed state if applicable.  Override to add
        /// custom handling code after calling this base method.
        /// </summary>
        /// <param name="mouseData"></param>
        protected internal override void OnMouseButtonUp(MouseData mouseData)
        {
            base.OnMouseButtonUp(mouseData);

            if (mouseData.MouseButton == MouseButton.LeftButton)
            {
                IsBeingPushed = false;
            }
        }
コード例 #9
0
        // /////////////////////////////////////////////////////////////////////////////////

        // /////////////////////////////////////////////////////////////////////////////////
        /// <summary>
        /// Base method detects if a menu item was selected, and calls OnItemSelected if this
        /// is the case.  Override to add custom handling.
        /// </summary>
        /// <param name="mouseData"></param>
        protected internal override void OnMouseButtonDown(MouseData mouseData)
        {
            base.OnMouseButtonDown(mouseData);

            if (mouseOverIndex != -1)
            {
                OnItemSelected(mouseOverIndex);
            }
        }
コード例 #10
0
        // /////////////////////////////////////////////////////////////////////////////////

        // /////////////////////////////////////////////////////////////////////////////////
        /// <summary>
        /// Called when the mouse has moved to a new cell position.  Override to add
        /// mouse move handling code.
        /// </summary>
        internal protected virtual void OnMouseMoved(MouseData mouseData)
        {
            CurrentMousePos = mouseData.Position;

            if (MouseMoved != null)
            {
                MouseMoved(this, new MouseEventArgs(mouseData));
            }
        }
コード例 #11
0
        // /////////////////////////////////////////////////////////////////////////////////
        #endregion
        #region Message Handlers
        // /////////////////////////////////////////////////////////////////////////////////
        /// <summary>
        /// Called when a mouse button is released while over this button.  Triggers proper
        /// events.  Override to add custom handling.
        /// </summary>
        /// <param name="mouseData"></param>
        protected internal override void OnMouseButtonUp(MouseData mouseData)
        {
            bool wasBeingPushed = IsBeingPushed; // store, since base call will reset this to false

            base.OnMouseButtonUp(mouseData);

            if (mouseData.MouseButton == MouseButton.LeftButton && wasBeingPushed)
            {
                OnButtonPushed();
            }
        }
コード例 #12
0
        // /////////////////////////////////////////////////////////////////////////////////

        // /////////////////////////////////////////////////////////////////////////////////
        /// <summary>
        /// Detects which, if any, item has been selected by a left mouse button.  Override
        /// to add custom handling.
        /// </summary>
        /// <param name="mouseData"></param>
        protected internal override void OnMouseButtonDown(MouseData mouseData)
        {
            base.OnMouseButtonDown(mouseData);

            if (mouseOverIndex != -1)
            {
                if (CurrentSelected != mouseOverIndex)
                {
                    CurrentSelected = mouseOverIndex;
                    OnItemSelected(CurrentSelected);
                }
            }
        }
コード例 #13
0
ファイル: Window.cs プロジェクト: vanattab/ochregui
        // /////////////////////////////////////////////////////////////////////////////////

        // /////////////////////////////////////////////////////////////////////////////////
        /// <summary>
        /// Base method propagates messages to children controls and managers.  Override to
        /// add custom handling.
        /// </summary>
        internal protected override void OnMouseHoverBegin(MouseData mouseData)
        {
            base.OnMouseHoverBegin(mouseData);

            foreach (Manager m in managerList)
            {
                m.OnMouseHoverBegin(mouseData);
            }

            if (CurrentUnderMouse != null && CurrentUnderMouse.IsActive)
            {
                CurrentUnderMouse.OnMouseHoverBegin(mouseData);
            }
        }
コード例 #14
0
ファイル: InputManager.cs プロジェクト: vanattab/ochregui
        // /////////////////////////////////////////////////////////////////////////////////

        // /////////////////////////////////////////////////////////////////////////////////
        private void DoMouseButtonDown(MouseData mouse)
        {
            if (isDragging)
            {
                StopDrag(mouse);
            }

            if (mouse.MouseButton == MouseButton.LeftButton)
            {
                startLBDown = mouse.PixelPosition;
            }

            attachedComponent.OnMouseButtonDown(mouse);
        }
コード例 #15
0
ファイル: Window.cs プロジェクト: vanattab/ochregui
        // /////////////////////////////////////////////////////////////////////////////////

        // /////////////////////////////////////////////////////////////////////////////////
        /// <summary>
        /// Base method propagates messages to children controls and managers.  Override to
        /// add custom handling.
        /// </summary>
        internal protected override void OnMouseButtonUp(MouseData mouseData)
        {
            base.OnMouseButtonUp(mouseData);

            foreach (Manager m in managerList)
            {
                m.OnMouseButtonUp(mouseData);
            }

            if (CurrentUnderMouse != null && CurrentUnderMouse.IsActive)
            {
                CurrentUnderMouse.OnMouseButtonUp(mouseData);
            }

            LastLBDown = null;
        }
コード例 #16
0
ファイル: InputManager.cs プロジェクト: vanattab/ochregui
        // /////////////////////////////////////////////////////////////////////////////////

        // /////////////////////////////////////////////////////////////////////////////////
        private void CheckMouseButtons(MouseData mouse)
        {
            if (mouse.MouseButton != lastMouseButton)
            {
                if (lastMouseButton == MouseButton.None)
                {
                    DoMouseButtonDown(mouse);
                }
                else
                {
                    DoMouseButtonUp(new MouseData(lastMouseButton, mouse.Position, mouse.PixelPosition));
                }

                lastMouseButton = mouse.MouseButton;
            }
        }
コード例 #17
0
        // /////////////////////////////////////////////////////////////////////////////////

        // /////////////////////////////////////////////////////////////////////////////////
        /// <summary>
        /// Base method detects if the mouse pointer is currently over a menu items and
        /// sets the state accordingly.  Override to add custom handling.
        /// </summary>
        /// <param name="mouseData"></param>
        protected internal override void OnMouseMoved(MouseData mouseData)
        {
            base.OnMouseMoved(mouseData);

            Point lPos = ScreenToLocal(mouseData.Position);

            mouseOverIndex = GetItemAt(lPos);

            if (mouseOverIndex != -1)
            {
                TooltipText = Items[mouseOverIndex].TooltipText;
            }
            else
            {
                TooltipText = null;
            }
        }
コード例 #18
0
ファイル: InputManager.cs プロジェクト: vanattab/ochregui
        // /////////////////////////////////////////////////////////////////////////////////

        // /////////////////////////////////////////////////////////////////////////////////
        private void DoMouseMove(MouseData mouse)
        {
            StopHover(mouse);

            attachedComponent.OnMouseMoved(mouse);

            // check for BeginDrag
            if (mouse.MouseButton == MouseButton.LeftButton)
            {
                int delta = Math.Abs(mouse.PixelPosition.X - startLBDown.X) +
                            Math.Abs(mouse.PixelPosition.Y - startLBDown.Y);

                if (delta > dragPixelTol && isDragging == false)
                {
                    StartDrag(mouse);
                }
            }
        }
コード例 #19
0
ファイル: Window.cs プロジェクト: vanattab/ochregui
        // /////////////////////////////////////////////////////////////////////////////////

        // /////////////////////////////////////////////////////////////////////////////////
        /// <summary>
        /// Base method propagates messages to children controls and managers.  Override to
        /// add custom handling.
        /// </summary>
        internal protected override void OnMouseHoverEnd(MouseData mouseData)
        {
            if (CurrentTooltip != null)
            {
                CurrentTooltip.Dispose();
                CurrentTooltip = null;
            }

            base.OnMouseHoverEnd(mouseData);

            foreach (Manager m in managerList)
            {
                m.OnMouseHoverEnd(mouseData);
            }

            if (CurrentUnderMouse != null && CurrentUnderMouse.IsActive)
            {
                CurrentUnderMouse.OnMouseHoverEnd(mouseData);
            }
        }
コード例 #20
0
        // /////////////////////////////////////////////////////////////////////////////////
        #endregion
        #region Message Handlers
        // /////////////////////////////////////////////////////////////////////////////////
        /// <summary>
        /// Triggers appropriate events based on a mouse button down action.  Override to
        /// add custom mouse button handling code.
        /// </summary>
        /// <param name="mouseData"></param>
        protected internal override void OnMouseButtonDown(MouseData mouseData)
        {
            base.OnMouseButtonDown(mouseData);

            if (mouseData.MouseButton == MouseButton.LeftButton)
            {
                if (IsChecked)
                {
                    IsChecked = false;
                }
                else
                {
                    IsChecked = true;
                }

                if (CheckBoxToggled != null)
                {
                    CheckBoxToggled(this, EventArgs.Empty);
                }
            }
        }
コード例 #21
0
ファイル: Window.cs プロジェクト: vanattab/ochregui
        // /////////////////////////////////////////////////////////////////////////////////
        /// <summary>
        /// Base method propagates messages to children controls and managers.  Override to
        /// add custom handling.
        /// </summary>
        internal protected override void OnMouseButtonDown(MouseData mouseData)
        {
            base.OnMouseButtonDown(mouseData);

            foreach (Manager m in managerList)
            {
                m.OnMouseButtonDown(mouseData);
            }

            // If applicable, forward MouseDown and Select to child control
            if (CurrentUnderMouse != null && CurrentUnderMouse.IsActive)
            {
                CurrentUnderMouse.OnMouseButtonDown(mouseData);

                LastLBDown = CurrentUnderMouse;
            }

            // Check to see if a control looses KBFocus if user hit any mouse button outside current focused control
            if (CurrentKeyboardFocus != null)
            {
                if (CurrentKeyboardFocus != CurrentUnderMouse)
                {
                    CurrentKeyboardFocus.OnReleaseKeyboardFocus();
                    CurrentKeyboardFocus = null;
                }
            }

            // Give KBFocus to child on left button down, if applicable
            if (CurrentUnderMouse != null &&
                CurrentUnderMouse.CanHaveKeyboardFocus &&
                CurrentUnderMouse.HasKeyboardFocus == false &&
                mouseData.MouseButton == MouseButton.LeftButton &&
                CurrentUnderMouse.IsActive)
            {
                CurrentKeyboardFocus = CurrentUnderMouse;

                CurrentKeyboardFocus.OnTakeKeyboardFocus();
            }
        }
コード例 #22
0
ファイル: Component.cs プロジェクト: AIBrain/ochregui
 // /////////////////////////////////////////////////////////////////////////////////
 // /////////////////////////////////////////////////////////////////////////////////
 /// <summary>
 /// Called when a previously pressed mouse button has been released.  Override to
 /// add mouse button handling code.
 /// </summary>
 protected internal virtual void OnMouseButtonUp(MouseData mouseData)
 {
     if (MouseButtonUp != null)
     {
         MouseButtonUp(this, new MouseEventArgs(mouseData));
     }
 }
コード例 #23
0
        // /////////////////////////////////////////////////////////////////////////////////

        // /////////////////////////////////////////////////////////////////////////////////
        /// <summary>
        /// Base method requests that a tooltip be displayed, calling this.DetermineTooltipText()
        /// to get the displayed text.  Override to add custom handling code after calling
        /// this base method.
        /// </summary>
        /// <param name="mouseData"></param>
        protected internal override void OnMouseHoverBegin(MouseData mouseData)
        {
            base.OnMouseHoverBegin(mouseData);
            ParentWindow.ShowTooltip(DetermineTooltipText(), mouseData.Position);
        }
コード例 #24
0
ファイル: ListBox.cs プロジェクト: AIBrain/ochregui
        // /////////////////////////////////////////////////////////////////////////////////
        // /////////////////////////////////////////////////////////////////////////////////
        /// <summary>
        /// Base method detects if the mouse is over one of the items, and changes state
        /// accordingly.  Override to add custom handling.
        /// </summary>
        /// <param name="mouseData"></param>
        protected internal override void OnMouseMoved(MouseData mouseData)
        {
            base.OnMouseMoved(mouseData);

            Point lPos = ScreenToLocal(mouseData.Position);

            mouseOverIndex = GetItemAt(lPos);

            if (mouseOverIndex != -1)
            {
                TooltipText = Items[mouseOverIndex].TooltipText;
            }
            else
            {
                TooltipText = null;
            }
        }
コード例 #25
0
ファイル: Page2.cs プロジェクト: AIBrain/ochregui
            protected override void OnMouseButtonDown(MouseData mouseData)
            {
                base.OnMouseButtonDown(mouseData);

                if (mouseData.MouseButton == MouseButton.RightButton)
                {
                    Menu menu = new Menu(new MenuTemplate()
                    {
                        Items = new System.Collections.Generic.List<MenuItemData>()
                        {
                            new MenuItemData("Menu Item 1","Selected Menu Item 1"),
                            new MenuItemData("Menu Item 2","Selected Menu Item 2"),
                            new MenuItemData("Menu Item 3","Selected Menu Item 3"),
                            new MenuItemData("Menu Item 4","Selected Menu Item 4")
                        },
                        UpperLeftPos = mouseData.Position,
                    });

                    ParentWindow.AddControl(menu);
                }
            }
コード例 #26
0
ファイル: Window.cs プロジェクト: AIBrain/ochregui
        // /////////////////////////////////////////////////////////////////////////////////
        // /////////////////////////////////////////////////////////////////////////////////
        /// <summary>
        /// Base method propagates messages to children controls and managers.  Override to
        /// add custom handling.
        /// </summary>
        protected internal override void OnMouseMoved(MouseData mouseData)
        {
            base.OnMouseMoved(mouseData);

            foreach (Manager m in managerList)
            {
                m.OnMouseMoved(mouseData);
            }

            Control checkUnderMouse = GetTopControlAt(mouseData.Position);

            if (checkUnderMouse != CurrentUnderMouse)
            {
                // check for Leave and Enter actions

                if (CurrentUnderMouse != null && CurrentUnderMouse.IsActive)
                {
                    CurrentUnderMouse.OnMouseLeave();
                }

                if (checkUnderMouse != null && checkUnderMouse.IsActive)
                {
                    checkUnderMouse.OnMouseEnter();
                }

                CurrentUnderMouse = checkUnderMouse;
            }

            if (CurrentUnderMouse != null && CurrentUnderMouse.IsActive)
            {
                CurrentUnderMouse.OnMouseMoved(mouseData);
            }
        }
コード例 #27
0
ファイル: Messages.cs プロジェクト: AIBrain/ochregui
        /// <summary>
        /// Construct a MouseEventArgs given the MouseData
        /// </summary>
        /// <param name="mouseData"></param>
        public MouseEventArgs(MouseData mouseData)
        {
            if (mouseData == null)
            {
                throw new ArgumentNullException("mouseData");
            }

            this.mouseData = mouseData;
        }
コード例 #28
0
ファイル: Window.cs プロジェクト: AIBrain/ochregui
        // /////////////////////////////////////////////////////////////////////////////////
        /// <summary>
        /// Base method propagates messages to children controls and managers.  Override to
        /// add custom handling.
        /// </summary>
        protected internal override void OnMouseButtonDown(MouseData mouseData)
        {
            base.OnMouseButtonDown(mouseData);

            foreach (Manager m in managerList)
            {
                m.OnMouseButtonDown(mouseData);
            }

            // If applicable, forward MouseDown and Select to child control
            if (CurrentUnderMouse != null && CurrentUnderMouse.IsActive)
            {
                CurrentUnderMouse.OnMouseButtonDown(mouseData);

                LastLBDown = CurrentUnderMouse;
            }

            // Check to see if a control looses KBFocus if user hit any mouse button outside current focused control
            if (CurrentKeyboardFocus != null)
            {
                if (CurrentKeyboardFocus != CurrentUnderMouse)
                {
                    CurrentKeyboardFocus.OnReleaseKeyboardFocus();
                    CurrentKeyboardFocus = null;
                }
            }

            // Give KBFocus to child on left button down, if applicable
            if (CurrentUnderMouse != null &&
                CurrentUnderMouse.CanHaveKeyboardFocus &&
                CurrentUnderMouse.HasKeyboardFocus == false &&
                mouseData.MouseButton == MouseButton.LeftButton &&
                CurrentUnderMouse.IsActive)
            {
                CurrentKeyboardFocus = CurrentUnderMouse;

                CurrentKeyboardFocus.OnTakeKeyboardFocus();
            }
        }
コード例 #29
0
ファイル: Window.cs プロジェクト: AIBrain/ochregui
        // /////////////////////////////////////////////////////////////////////////////////
        // /////////////////////////////////////////////////////////////////////////////////
        /// <summary>
        /// Base method propagates messages to children controls and managers.  Override to
        /// add custom handling.
        /// </summary>
        protected internal override void OnMouseHoverBegin(MouseData mouseData)
        {
            base.OnMouseHoverBegin(mouseData);

            foreach (Manager m in managerList)
            {
                m.OnMouseHoverBegin(mouseData);
            }

            if (CurrentUnderMouse != null && CurrentUnderMouse.IsActive)
            {
                CurrentUnderMouse.OnMouseHoverBegin(mouseData);

            }
        }
コード例 #30
0
ファイル: Component.cs プロジェクト: AIBrain/ochregui
 // /////////////////////////////////////////////////////////////////////////////////
 // /////////////////////////////////////////////////////////////////////////////////
 /// <summary>
 /// Called when the mouse has left a hover state.  Override to add
 /// mouse hover handling code.
 /// </summary>
 protected internal virtual void OnMouseHoverEnd(MouseData mouseData)
 {
     if (MouseHoverEnd != null)
     {
         MouseHoverEnd(this, new MouseEventArgs(mouseData));
     }
 }
コード例 #31
0
ファイル: Control.cs プロジェクト: AIBrain/ochregui
        // /////////////////////////////////////////////////////////////////////////////////
        // /////////////////////////////////////////////////////////////////////////////////
        /// <summary>
        /// Base method sets the IsBeingPushed state if applicable.  Override to add
        /// custom handling code after calling this base method.
        /// </summary>
        /// <param name="mouseData"></param>
        protected internal override void OnMouseButtonUp(MouseData mouseData)
        {
            base.OnMouseButtonUp(mouseData);

            if (mouseData.MouseButton == MouseButton.LeftButton)
            {
                IsBeingPushed = false;
            }
        }
コード例 #32
0
ファイル: Component.cs プロジェクト: AIBrain/ochregui
        // /////////////////////////////////////////////////////////////////////////////////
        // /////////////////////////////////////////////////////////////////////////////////
        /// <summary>
        /// Called when the mouse has moved to a new cell position.  Override to add
        /// mouse move handling code.
        /// </summary>
        protected internal virtual void OnMouseMoved(MouseData mouseData)
        {
            CurrentMousePos = mouseData.Position;

            if (MouseMoved != null)
            {
                MouseMoved(this, new MouseEventArgs(mouseData));
            }
        }
コード例 #33
0
ファイル: EmitterButton.cs プロジェクト: AIBrain/ochregui
        // /////////////////////////////////////////////////////////////////////////////////
        // /////////////////////////////////////////////////////////////////////////////////
        /// <summary>
        /// Called by the framework when a mouse button is released while over this control.
        /// Base method removes the schedules for the emit cycle.
        /// </summary>
        /// <param name="mouseData"></param>
        protected override void OnMouseButtonUp(MouseData mouseData)
        {
            base.OnMouseButtonUp(mouseData);

            if (mouseData.MouseButton == MouseButton.LeftButton)
            {
                RemoveSchedule(EmitSchedule);
                RemoveSchedule(CountdownSchedule);
            }
        }
コード例 #34
0
ファイル: Menu.cs プロジェクト: AIBrain/ochregui
        // /////////////////////////////////////////////////////////////////////////////////
        // /////////////////////////////////////////////////////////////////////////////////
        /// <summary>
        /// Base method detects if a menu item was selected, and calls OnItemSelected if this
        /// is the case.  Override to add custom handling.
        /// </summary>
        /// <param name="mouseData"></param>
        protected internal override void OnMouseButtonDown(MouseData mouseData)
        {
            base.OnMouseButtonDown(mouseData);

            if (mouseOverIndex != -1)
            {
                OnItemSelected(mouseOverIndex);
            }
        }
コード例 #35
0
ファイル: Control.cs プロジェクト: AIBrain/ochregui
 // /////////////////////////////////////////////////////////////////////////////////
 // /////////////////////////////////////////////////////////////////////////////////
 /// <summary>
 /// Base method requests that a tooltip be displayed, calling this.DetermineTooltipText()
 /// to get the displayed text.  Override to add custom handling code after calling 
 /// this base method.
 /// </summary>
 /// <param name="mouseData"></param>
 protected internal override void OnMouseHoverBegin(MouseData mouseData)
 {
     base.OnMouseHoverBegin(mouseData);
     ParentWindow.ShowTooltip(DetermineTooltipText(), mouseData.Position);
 }
コード例 #36
0
ファイル: InputManager.cs プロジェクト: vanattab/ochregui
        // /////////////////////////////////////////////////////////////////////////////////

        // /////////////////////////////////////////////////////////////////////////////////
        private void StartHover(MouseData mouse)
        {
            attachedComponent.OnMouseHoverBegin(mouse);

            isHovering = true;
        }
コード例 #37
0
ファイル: InputManager.cs プロジェクト: vanattab/ochregui
        // /////////////////////////////////////////////////////////////////////////////////

        // /////////////////////////////////////////////////////////////////////////////////
        private void StopDrag(MouseData mouse)
        {
            isDragging = false;

            attachedComponent.OnMouseDragEnd(mouse.Position);
        }
コード例 #38
0
ファイル: Sample2.cs プロジェクト: AIBrain/ochregui
        /// Usually, to add a tooltip, we would set a Control's TooltTipText property to the desired text.  However,
        /// here we are adding a tooltip to the entire window, so this won't work.  Window's do not provide automatic
        /// tooltip support (probably because it is usually a bad idea).  Fortunately, adding tooltips
        /// to a window is fairly easy.  We just override OnMouseHoverBegin, and call ShowTooltip().  The framework
        /// handles closing the tooltip automatically when the mouse moves.
        protected override void OnMouseHoverBegin(MouseData mouseData)
        {
            base.OnMouseHoverBegin(mouseData);

            /// We only show the tooltip when the mouse pointer is at the same position as the player position.
            if(mouseData.Position == currentPos)
                ShowTooltip("It's you!", mouseData.Position);
        }
コード例 #39
0
ファイル: Window.cs プロジェクト: AIBrain/ochregui
        // /////////////////////////////////////////////////////////////////////////////////
        // /////////////////////////////////////////////////////////////////////////////////
        /// <summary>
        /// Base method propagates messages to children controls and managers.  Override to
        /// add custom handling.
        /// </summary>
        protected internal override void OnMouseButtonUp(MouseData mouseData)
        {
            base.OnMouseButtonUp(mouseData);

            foreach (Manager m in managerList)
            {
                m.OnMouseButtonUp(mouseData);
            }

            if (CurrentUnderMouse != null && CurrentUnderMouse.IsActive)
            {
                CurrentUnderMouse.OnMouseButtonUp(mouseData);
            }

            LastLBDown = null;
        }
コード例 #40
0
ファイル: EmitterButton.cs プロジェクト: AIBrain/ochregui
        // /////////////////////////////////////////////////////////////////////////////////
        /// <summary>
        /// Called by the framework when a mouse button is pressed while over this button.
        /// Base method creates and starts the schedules for the emit cycle.
        /// </summary>
        /// <param name="mouseData"></param>
        protected override void OnMouseButtonDown(MouseData mouseData)
        {
            base.OnMouseButtonDown(mouseData);

            if (mouseData.MouseButton == MouseButton.LeftButton)
            {
                DoStartEmitting();
            }
        }
コード例 #41
0
ファイル: Window.cs プロジェクト: AIBrain/ochregui
        // /////////////////////////////////////////////////////////////////////////////////
        // /////////////////////////////////////////////////////////////////////////////////
        /// <summary>
        /// Base method propagates messages to children controls and managers.  Override to
        /// add custom handling.
        /// </summary>
        protected internal override void OnMouseHoverEnd(MouseData mouseData)
        {
            if (CurrentTooltip != null)
            {
                CurrentTooltip.Dispose();
                CurrentTooltip = null;
            }

            base.OnMouseHoverEnd(mouseData);

            foreach (Manager m in managerList)
            {
                m.OnMouseHoverEnd(mouseData);
            }

            if (CurrentUnderMouse != null && CurrentUnderMouse.IsActive)
            {
                CurrentUnderMouse.OnMouseHoverEnd(mouseData);
            }
        }
コード例 #42
0
ファイル: ListBox.cs プロジェクト: AIBrain/ochregui
        // /////////////////////////////////////////////////////////////////////////////////
        // /////////////////////////////////////////////////////////////////////////////////
        /// <summary>
        /// Detects which, if any, item has been selected by a left mouse button.  Override
        /// to add custom handling.
        /// </summary>
        /// <param name="mouseData"></param>
        protected internal override void OnMouseButtonDown(MouseData mouseData)
        {
            base.OnMouseButtonDown(mouseData);

            if (mouseOverIndex != -1)
            {
                if (CurrentSelected != mouseOverIndex)
                {
                    CurrentSelected = mouseOverIndex;
                    OnItemSelected(CurrentSelected);
                }

            }
        }
コード例 #43
0
ファイル: InputManager.cs プロジェクト: vanattab/ochregui
        // /////////////////////////////////////////////////////////////////////////////////

        // /////////////////////////////////////////////////////////////////////////////////
        private void StopHover(MouseData mouse)
        {
            attachedComponent.OnMouseHoverEnd(mouse);

            isHovering = false;
        }
コード例 #44
0
ファイル: CheckBox.cs プロジェクト: AIBrain/ochregui
        // /////////////////////////////////////////////////////////////////////////////////
        /// <summary>
        /// Triggers appropriate events based on a mouse button down action.  Override to
        /// add custom mouse button handling code.
        /// </summary>
        /// <param name="mouseData"></param>
        protected internal override void OnMouseButtonDown(MouseData mouseData)
        {
            base.OnMouseButtonDown(mouseData);

            if (mouseData.MouseButton == MouseButton.LeftButton)
            {
                if (IsChecked)
                {
                    IsChecked = false;
                }
                else
                {
                    IsChecked = true;
                }

                if (CheckBoxToggled != null)
                {
                    CheckBoxToggled(this, EventArgs.Empty);
                }
            }
        }