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_SUBITEM: { CGUIListItemLayout *layout = GetFocusedLayout(); return layout ? (layout->GetFocusedItem() == (unsigned int)data) : false; } case CONTAINER_SCROLLING: return (m_scrollTimer.GetElapsedMilliseconds() > std::max(m_scroller.GetDuration(), SCROLLING_THRESHOLD) || m_pageChangeTimer.IsRunning()); default: return false; } }
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 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::OnClick(DWORD actionID) { int subItem = 0; if (actionID == ACTION_SELECT_ITEM || actionID == ACTION_MOUSE_LEFT_CLICK) { if (m_staticContent) { // "select" action int selected = GetSelectedItem(); if (selected >= 0 && selected < (int)m_items.size()) { CFileItemPtr item = boost::static_pointer_cast<CFileItem>(m_items[selected]); // multiple action strings are concat'd together, separated with " , " vector<CStdString> actions; StringUtils::SplitString(item->m_strPath, " , ", actions); for (unsigned int i = 0; i < actions.size(); i++) { CStdString action = actions[i]; action.Replace(",,", ","); CGUIMessage message(GUI_MSG_EXECUTE, GetID(), GetParentID()); message.SetStringParam(action); g_graphicsContext.SendMessage(message); } } return true; } // grab the currently focused subitem (if applicable) CGUIListItemLayout *focusedLayout = GetFocusedLayout(); if (focusedLayout) subItem = focusedLayout->GetFocusedItem(); } // 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::OnClick(int actionID) { int subItem = 0; if (actionID == ACTION_SELECT_ITEM || actionID == ACTION_MOUSE_LEFT_CLICK) { if (m_staticContent) { // "select" action int selected = GetSelectedItem(); if (selected >= 0 && selected < (int)m_items.size()) { CGUIStaticItemPtr item = boost::static_pointer_cast<CGUIStaticItem>(m_items[selected]); item->GetClickActions().Execute(GetID(), GetParentID()); } return true; } // grab the currently focused subitem (if applicable) CGUIListItemLayout *focusedLayout = GetFocusedLayout(); if (focusedLayout) subItem = focusedLayout->GetFocusedItem(); } // Don't know what to do, so send to our parent window. CGUIMessage msg(GUI_MSG_CLICKED, GetID(), GetParentID(), actionID, subItem); return SendWindowMessage(msg); }