diff options
author | Andreas Brugger <brougs78@gmx.net> | 2006-02-04 18:25:22 +0100 |
---|---|---|
committer | Thomas Günther <tom@toms-cafe.de> | 2009-06-03 03:08:32 +0200 |
commit | 8d32cf88bbe5b69a2710029cdaa896470a0fe20c (patch) | |
tree | 8a5cbc0e00440ff6a85181e1ffadf4576fa7d343 /render.c | |
parent | c1bf83aec2961a4e84dbc1c36042bd985f044a91 (diff) | |
download | vdr-plugin-text2skin-8d32cf88bbe5b69a2710029cdaa896470a0fe20c.tar.gz vdr-plugin-text2skin-8d32cf88bbe5b69a2710029cdaa896470a0fe20c.tar.bz2 |
2006-02-04: Version 1.1-cvs_ext-0.8 (vdr-text2skin-1.1-cvs_ext-0.8.diff)
- added a configuration option for showing the scrollbar in the menus and
finished implementation
Diffstat (limited to 'render.c')
-rw-r--r-- | render.c | 41 |
1 files changed, 37 insertions, 4 deletions
@@ -11,7 +11,6 @@ #include "screen.h" #include "display.h" #include "scroller.h" -#include "setup.h" #include "xml/display.h" #include <vdr/channels.h> #include <vdr/epg.h> @@ -222,7 +221,8 @@ void cText2SkinRender::DrawObject(const cxObject *Object) uint itemheight = item->Size().h; uint maxitems = areasize.h / itemheight; uint yoffset = 0; - + + mMenuScrollbar.maxItems = maxitems; SetMaxItems(maxitems); //Dprintf("setmaxitems %d\n", maxitems); for (uint i = 0; i < maxitems; ++i, yoffset += itemheight) { for (uint j = 1; j < Object->Objects(); ++j) { @@ -564,6 +564,29 @@ void cText2SkinRender::DrawScrollbar(const txPoint &Pos, const txSize &Size, con DrawRectangle(sp, ss, Fg); } } + else if (mMenuScrollbar.Available()) + { + DrawRectangle(Pos, Size, Bg); + txPoint sbPoint = Pos; + txSize sbSize = Size; + if (sbSize.h > sbSize.w) + { + // -1 to get at least 1 pixel height + double top = double(mMenuScrollbar.Top()) / mMenuScrollbar.total * (sbSize.h - 1); + double bottom = double(mMenuScrollbar.Bottom()) / mMenuScrollbar.total * (sbSize.h - 1); + sbPoint.y += (uint)top; + sbSize.h -= (uint)top + (uint)bottom; + } + else + { + // -1 to get at least 1 pixel height + double left = double(mMenuScrollbar.Top()) / mMenuScrollbar.total * (sbSize.w - 1); + double right = double(mMenuScrollbar.Bottom()) / mMenuScrollbar.total * (sbSize.w - 1); + sbPoint.x += (uint)left; + sbSize.w -= (uint)left + (uint)right; + } + DrawRectangle(sbPoint, sbSize, Fg); + } } txPoint cText2SkinRender::Transform(const txPoint &Pos) @@ -675,9 +698,19 @@ cxType cText2SkinRender::GetTokenData(const txToken &Token) case tDateTime: return TimeType(time(NULL), Token.Attrib.Text); - case tCanScrollUp: return mScroller != NULL && mScroller->CanScrollUp(); + case tCanScrollUp: + { + if (mScroller) return mScroller->CanScrollUp(); + else if (mMenuScrollbar.Available()) return mMenuScrollbar.CanScrollUp(); + else return false; + } - case tCanScrollDown: return mScroller != NULL && mScroller->CanScrollDown(); + case tCanScrollDown: + { + if (mScroller) return mScroller->CanScrollDown(); + else if (mMenuScrollbar.Available()) return mMenuScrollbar.CanScrollDown(); + else return false; + } case tIsRecording: return cRecordControls::Active(); |