diff options
author | jmarshallnz <jmarshallnz@svn> | 2010-01-10 08:27:34 +0000 |
---|---|---|
committer | jmarshallnz <jmarshallnz@svn> | 2010-01-10 08:27:34 +0000 |
commit | 9d235728b674404a0d54b06b8a8febcad0bded1c (patch) | |
tree | 534d7ff1a47fe80c2c3607996d60437f1b316771 /guilib/GUIScrollBarControl.cpp | |
parent | 2ea674eaca7213df208715f0676c0a0e122ab287 (diff) |
improved: Better exclusive control support for mouse dragging of sliders/scroll bars.
git-svn-id: https://xbmc.svn.sourceforge.net/svnroot/xbmc/trunk@26618 568bbfeb-2a22-0410-94d2-cc84cf5bfa90
Diffstat (limited to 'guilib/GUIScrollBarControl.cpp')
-rw-r--r-- | guilib/GUIScrollBarControl.cpp | 46 |
1 files changed, 23 insertions, 23 deletions
diff --git a/guilib/GUIScrollBarControl.cpp b/guilib/GUIScrollBarControl.cpp index 36f866c362..7bab89df70 100644 --- a/guilib/GUIScrollBarControl.cpp +++ b/guilib/GUIScrollBarControl.cpp @@ -20,7 +20,6 @@ */ #include "GUIScrollBarControl.h" -#include "MouseStat.h" #include "Key.h" #define MIN_NIB_SIZE 4.0f @@ -265,35 +264,36 @@ void CGUIScrollBar::SetFromPosition(const CPoint &point) SetInvalid(); } -bool CGUIScrollBar::OnMouseClick(int button, const CPoint &point) +bool CGUIScrollBar::OnMouseEvent(const CPoint &point, const CMouseEvent &event) { - g_Mouse.SetState(MOUSE_STATE_CLICK); - // turn off any exclusive access, if it's on... - g_Mouse.EndExclusiveAccess(this, GetParentID()); - if (m_guiBackground.HitTest(point)) - { // set the position + if (event.m_id == ACTION_MOUSE_DRAG) + { + if (event.m_state == 1) + { // we want exclusive access + CGUIMessage msg(GUI_MSG_EXCLUSIVE_MOUSE, GetID(), GetParentID()); + SendWindowMessage(msg); + } + else if (event.m_state == 3) + { // we're done with exclusive access + CGUIMessage msg(GUI_MSG_EXCLUSIVE_MOUSE, 0, GetParentID()); + SendWindowMessage(msg); + } + SetFromPosition(point); + return true; + } + else if (event.m_id == ACTION_MOUSE_CLICK && m_guiBackground.HitTest(point)) + { SetFromPosition(point); return true; } + else if (event.m_id == ACTION_MOUSE_WHEEL) + { + Move(-event.m_wheel); + return true; + } return false; } -bool CGUIScrollBar::OnMouseDrag(const CPoint &offset, const CPoint &point) -{ - g_Mouse.SetState(MOUSE_STATE_DRAG); - // get exclusive access to the mouse - g_Mouse.SetExclusiveAccess(this, GetParentID(), point); - // get the position of the mouse - SetFromPosition(point); - return true; -} - -bool CGUIScrollBar::OnMouseWheel(char wheel, const CPoint &point) -{ - Move(-wheel); - return true; -} - CStdString CGUIScrollBar::GetDescription() const { CStdString description; |