bool CGUIBaseContainer::OnClick(int actionID) { int subItem = 0; if (actionID == ACTION_SELECT_ITEM || actionID == ACTION_MOUSE_LEFT_CLICK) { if (m_listProvider) { // "select" action int selected = GetSelectedItem(); if (selected >= 0 && selected < (int)m_items.size()) { if (m_clickActions.HasActionsMeetingCondition()) m_clickActions.ExecuteActions(0, GetParentID(), m_items[selected]); else m_listProvider->OnClick(m_items[selected]); } return true; } // grab the currently focused subitem (if applicable) CGUIListItemLayout *focusedLayout = GetFocusedLayout(); if (focusedLayout) subItem = focusedLayout->GetFocusedItem(); } else if (actionID == ACTION_MOUSE_RIGHT_CLICK) { if (OnContextMenu()) return true; } // Don't know what to do, so send to our parent window. CGUIMessage msg(GUI_MSG_CLICKED, GetID(), GetParentID(), actionID, subItem); return SendWindowMessage(msg); }
bool CGUIBaseContainer::GetCondition(int condition, int data) const { switch (condition) { case CONTAINER_ROW: return (m_orientation == VERTICAL) ? (GetCursor() == data) : true; case CONTAINER_COLUMN: return (m_orientation == HORIZONTAL) ? (GetCursor() == data) : true; case CONTAINER_POSITION: return (GetCursor() == data); case CONTAINER_HAS_NEXT: return (HasNextPage()); case CONTAINER_HAS_PREVIOUS: return (HasPreviousPage()); case CONTAINER_HAS_PARENT_ITEM: return (m_items.size() && m_items[0]->IsFileItem() && (std::static_pointer_cast<CFileItem>(m_items[0]))->IsParentFolder()); case CONTAINER_SUBITEM: { CGUIListItemLayout *layout = GetFocusedLayout(); return layout ? (layout->GetFocusedItem() == (unsigned int)data) : false; } case CONTAINER_SCROLLING: return ((m_scrollTimer.IsRunning() && m_scrollTimer.GetElapsedMilliseconds() > std::max(m_scroller.GetDuration(), SCROLLING_THRESHOLD)) || m_pageChangeTimer.IsRunning()); case CONTAINER_ISUPDATING: return (m_listProvider) ? m_listProvider->IsUpdating() : false; default: return false; } }
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; }
void CGUIBaseContainer::OnRight() { CGUIAction action = GetAction(ACTION_MOVE_RIGHT); bool wrapAround = action.GetNavigation() == GetID() || !action.HasActionsMeetingCondition(); if (m_orientation == HORIZONTAL && MoveDown(wrapAround)) return; else if (m_orientation == VERTICAL) { CGUIListItemLayout *focusedLayout = GetFocusedLayout(); if (focusedLayout && focusedLayout->MoveRight()) return; } CGUIControl::OnRight(); }