FireBirdLib - Topfield TMS PVR TAP Programming Library
OSDDrawScrollBar.c
Go to the documentation of this file.
1#include "FBLib_TMSOSDMenu.h"
2
4{
6
7 tMenu *pMenu;
8 word extralines = 0, cutY;
9 int n, l, Y;
10
11 pMenu = &Menu[CurrentMenuLevel];
12
14 {
15 switch (pMenu->NrLines)
16 {
17 case 18:
18 extralines = 8;
19 break;
20
21 case 15:
22 extralines = 5;
23 break;
24 }
25 }
26
27 cutY = 96 + _ScrollBarVisible_Gd.height - 16; // same for ScrollBarInvisible
28
29 if(pMenu->NrItems < pMenu->NrLines + 1)
30 {
31 TAP_Osd_PutGd(OSDRgn, pMenu->XPos + pMenu->Width + 1, 96, &_ScrollBarInvisible_Gd, FALSE);
32
33 if (extralines) TAP_Osd_Copy(OSDRgn, OSDRgn, pMenu->XPos + pMenu->Width + 1, cutY, _ScrollBarInvisible_Gd.width, 16, pMenu->XPos + pMenu->Width + 1, cutY + extralines, FALSE);
34 }
35 else
36 {
37 TAP_Osd_PutGd(OSDRgn, pMenu->XPos + pMenu->Width + 1, 96, &_ScrollBarVisible_Gd, FALSE);
38
39 if (extralines) TAP_Osd_Copy(OSDRgn, OSDRgn, pMenu->XPos + pMenu->Width + 1, cutY, _ScrollBarVisible_Gd.width, 16, pMenu->XPos + pMenu->Width + 1, cutY + extralines, FALSE);
40
41 n = (pMenu->OSDMenuDisplayMode == OMDM_Text ? pMenu->NrLines : 1);
42 l = _ScrollBarVisible_Gd.height + extralines - 2 * 12 - _ScrollBarKnob_Gd.height;
43 Y = 96 + 12 + (pMenu->CurrentSelection * l) / (pMenu->NrItems - n);
44
45 TAP_Osd_PutGd(OSDRgn, pMenu->XPos + pMenu->Width + 2, Y, &_ScrollBarKnob_Gd, FALSE);
46 }
47
48 TRACEEXIT();
49}
TYPE_GrData _ScrollBarInvisible_Gd
tMenu Menu[NRMENULEVELS]
Definition: OSDMenuInit.c:6
@ OMDM_Text
@ OMDM_Standard
@ OMDM_ListBox
TYPE_GrData _ScrollBarKnob_Gd
dword CurrentMenuLevel
Definition: OSDMenuInit.c:7
TYPE_GrData _ScrollBarVisible_Gd
word OSDRgn
Definition: OSDMenuInit.c:4
void OSDDrawScrollBar(void)
#define TRACEEXIT()
Definition: libFireBird.h:1244
@ Y
Definition: libFireBird.h:291
#define TRACEENTER()
Definition: libFireBird.h:1243
int CurrentSelection
dword XPos
dword Width
tOSDMenuDisplayMode OSDMenuDisplayMode