diff options
author | jmarshallnz <jmarshallnz@svn> | 2010-01-06 04:46:12 +0000 |
---|---|---|
committer | jmarshallnz <jmarshallnz@svn> | 2010-01-06 04:46:12 +0000 |
commit | 5da130fb49b997deea4845b4d665f3ddd9ac15a0 (patch) | |
tree | 445d4cfa0a6aa5c5e499554b0defc5378bbff7a4 /guilib/GUIListContainer.cpp | |
parent | 0498d2938afb198acf3226ce842ed1174aba49b6 (diff) |
cleanup: removed unused function, and moved the list implementation of SelectItemFromPoint out of CGUIBaseContainer
git-svn-id: https://xbmc.svn.sourceforge.net/svnroot/xbmc/trunk@26447 568bbfeb-2a22-0410-94d2-cc84cf5bfa90
Diffstat (limited to 'guilib/GUIListContainer.cpp')
-rw-r--r-- | guilib/GUIListContainer.cpp | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/guilib/GUIListContainer.cpp b/guilib/GUIListContainer.cpp index 70383c5e01..dcee1a723c 100644 --- a/guilib/GUIListContainer.cpp +++ b/guilib/GUIListContainer.cpp @@ -241,6 +241,41 @@ void CGUIListContainer::SelectItem(int item) } } } + +bool CGUIListContainer::SelectItemFromPoint(const CPoint &point) +{ + if (!m_focusedLayout || !m_layout) + return false; + + int row = 0; + float pos = (m_orientation == VERTICAL) ? point.y : point.x; + while (row < m_itemsPerPage + 1) // 1 more to ensure we get the (possible) half item at the end. + { + const CGUIListItemLayout *layout = (row == m_cursor) ? m_focusedLayout : m_layout; + if (pos < layout->Size(m_orientation) && row + m_offset < (int)m_items.size()) + { // found correct "row" -> check horizontal + if (!InsideLayout(layout, point)) + return false; + + m_cursor = row; + CGUIListItemLayout *focusedLayout = GetFocusedLayout(); + if (focusedLayout) + { + CPoint pt(point); + if (m_orientation == VERTICAL) + pt.y = pos; + else + pt.x = pos; + focusedLayout->SelectItemFromPoint(pt); + } + return true; + } + row++; + pos -= layout->Size(m_orientation); + } + return false; +} + //#ifdef PRE_SKIN_VERSION_9_10_COMPATIBILITY CGUIListContainer::CGUIListContainer(int parentID, int controlID, float posX, float posY, float width, float height, const CLabelInfo& labelInfo, const CLabelInfo& labelInfo2, |