From 43d3acbfcc8fbabdc8ca10ac6594f69a82783ec3 Mon Sep 17 00:00:00 2001 From: chriszero Date: Fri, 10 Jul 2015 20:41:12 +0200 Subject: Viewelement for all grids. --- browserGrid.cpp | 24 +++++++++++++----------- templates/plug-plex-root.xml | 13 +++++++++++++ 2 files changed, 26 insertions(+), 11 deletions(-) diff --git a/browserGrid.cpp b/browserGrid.cpp index 9a947e8..f9bb026 100644 --- a/browserGrid.cpp +++ b/browserGrid.cpp @@ -61,6 +61,7 @@ void cBrowserGrid::Flush() cMutexLock MutexLock(&cPlexSdOsd::RedrawMutex); m_pGrid->Display(); + m_pScrollbar->Display(); m_pRootView->Display(); } @@ -256,6 +257,7 @@ void cBrowserGrid::DrawGrid() m_pHeader->Display(); DrawInfopane(); DrawFooter(); + DrawScrollbar(); } void cBrowserGrid::DrawBackground() @@ -360,25 +362,25 @@ void cBrowserGrid::DrawFooter() void cBrowserGrid::DrawScrollbar() { - /* + if (m_vElements.size() == 0) return; - int scrollBarHeight = (double)m_rows / (double)m_vElements.size() * 1000; - - // in welcher Zeile sind wir? + int currentRow = SelectedObject()->AbsolutePosition / m_columns; + int totalRows = m_vElements.size() / m_columns; + + int scrollBarHeight = 100.0 / totalRows * m_rows; - int offset = (double)startPos / (double)m_vElements.size() * 1000; + int offset = 100.0 / totalRows * currentRow; + if(offset >= 100 - scrollBarHeight) { + offset = 100.0 - scrollBarHeight; + } m_pScrollbar->Clear(); m_pScrollbar->ClearTokens(); - - int y = (100 - GetHeight())/2; - - m_pScrollbar->AddIntToken("posy", y); - m_pScrollbar->AddIntToken("totalheight", menuHeight); + m_pScrollbar->AddIntToken("height", scrollBarHeight); m_pScrollbar->AddIntToken("offset", offset); - m_pScrollbar->Display();*/ + m_pScrollbar->Display(); } void cBrowserGrid::NextTab() diff --git a/templates/plug-plex-root.xml b/templates/plug-plex-root.xml index 49d710a..3f9c479 100644 --- a/templates/plug-plex-root.xml +++ b/templates/plug-plex-root.xml @@ -44,6 +44,19 @@ + + + + + -- cgit v1.2.3