summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--browserGrid.cpp24
-rw-r--r--templates/plug-plex-root.xml13
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 @@
<viewelement name="header">
</viewelement>
+ <!-- Tokens available for scrollbar
+ {height} height of the position marker of the scrollbar in percent
+ {offset} offset for the position marker from the top of the scrollbar in percent
+ -->
+ <viewelement name="scrollbar">
+ <!-- example:
+ <area x="66%" y="15%" width="9%" height="75%" layer="4">
+ <drawrectangle x="0" y="2" width="{areawidth}-2" height="{areaheight}" color="{clrRed}" />
+ <drawrectangle x="0" y="{areaheight} / 100 * {offset}" width="{areawidth}" height="{areaheight} / 100 * {height}" color="{clrGreen}" />
+ </area>
+ -->
+ </viewelement>
+
<viewelement name="infopane">
</viewelement>