Esempio n. 1
0
bool CGUIBaseContainer::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)
    {
        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;

            MoveToItem(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;
}
Esempio n. 2
0
bool CGUIListContainer::SelectItemFromPoint(const CPoint &point)
{
  CPoint itemPoint;
  int row = GetCursorFromPoint(point, &itemPoint);
  if (row < 0)
    return false;

  SetCursor(row);
  CGUIListItemLayout *focusedLayout = GetFocusedLayout();
  if (focusedLayout)
    focusedLayout->SelectItemFromPoint(itemPoint);
  return true;
}