aboutsummaryrefslogtreecommitdiff
path: root/guilib/GUIControlGroup.cpp
diff options
context:
space:
mode:
authorjmarshallnz <jmarshallnz@svn>2010-01-08 04:51:50 +0000
committerjmarshallnz <jmarshallnz@svn>2010-01-08 04:51:50 +0000
commit91d92b85b573359c2ba6e99f5e0c3203e41431b5 (patch)
treefd3bec6eff026209937ecd1c7cfd42cf8899656d /guilib/GUIControlGroup.cpp
parent04f2f7f645644e7816b326833a7b2f0f2c5d82e6 (diff)
cleanup: Changed the way controls are selected for focus under the mouse pointer. Fixes potential issues with control groups ignoring anything other than the first possibly focusable control when passing mouse actions.
git-svn-id: https://xbmc.svn.sourceforge.net/svnroot/xbmc/trunk@26534 568bbfeb-2a22-0410-94d2-cc84cf5bfa90
Diffstat (limited to 'guilib/GUIControlGroup.cpp')
-rw-r--r--guilib/GUIControlGroup.cpp15
1 files changed, 9 insertions, 6 deletions
diff --git a/guilib/GUIControlGroup.cpp b/guilib/GUIControlGroup.cpp
index 3ddb3517d8..a87700169d 100644
--- a/guilib/GUIControlGroup.cpp
+++ b/guilib/GUIControlGroup.cpp
@@ -367,19 +367,22 @@ bool CGUIControlGroup::HitTest(const CPoint &point) const
return false;
}
-bool CGUIControlGroup::CanFocusFromPoint(const CPoint &point, CGUIControl **control, CPoint &controlPoint) const
+void CGUIControlGroup::GetControlsFromPoint(const CPoint &point, vector< std::pair<CGUIControl *, CPoint> > &controls) const
{
- if (!CGUIControl::CanFocus()) return false;
+ if (!CGUIControl::CanFocus())
+ return;
CPoint controlCoords(point);
m_transform.InverseTransformPosition(controlCoords.x, controlCoords.y);
+ controlCoords -= CPoint(m_posX, m_posY);
for (crControls it = m_children.rbegin(); it != m_children.rend(); ++it)
{
CGUIControl *child = *it;
- if (child->CanFocusFromPoint(controlCoords - CPoint(m_posX, m_posY), control, controlPoint))
- return true;
+ CPoint childCoords;
+ if (child->IsGroup())
+ ((CGUIControlGroup *)child)->GetControlsFromPoint(controlCoords, controls);
+ else if (child->CanFocusFromPoint(controlCoords, childCoords))
+ controls.push_back(make_pair(child, childCoords));
}
- *control = NULL;
- return false;
}
void CGUIControlGroup::UnfocusFromPoint(const CPoint &point)