summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKlaus Schmidinger <vdr@tvdr.de>2008-02-17 12:31:16 +0100
committerKlaus Schmidinger <vdr@tvdr.de>2008-02-17 12:31:16 +0100
commit54b4d4e4e752ce10142c1f0c61f39c3782e460d9 (patch)
treeba0522ff71b3d39da559c5d81ddb787dad25b1b7
parent28a82b318686d157135e2a6133b12490a72d3c2e (diff)
downloadvdr-54b4d4e4e752ce10142c1f0c61f39c3782e460d9.tar.gz
vdr-54b4d4e4e752ce10142c1f0c61f39c3782e460d9.tar.bz2
Implemented cSkin::SetScrollbar()
-rw-r--r--HISTORY5
-rw-r--r--UPDATE-1.6.01
-rw-r--r--osdbase.c3
-rw-r--r--skinclassic.c104
-rw-r--r--skins.c6
-rw-r--r--skins.h7
-rw-r--r--skinsttng.c43
7 files changed, 104 insertions, 65 deletions
diff --git a/HISTORY b/HISTORY
index 991f76a0..dfdfade7 100644
--- a/HISTORY
+++ b/HISTORY
@@ -5579,7 +5579,7 @@ Video Disk Recorder Revision History
is not available, in order to allow staying on an encrypted channel that takes
a while for the CAM to start decrypting.
-2008-02-16: Version 1.5.15
+2008-02-17: Version 1.5.15
- Updated the Italian OSD texts (thanks to Diego Pierotto).
- Added option -i to the pictures plugin's pic2mpg to ignore unknown file types.
@@ -5637,3 +5637,6 @@ Video Disk Recorder Revision History
(based on a patch from Benedikt Elser).
- Added new cStatus functions to the 'status' plugin.
- Added missing #include <limits.h> to epg.c and menuitems.h (thanks to Ville Skyttä).
+- The new function cSkin::SetScrollbar() can be implemented by skins to display
+ a scrollbar in every list menu. The 'classic' and 'sttng' skins have been
+ changed accordingly.
diff --git a/UPDATE-1.6.0 b/UPDATE-1.6.0
index 1a79e517..33abde06 100644
--- a/UPDATE-1.6.0
+++ b/UPDATE-1.6.0
@@ -54,6 +54,7 @@ OSD:
the one that was created first will be displayed.
Plugins that provide an OSD need to adjust their cOsdProvider::CreateOsd()
function to hand through the Level.
+- Skins can now have scrollbars in all list menus.
Channels:
diff --git a/osdbase.c b/osdbase.c
index 17373496..0d9b6d85 100644
--- a/osdbase.c
+++ b/osdbase.c
@@ -4,7 +4,7 @@
* See the main source file 'vdr.c' for copyright information and
* how to reach the author.
*
- * $Id: osdbase.c 1.31 2007/06/09 10:07:46 kls Exp $
+ * $Id: osdbase.c 1.32 2008/02/17 11:33:04 kls Exp $
*/
#include "osdbase.h"
@@ -236,6 +236,7 @@ void cOsdMenu::Display(void)
i++;
}
}
+ displayMenu->SetScrollbar(count, first);
if (!isempty(status))
displayMenu->SetMessage(mtStatus, status);
}
diff --git a/skinclassic.c b/skinclassic.c
index 877ef60d..535e63d2 100644
--- a/skinclassic.c
+++ b/skinclassic.c
@@ -4,7 +4,7 @@
* See the main source file 'vdr.c' for copyright information and
* how to reach the author.
*
- * $Id: skinclassic.c 1.21 2008/02/10 16:18:25 kls Exp $
+ * $Id: skinclassic.c 1.22 2008/02/17 12:24:15 kls Exp $
*/
#include "skinclassic.h"
@@ -164,12 +164,13 @@ void cSkinClassicDisplayChannel::Flush(void)
class cSkinClassicDisplayMenu : public cSkinDisplayMenu {
private:
cOsd *osd;
- int x0, x1;
+ int x0, x1, x2, x3;
int y0, y1, y2, y3, y4, y5;
int lineHeight;
int dateWidth;
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:
cSkinClassicDisplayMenu(void);
virtual ~cSkinClassicDisplayMenu();
@@ -180,6 +181,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);
@@ -194,7 +196,9 @@ cSkinClassicDisplayMenu::cSkinClassicDisplayMenu(void)
lineHeight = font->Height();
dateWidth = 0;
x0 = 0;
- x1 = cOsd::OsdWidth();
+ x1 = x0 + 10;
+ x3 = cOsd::OsdWidth();
+ x2 = x3 - 2 * ScrollWidth;
y0 = 0;
y1 = lineHeight;
y2 = y1 + lineHeight;
@@ -202,22 +206,22 @@ cSkinClassicDisplayMenu::cSkinClassicDisplayMenu(void)
y4 = y5 - lineHeight;
y3 = y4 - lineHeight;
osd = cOsdProvider::NewOsd(cOsd::OsdLeft(), cOsd::OsdTop());
- tArea Areas[] = { { x0, y0, x1 - 1, y5 - 1, 8 } };
+ tArea Areas[] = { { x0, y0, x3 - 1, y5 - 1, 8 } };
if (Setup.AntiAlias && osd->CanHandleAreas(Areas, sizeof(Areas) / sizeof(tArea)) == oeOk)
osd->SetAreas(Areas, sizeof(Areas) / sizeof(tArea));
else {
- tArea Areas[] = { { x0, y0, x1 - 1, y5 - 1, 4 } };
+ tArea Areas[] = { { x0, y0, x3 - 1, y5 - 1, 4 } };
if (osd->CanHandleAreas(Areas, sizeof(Areas) / sizeof(tArea)) == oeOk)
osd->SetAreas(Areas, sizeof(Areas) / sizeof(tArea));
else {
- tArea Areas[] = { { x0, y0, x1 - 1, y1 - 1, 2 },
- { x0, y1, x1 - 1, y3 - 1, 2 },
- { x0, y3, x1 - 1, y5 - 1, 4 }
+ tArea Areas[] = { { x0, y0, x3 - 1, y1 - 1, 2 },
+ { x0, y1, x3 - 1, y3 - 1, 2 },
+ { x0, y3, x3 - 1, y5 - 1, 4 }
};
osd->SetAreas(Areas, sizeof(Areas) / sizeof(tArea));
}
}
- osd->DrawRectangle(x0, y0, x1 - 1, y5 - 1, Theme.Color(clrBackground));
+ osd->DrawRectangle(x0, y0, x3 - 1, y5 - 1, Theme.Color(clrBackground));
}
cSkinClassicDisplayMenu::~cSkinClassicDisplayMenu()
@@ -225,25 +229,31 @@ cSkinClassicDisplayMenu::~cSkinClassicDisplayMenu()
delete osd;
}
-void cSkinClassicDisplayMenu::SetScrollbar(void)
+void cSkinClassicDisplayMenu::DrawScrollbar(int Total, int Offset, int Shown, int Top, int Height, bool CanScrollUp, bool CanScrollDown)
{
- if (textScroller.CanScroll()) {
- int yt = textScroller.Top();
- int yb = yt + textScroller.Height();
+ if (Total > 0 && Total > Shown) {
+ int yt = Top;
+ int yb = yt + Height;
int st = yt;
int sb = yb;
- int tt = st + (sb - st) * textScroller.Offset() / textScroller.Total();
- int tb = tt + (sb - st) * textScroller.Shown() / textScroller.Total();
- int xl = x1 - ScrollWidth;
- osd->DrawRectangle(xl, st, x1 - 1, sb, Theme.Color(clrMenuScrollbarTotal));
- osd->DrawRectangle(xl, tt, x1 - 1, tb, Theme.Color(clrMenuScrollbarShown));
+ int tt = st + (sb - st) * Offset / Total;
+ int tb = tt + (sb - st) * Shown / Total;
+ int xl = x3 - ScrollWidth;
+ osd->DrawRectangle(xl, st, x3 - 1, sb, Theme.Color(clrMenuScrollbarTotal));
+ osd->DrawRectangle(xl, tt, x3 - 1, tb, Theme.Color(clrMenuScrollbarShown));
}
}
+void cSkinClassicDisplayMenu::SetTextScrollbar(void)
+{
+ if (textScroller.CanScroll())
+ DrawScrollbar(textScroller.Total(), textScroller.Offset(), textScroller.Shown(), textScroller.Top(), textScroller.Height(), textScroller.CanScrollUp(), textScroller.CanScrollDown());
+}
+
void cSkinClassicDisplayMenu::Scroll(bool Up, bool Page)
{
cSkinDisplayMenu::Scroll(Up, Page);
- SetScrollbar();
+ SetTextScrollbar();
}
int cSkinClassicDisplayMenu::MaxItems(void)
@@ -254,24 +264,24 @@ int cSkinClassicDisplayMenu::MaxItems(void)
void cSkinClassicDisplayMenu::Clear(void)
{
textScroller.Reset();
- osd->DrawRectangle(x0, y1, x1 - 1, y4 - 1, Theme.Color(clrBackground));
+ osd->DrawRectangle(x0, y1, x3 - 1, y4 - 1, Theme.Color(clrBackground));
}
void cSkinClassicDisplayMenu::SetTitle(const char *Title)
{
const cFont *font = cFont::GetFont(fontOsd);
- osd->DrawText(x0, y0, Title, Theme.Color(clrMenuTitleFg), Theme.Color(clrMenuTitleBg), font, x1 - x0 - dateWidth);
+ osd->DrawText(x0, y0, Title, Theme.Color(clrMenuTitleFg), Theme.Color(clrMenuTitleBg), font, x3 - x0 - dateWidth);
}
void cSkinClassicDisplayMenu::SetButtons(const char *Red, const char *Green, const char *Yellow, const char *Blue)
{
const cFont *font = cFont::GetFont(fontOsd);
- int w = x1 - x0;
+ int w = x3 - x0;
int t0 = x0;
int t1 = x0 + w / 4;
int t2 = x0 + w / 2;
- int t3 = x1 - w / 4;
- int t4 = x1;
+ int t3 = x3 - w / 4;
+ int t4 = x3;
osd->DrawText(t0, y4, Red, Theme.Color(clrButtonRedFg), Red ? Theme.Color(clrButtonRedBg) : Theme.Color(clrBackground), font, t1 - t0, 0, taCenter);
osd->DrawText(t1, y4, Green, Theme.Color(clrButtonGreenFg), Green ? Theme.Color(clrButtonGreenBg) : Theme.Color(clrBackground), font, t2 - t1, 0, taCenter);
osd->DrawText(t2, y4, Yellow, Theme.Color(clrButtonYellowFg), Yellow ? Theme.Color(clrButtonYellowBg) : Theme.Color(clrBackground), font, t3 - t2, 0, taCenter);
@@ -282,9 +292,9 @@ void cSkinClassicDisplayMenu::SetMessage(eMessageType Type, const char *Text)
{
const cFont *font = cFont::GetFont(fontOsd);
if (Text)
- osd->DrawText(x0, y3, Text, Theme.Color(clrMessageStatusFg + 2 * Type), Theme.Color(clrMessageStatusBg + 2 * Type), font, x1 - x0, 0, taCenter);
+ osd->DrawText(x0, y3, Text, Theme.Color(clrMessageStatusFg + 2 * Type), Theme.Color(clrMessageStatusBg + 2 * Type), font, x3 - x0, 0, taCenter);
else
- osd->DrawRectangle(x0, y3, x1 - 1, y4 - 1, Theme.Color(clrBackground));
+ osd->DrawRectangle(x0, y3, x3 - 1, y4 - 1, Theme.Color(clrBackground));
}
void cSkinClassicDisplayMenu::SetItem(const char *Text, int Index, bool Current, bool Selectable)
@@ -304,44 +314,47 @@ void cSkinClassicDisplayMenu::SetItem(const char *Text, int Index, bool Current,
const char *s = GetTabbedText(Text, i);
if (s) {
int xt = x0 + Tab(i);
- osd->DrawText(xt, y, s, ColorFg, ColorBg, font, x1 - xt);
+ osd->DrawText(xt, y, s, ColorFg, ColorBg, font, x2 - xt);
}
if (!Tab(i + 1))
break;
}
- SetEditableWidth(x1 - x0 - Tab(1));
+ SetEditableWidth(x2 - x0 - Tab(1));
}
+void cSkinClassicDisplayMenu::SetScrollbar(int Total, int Offset)
+{
+ DrawScrollbar(Total, Offset, MaxItems(), y2, MaxItems() * lineHeight, Offset > 0, Offset + MaxItems() < Total);
+}
void cSkinClassicDisplayMenu::SetEvent(const cEvent *Event)
{
if (!Event)
return;
const cFont *font = cFont::GetFont(fontOsd);
- int xl = x0 + 10;
int y = y2;
cTextScroller ts;
char t[32];
snprintf(t, sizeof(t), "%s %s - %s", *Event->GetDateString(), *Event->GetTimeString(), *Event->GetEndTimeString());
- ts.Set(osd, xl, y, x1 - xl, y3 - y, t, font, Theme.Color(clrMenuEventTime), Theme.Color(clrBackground));
+ ts.Set(osd, x1, y, x2 - x1, y3 - y, t, font, Theme.Color(clrMenuEventTime), Theme.Color(clrBackground));
if (Event->Vps() && Event->Vps() != Event->StartTime()) {
cString buffer = cString::sprintf(" VPS: %s ", *Event->GetVpsString());
const cFont *font = cFont::GetFont(fontSml);
int w = font->Width(buffer);
- osd->DrawText(x1 - w, y, buffer, Theme.Color(clrMenuEventVpsFg), Theme.Color(clrMenuEventVpsBg), font, w);
+ osd->DrawText(x3 - w, y, buffer, Theme.Color(clrMenuEventVpsFg), Theme.Color(clrMenuEventVpsBg), font, w);
}
y += ts.Height();
y += font->Height();
- ts.Set(osd, xl, y, x1 - xl, y3 - y, Event->Title(), font, Theme.Color(clrMenuEventTitle), Theme.Color(clrBackground));
+ ts.Set(osd, x1, y, x2 - x1, y3 - y, Event->Title(), font, Theme.Color(clrMenuEventTitle), Theme.Color(clrBackground));
y += ts.Height();
if (!isempty(Event->ShortText())) {
const cFont *font = cFont::GetFont(fontSml);
- ts.Set(osd, xl, y, x1 - xl, y3 - y, Event->ShortText(), font, Theme.Color(clrMenuEventShortText), Theme.Color(clrBackground));
+ ts.Set(osd, x1, y, x2 - x1, y3 - y, Event->ShortText(), font, Theme.Color(clrMenuEventShortText), Theme.Color(clrBackground));
y += ts.Height();
}
y += font->Height();
if (!isempty(Event->Description())) {
- textScroller.Set(osd, xl, y, x1 - xl - 2 * ScrollWidth, y3 - y, Event->Description(), font, Theme.Color(clrMenuEventDescription), Theme.Color(clrBackground));
- SetScrollbar();
+ textScroller.Set(osd, x1, y, x2 - x1, y3 - y, Event->Description(), font, Theme.Color(clrMenuEventDescription), Theme.Color(clrBackground));
+ SetTextScrollbar();
}
}
@@ -351,40 +364,39 @@ void cSkinClassicDisplayMenu::SetRecording(const cRecording *Recording)
return;
const cRecordingInfo *Info = Recording->Info();
const cFont *font = cFont::GetFont(fontOsd);
- int xl = x0 + 10;
int y = y2;
cTextScroller ts;
char t[32];
snprintf(t, sizeof(t), "%s %s", *DateString(Recording->start), *TimeString(Recording->start));
- ts.Set(osd, xl, y, x1 - xl, y3 - y, t, font, Theme.Color(clrMenuEventTime), Theme.Color(clrBackground));
+ ts.Set(osd, x1, y, x2 - x1, y3 - y, t, font, Theme.Color(clrMenuEventTime), Theme.Color(clrBackground));
y += ts.Height();
y += font->Height();
const char *Title = Info->Title();
if (isempty(Title))
Title = Recording->Name();
- ts.Set(osd, xl, y, x1 - xl, y3 - y, Title, font, Theme.Color(clrMenuEventTitle), Theme.Color(clrBackground));
+ ts.Set(osd, x1, y, x2 - x1, y3 - y, Title, font, Theme.Color(clrMenuEventTitle), Theme.Color(clrBackground));
y += ts.Height();
if (!isempty(Info->ShortText())) {
const cFont *font = cFont::GetFont(fontSml);
- ts.Set(osd, xl, y, x1 - xl, y3 - y, Info->ShortText(), font, Theme.Color(clrMenuEventShortText), Theme.Color(clrBackground));
+ ts.Set(osd, x1, y, x2 - x1, y3 - y, Info->ShortText(), font, Theme.Color(clrMenuEventShortText), Theme.Color(clrBackground));
y += ts.Height();
}
y += font->Height();
if (!isempty(Info->Description())) {
- textScroller.Set(osd, xl, y, x1 - xl - 2 * ScrollWidth, y3 - y, Info->Description(), font, Theme.Color(clrMenuEventDescription), Theme.Color(clrBackground));
- SetScrollbar();
+ textScroller.Set(osd, x1, y, x2 - x1, y3 - y, Info->Description(), font, Theme.Color(clrMenuEventDescription), Theme.Color(clrBackground));
+ SetTextScrollbar();
}
}
void cSkinClassicDisplayMenu::SetText(const char *Text, bool FixedFont)
{
- textScroller.Set(osd, x0, y2, GetTextAreaWidth(), y3 - y2, Text, GetTextAreaFont(FixedFont), Theme.Color(clrMenuText), Theme.Color(clrBackground));
- SetScrollbar();
+ textScroller.Set(osd, x1, y2, GetTextAreaWidth(), y3 - y2, Text, GetTextAreaFont(FixedFont), Theme.Color(clrMenuText), Theme.Color(clrBackground));
+ SetTextScrollbar();
}
int cSkinClassicDisplayMenu::GetTextAreaWidth(void) const
{
- return x1 - x0 - 2 * ScrollWidth;
+return x2 - x1;
}
const cFont *cSkinClassicDisplayMenu::GetTextAreaFont(bool FixedFont) const
@@ -398,7 +410,7 @@ void cSkinClassicDisplayMenu::Flush(void)
if (!lastDate || strcmp(date, lastDate)) {
const cFont *font = cFont::GetFont(fontOsd);
int w = font->Width(date);
- osd->DrawText(x1 - w - 2, y0, date, Theme.Color(clrMenuDate), Theme.Color(clrMenuTitleBg), font, w);
+ osd->DrawText(x3 - w - 2, y0, date, Theme.Color(clrMenuDate), Theme.Color(clrMenuTitleBg), font, w);
lastDate = date;
dateWidth = max(w + 2, dateWidth);
}
diff --git a/skins.c b/skins.c
index f442e5ad..46a858cf 100644
--- a/skins.c
+++ b/skins.c
@@ -4,7 +4,7 @@
* See the main source file 'vdr.c' for copyright information and
* how to reach the author.
*
- * $Id: skins.c 1.13 2007/01/04 13:08:55 kls Exp $
+ * $Id: skins.c 1.14 2008/02/17 11:31:09 kls Exp $
*/
#include "skins.h"
@@ -108,6 +108,10 @@ const char *cSkinDisplayMenu::GetTabbedText(const char *s, int Tab)
return buffer;
}
+void cSkinDisplayMenu::SetScrollbar(int Total, int Offset)
+{
+}
+
int cSkinDisplayMenu::GetTextAreaWidth(void) const
{
return 0;
diff --git a/skins.h b/skins.h
index a0f03880..9e83c0ca 100644
--- a/skins.h
+++ b/skins.h
@@ -4,7 +4,7 @@
* See the main source file 'vdr.c' for copyright information and
* how to reach the author.
*
- * $Id: skins.h 1.15 2007/01/04 13:08:55 kls Exp $
+ * $Id: skins.h 1.16 2008/02/17 11:30:56 kls Exp $
*/
#ifndef __SKINS_H
@@ -144,6 +144,11 @@ public:
virtual void SetItem(const cRecording *Recording, int Index, bool Current, bool Selectable);
--> false: call SetItem(text)
*/
+ virtual void SetScrollbar(int Total, int Offset);
+ ///< Sets the Total number of items in the currently displayed list, and the
+ ///< Offset of the first item that is currently displayed (the skin knows how
+ ///< many items it can display at once, see MaxItems()). This can be used to
+ ///< display a scollbar.
virtual void SetEvent(const cEvent *Event) = 0;
///< Sets the Event that shall be displayed, using the entire central area
///< of the menu. The Event's 'description' shall be displayed using a
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