From 86cfa7fa64406971990160db56b71c7a71dcf3e5 Mon Sep 17 00:00:00 2001 From: chriszero Date: Tue, 19 May 2015 19:06:22 +0200 Subject: - Dedicicated grid for each viewmode --- viewGridNavigator.cpp | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) (limited to 'viewGridNavigator.cpp') diff --git a/viewGridNavigator.cpp b/viewGridNavigator.cpp index 938b49d..50d0951 100644 --- a/viewGridNavigator.cpp +++ b/viewGridNavigator.cpp @@ -12,17 +12,24 @@ cGridElement::cGridElement() m_bInit = true; } -cViewGridNavigator::cViewGridNavigator(skindesignerapi::cOsdView* rootView, skindesignerapi::cViewGrid* viewGrid) +cViewGridNavigator::cViewGridNavigator(skindesignerapi::cOsdView* rootView) { m_columns = 2; m_rows = 2; m_newDimensions = true; m_setIterator = true; - m_pGrid = std::shared_ptr(viewGrid); + m_pGrid = NULL; m_pRootView = rootView; } +void cViewGridNavigator::SetViewGrid(std::shared_ptr grid) +{ + if (grid) { + if(m_pGrid) m_pGrid->Clear(); + m_pGrid = std::shared_ptr(grid); + } +} void cViewGridNavigator::ReDraw(cGridElement* element) { @@ -117,6 +124,8 @@ void cViewGridNavigator::SetGridElementData(cGridElement *obj) // set GridDimensions m_pGrid->AddIntToken("columns", m_columns); m_pGrid->AddIntToken("rows", m_rows); + m_pGrid->AddIntToken("position", obj->AbsolutePosition); + m_pGrid->AddIntToken("totalcount", m_vElements.size()); } else { obj->SetPosition(x, y); m_pGrid->MoveGrid(obj->GridElementId(), x, y, width, height); @@ -135,7 +144,7 @@ bool cViewGridNavigator::NavigateDown() if (m_activeElementIter == m_vElements.end() - 1) return false; auto next = m_activeElementIter + m_columns; if(next >= m_vElements.end()) next = m_vElements.end()-1; - + // scroll down? if(!(*next)->IsVisible()) { FilterElements(m_columns); @@ -152,7 +161,7 @@ bool cViewGridNavigator::NavigateUp() if (m_activeElementIter == m_vElements.begin()) return false; auto next = m_activeElementIter - m_columns; if(next < m_vElements.begin()) next = m_vElements.begin(); - + //scroll up? if(!(*next)->IsVisible()) { FilterElements(-m_columns); -- cgit v1.2.3