diff options
author | jmarshallnz <jmarshallnz@svn> | 2010-01-09 09:05:41 +0000 |
---|---|---|
committer | jmarshallnz <jmarshallnz@svn> | 2010-01-09 09:05:41 +0000 |
commit | 8bd9964d8a756ac92149efe980e2616f8f2e5c4a (patch) | |
tree | 3e09129bec0c4c533d7d5fd1592faceca358dbb8 /guilib/GUIControl.h | |
parent | f2508d4a464540428c7c0f293b356b5a5d1003b4 (diff) |
changed: Improved mouse event handling - we now pass events down through the control structure, giving better context for the performed event. Allows groups to react if their children don't.
git-svn-id: https://xbmc.svn.sourceforge.net/svnroot/xbmc/trunk@26577 568bbfeb-2a22-0410-94d2-cc84cf5bfa90
Diffstat (limited to 'guilib/GUIControl.h')
-rw-r--r-- | guilib/GUIControl.h | 34 |
1 files changed, 32 insertions, 2 deletions
diff --git a/guilib/GUIControl.h b/guilib/GUIControl.h index 267d9a3609..68608f259d 100644 --- a/guilib/GUIControl.h +++ b/guilib/GUIControl.h @@ -37,6 +37,7 @@ class CGUIListItem; // forward class CAction; +class CMouseEvent; enum ORIENTATION { HORIZONTAL = 0, VERTICAL }; @@ -130,8 +131,18 @@ public: virtual bool OnMouseDoubleClick(int button, const CPoint &point) { return false; }; /// \brief Called when the mouse wheel has moved whilst over the control. Default implementation does nothing virtual bool OnMouseWheel(char wheel, const CPoint &point) { return false; }; - /// \brief Used to test whether the pointer location (fPosX, fPosY) is inside the control. For mouse events. - virtual bool HitTest(const CPoint &point) const; + + /*! \brief React to a mouse event + + Mouse events are sent from the window to all controls, and each control can react based on the event + and location of the event. + + \param point the location in skin coordinates from the upper left corner of the parent control. + \param event the mouse event to perform + \return true if the control has handled this event, false otherwise + \sa HitTest, CanFocusFromPoint, CMouseEvent + */ + virtual bool SendMouseEvent(const CPoint &point, const CMouseEvent &event); /*! \brief Test whether we can focus a control from a point on screen \param point the location in skin coordinates from the upper left corner of the parent control. @@ -147,6 +158,13 @@ public: */ virtual void UnfocusFromPoint(const CPoint &point); + /*! \brief Used to test whether the point is inside a control. + \param point location to test + \return true if the point is inside the bounds of this control. + \sa SetHitRect + */ + virtual bool HitTest(const CPoint &point) const; + virtual bool OnMessage(CGUIMessage& message); virtual int GetID(void) const; void SetID(int id) { m_controlID = id; }; @@ -277,6 +295,18 @@ public: virtual void DumpTextureUse() {}; #endif protected: + /*! \brief Perform a mouse action + + Mouse actions are sent from the window to all controls, and each control can react based on the event + and location of the actions. + + \param point the location in skin coordinates from the upper left corner of the parent control. + \param event the mouse event to perform + \return true if the control has handled this event, false otherwise + \sa SendMouseEvent, HitTest, CanFocusFromPoint, CMouseEvent + */ + virtual bool OnMouseEvent(const CPoint &point, const CMouseEvent &event); + virtual void UpdateColors(); virtual void Animate(unsigned int currentTime); virtual bool CheckAnimation(ANIMATION_TYPE animType); |