aboutsummaryrefslogtreecommitdiff
path: root/guilib/GUIButtonScroller.cpp
diff options
context:
space:
mode:
authorjmarshallnz <jmarshallnz@svn>2010-01-10 09:51:44 +0000
committerjmarshallnz <jmarshallnz@svn>2010-01-10 09:51:44 +0000
commit6bad1095f41a98b72b9e8e49a2a44ea72508fb7c (patch)
treee7a6466ececbfa2b445fd976557f9601040e75a4 /guilib/GUIButtonScroller.cpp
parent2ebfc8547d04f17a9c21690a4ce49c46d8b4ec48 (diff)
cleanup: Replaced OnMouseClick/DoubleClick/Wheel/Drag with OnMouseEvent
git-svn-id: https://xbmc.svn.sourceforge.net/svnroot/xbmc/trunk@26626 568bbfeb-2a22-0410-94d2-cc84cf5bfa90
Diffstat (limited to 'guilib/GUIButtonScroller.cpp')
-rw-r--r--guilib/GUIButtonScroller.cpp57
1 files changed, 16 insertions, 41 deletions
diff --git a/guilib/GUIButtonScroller.cpp b/guilib/GUIButtonScroller.cpp
index 272f8b6e5c..7466c8f83a 100644
--- a/guilib/GUIButtonScroller.cpp
+++ b/guilib/GUIButtonScroller.cpp
@@ -28,7 +28,6 @@
#include "SkinInfo.h"
#include "StringUtils.h"
#include "GUIControlFactory.h"
-#include "MouseStat.h"
#include "tinyXML/tinyxml.h"
#include "Key.h"
@@ -887,61 +886,37 @@ bool CGUIButtonScroller::OnMouseOver(const CPoint &point)
return CGUIControl::OnMouseOver(point);
}
-bool CGUIButtonScroller::OnMouseClick(int button, const CPoint &point)
+bool CGUIButtonScroller::OnMouseEvent(const CPoint &point, const CMouseEvent &event)
{
- if (button != MOUSE_LEFT_BUTTON && button != MOUSE_RIGHT_BUTTON) return false;
- // check if we are in the clickable button zone
float fStartAlpha, fEndAlpha;
GetScrollZone(fStartAlpha, fEndAlpha);
- if (m_bHorizontal)
+ if ((m_bHorizontal && point.x >= fStartAlpha && point.x <= fEndAlpha) ||
+ (!m_bHorizontal && point.y >= fStartAlpha && point.y <= fEndAlpha))
{
- if (point.x >= fStartAlpha && point.x <= fEndAlpha)
- { // click the appropriate item
- m_iCurrentSlot = (int)((point.x - m_posX) / (m_imgFocus.GetWidth() + m_buttonGap));
+ if (event.m_id == ACTION_MOUSE_LEFT_CLICK)
+ {
+ if (m_bHorizontal)
+ m_iCurrentSlot = (int)((point.x - m_posX) / (m_imgFocus.GetWidth() + m_buttonGap));
+ else
+ m_iCurrentSlot = (int)((point.y - m_posY) / (m_imgFocus.GetHeight() + m_buttonGap));
CAction action;
- if (button == MOUSE_LEFT_BUTTON)
- action.id = ACTION_SELECT_ITEM;
- if (button == MOUSE_RIGHT_BUTTON)
- action.id = ACTION_CONTEXT_MENU;
+ action.id = ACTION_SELECT_ITEM;
OnAction(action);
return true;
}
- }
- else
- {
- if (point.y >= fStartAlpha && point.y <= fEndAlpha)
+ else if (event.m_id == ACTION_MOUSE_WHEEL)
{
- m_iCurrentSlot = (int)((point.y - m_posY) / (m_imgFocus.GetHeight() + m_buttonGap));
- CAction action;
- if (button == MOUSE_LEFT_BUTTON)
- action.id = ACTION_SELECT_ITEM;
- if (button == MOUSE_RIGHT_BUTTON)
- action.id = ACTION_CONTEXT_MENU;
- OnAction(action);
+ if (event.m_wheel > 0)
+ m_bScrollDown = true;
+ else
+ m_bScrollUp = true;
+ m_fScrollSpeed = SCROLL_SPEED;
return true;
}
}
return false;
}
-bool CGUIButtonScroller::OnMouseWheel(char wheel, const CPoint &point)
-{
- // check if we are within the clickable button zone
- float fStartAlpha, fEndAlpha;
- GetScrollZone(fStartAlpha, fEndAlpha);
- if ((m_bHorizontal && point.x >= fStartAlpha && point.x <= fEndAlpha) ||
- (!m_bHorizontal && point.y >= fStartAlpha && point.y <= fEndAlpha))
- {
- if (wheel > 0)
- m_bScrollDown = true;
- else
- m_bScrollUp = true;
- m_fScrollSpeed = SCROLL_SPEED;
- return true;
- }
- return false;
-}
-
CStdString CGUIButtonScroller::GetDescription() const
{
if (GetActiveButton() >= 0)