diff options
author | jmarshallnz <jmarshallnz@svn> | 2010-01-08 04:51:50 +0000 |
---|---|---|
committer | jmarshallnz <jmarshallnz@svn> | 2010-01-08 04:51:50 +0000 |
commit | 91d92b85b573359c2ba6e99f5e0c3203e41431b5 (patch) | |
tree | fd3bec6eff026209937ecd1c7cfd42cf8899656d /guilib/GUIControlGroupList.cpp | |
parent | 04f2f7f645644e7816b326833a7b2f0f2c5d82e6 (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/GUIControlGroupList.cpp')
-rw-r--r-- | guilib/GUIControlGroupList.cpp | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/guilib/GUIControlGroupList.cpp b/guilib/GUIControlGroupList.cpp index b339fa5da6..4670af2afc 100644 --- a/guilib/GUIControlGroupList.cpp +++ b/guilib/GUIControlGroupList.cpp @@ -311,30 +311,31 @@ void CGUIControlGroupList::ScrollTo(float offset) m_scrollSpeed = (m_scrollOffset - m_offset) / m_scrollTime; } -bool CGUIControlGroupList::CanFocusFromPoint(const CPoint &point, CGUIControl **control, CPoint &controlPoint) const +void CGUIControlGroupList::GetControlsFromPoint(const CPoint &point, std::vector< std::pair<CGUIControl *, CPoint> > &controls) const { - if (!CGUIControl::CanFocus()) return false; + if (!CGUIControl::CanFocus()) return; float pos = 0; CPoint controlCoords(point); m_transform.InverseTransformPosition(controlCoords.x, controlCoords.y); float alignOffset = GetAlignOffset(); for (ciControls it = m_children.begin(); it != m_children.end(); ++it) { - const CGUIControl *child = *it; + CGUIControl *child = *it; if (child->IsVisible()) { if (pos + Size(child) > m_offset && pos < m_offset + Size()) { // we're on screen float offsetX = m_orientation == VERTICAL ? m_posX : m_posX + alignOffset + pos - m_offset; float offsetY = m_orientation == VERTICAL ? m_posY + alignOffset + pos - m_offset : m_posY; - if (child->CanFocusFromPoint(controlCoords - CPoint(offsetX, offsetY), control, controlPoint)) - return true; + CPoint childCoords; + if (child->IsGroup()) + ((CGUIControlGroup *)child)->GetControlsFromPoint(controlCoords - CPoint(offsetX, offsetY), controls); + else if (child->CanFocusFromPoint(controlCoords - CPoint(offsetX, offsetY), childCoords)) + controls.push_back(std::make_pair(child, childCoords)); } pos += Size(child) + m_itemGap; } } - *control = NULL; - return false; } void CGUIControlGroupList::UnfocusFromPoint(const CPoint &point) |