summaryrefslogtreecommitdiff
path: root/skinsttng.c
diff options
context:
space:
mode:
Diffstat (limited to 'skinsttng.c')
-rw-r--r--skinsttng.c43
1 files changed, 28 insertions, 15 deletions
diff --git a/skinsttng.c b/skinsttng.c
index c03c9a72..cf67563b 100644
--- a/skinsttng.c
+++ b/skinsttng.c
@@ -4,7 +4,7 @@
* See the main source file 'vdr.c' for copyright information and
* how to reach the author.
*
- * $Id: skinsttng.c 1.23 2008/02/10 16:18:55 kls Exp $
+ * $Id: skinsttng.c 1.24 2008/02/17 12:09:38 kls Exp $
*/
// Star Trek: The Next Generation® is a registered trademark of Paramount Pictures
@@ -348,7 +348,8 @@ private:
int currentIndex;
bool message;
cString lastDate;
- void SetScrollbar(void);
+ void DrawScrollbar(int Total, int Offset, int Shown, int Top, int Height, bool CanScrollUp, bool CanScrollDown);
+ void SetTextScrollbar(void);
public:
cSkinSTTNGDisplayMenu(void);
virtual ~cSkinSTTNGDisplayMenu();
@@ -359,6 +360,7 @@ public:
virtual void SetButtons(const char *Red, const char *Green = NULL, const char *Yellow = NULL, const char *Blue = NULL);
virtual void SetMessage(eMessageType Type, const char *Text);
virtual void SetItem(const char *Text, int Index, bool Current, bool Selectable);
+ virtual void SetScrollbar(int Total, int Offset);
virtual void SetEvent(const cEvent *Event);
virtual void SetRecording(const cRecording *Recording);
virtual void SetText(const char *Text, bool FixedFont);
@@ -435,37 +437,43 @@ cSkinSTTNGDisplayMenu::~cSkinSTTNGDisplayMenu()
delete osd;
}
-void cSkinSTTNGDisplayMenu::SetScrollbar(void)
+void cSkinSTTNGDisplayMenu::DrawScrollbar(int Total, int Offset, int Shown, int Top, int Height, bool CanScrollUp, bool CanScrollDown)
{
- if (textScroller.CanScroll()) {
+ if (Total > 0 && Total > Shown) {
int h = lineHeight;
- int yt = textScroller.Top();
- int yb = yt + textScroller.Height();
+ int yt = Top;
+ int yb = yt + Height;
int st = yt + h + Gap;
int sb = yb - h - Gap;
- int tt = st + (sb - st) * textScroller.Offset() / textScroller.Total();
- int tb = tt + (sb - st) * textScroller.Shown() / textScroller.Total();
+ int tt = st + (sb - st) * Offset / Total;
+ int tb = tt + (sb - st) * Shown / Total;
osd->DrawRectangle(x5, st, x5 + ScrollWidth - 1, sb, Theme.Color(clrMenuScrollbarTotal));
osd->DrawRectangle(x5, tt, x5 + ScrollWidth - 1, tb, Theme.Color(clrMenuScrollbarShown));
osd->DrawRectangle(x5, yt, x6 - 1, yt + h - 1, frameColor);
osd->DrawEllipse (x6, yt, x7 - 1, yt + h - 1, frameColor, 5);
osd->DrawRectangle(x5, yb - h, x6 - 1, yb - 1, frameColor);
osd->DrawEllipse (x6, yb - h, x7 - 1, yb - 1, frameColor, 5);
- if (textScroller.CanScrollUp()) {
+ if (CanScrollUp) {
cBitmap bm(arrowup_xpm);
osd->DrawBitmap(x5 + (x7 - x5 - bm.Width()) / 2 - 2, yt + (h - bm.Height()) / 2, bm, Theme.Color(clrMenuScrollbarArrow), frameColor);
}
- if (textScroller.CanScrollDown()) {
+ if (CanScrollDown) {
cBitmap bm(arrowdown_xpm);
osd->DrawBitmap(x5 + (x7 - x5 - bm.Width()) / 2 - 2, yb - h + (h - bm.Height()) / 2, bm, Theme.Color(clrMenuScrollbarArrow), frameColor);
}
- }
+ }
+}
+
+void cSkinSTTNGDisplayMenu::SetTextScrollbar(void)
+{
+ if (textScroller.CanScroll())
+ DrawScrollbar(textScroller.Total(), textScroller.Offset(), textScroller.Shown(), textScroller.Top(), textScroller.Height(), textScroller.CanScrollUp(), textScroller.CanScrollDown());
}
void cSkinSTTNGDisplayMenu::Scroll(bool Up, bool Page)
{
cSkinDisplayMenu::Scroll(Up, Page);
- SetScrollbar();
+ SetTextScrollbar();
}
int cSkinSTTNGDisplayMenu::MaxItems(void)
@@ -558,6 +566,11 @@ void cSkinSTTNGDisplayMenu::SetItem(const char *Text, int Index, bool Current, b
SetEditableWidth(x4 - x3 - 5 - Tab(1));
}
+void cSkinSTTNGDisplayMenu::SetScrollbar(int Total, int Offset)
+{
+ DrawScrollbar(Total, Offset, MaxItems(), y3 + Roundness, MaxItems() * lineHeight, Offset > 0, Offset + MaxItems() < Total);
+}
+
void cSkinSTTNGDisplayMenu::SetEvent(const cEvent *Event)
{
if (!Event)
@@ -596,7 +609,7 @@ void cSkinSTTNGDisplayMenu::SetEvent(const cEvent *Event)
osd->DrawEllipse (x1, yt - Roundness, x2, yt, frameColor, -3);
osd->DrawRectangle(x1, yt, x2, yb, frameColor);
osd->DrawEllipse (x1, yb, x2, yb + Roundness, frameColor, -2);
- SetScrollbar();
+ SetTextScrollbar();
}
}
@@ -633,14 +646,14 @@ void cSkinSTTNGDisplayMenu::SetRecording(const cRecording *Recording)
osd->DrawEllipse (x1, yt - Roundness, x2, yt, frameColor, -3);
osd->DrawRectangle(x1, yt, x2, yb, frameColor);
osd->DrawEllipse (x1, yb, x2, yb + Roundness, frameColor, -2);
- SetScrollbar();
+ SetTextScrollbar();
}
}
void cSkinSTTNGDisplayMenu::SetText(const char *Text, bool FixedFont)
{
textScroller.Set(osd, x3, y3, GetTextAreaWidth(), y4 - y3, Text, GetTextAreaFont(FixedFont), Theme.Color(clrMenuText), Theme.Color(clrBackground));
- SetScrollbar();
+ SetTextScrollbar();
}
int cSkinSTTNGDisplayMenu::GetTextAreaWidth(void) const