FireBirdLib - Topfield TMS PVR TAP Programming Library
OSDMenuFindNextSelectableEntry.c
Go to the documentation of this file.
1#include "FBLib_TMSOSDMenu.h"
2
3int OSDMenuFindNextSelectableEntry(int CurrentSelection)
4{
6
7 tMenu *pMenu;
8 int i, Cnt;
9
10 pMenu = &Menu[CurrentMenuLevel];
11
12 if((CurrentSelection >= (pMenu->NrItems - 1)) && !pMenu->ScrollLoop)
13 {
14 TRACEEXIT();
15 return CurrentSelection;
16 }
17
18 //Count the number of selectable items
19 Cnt = 0;
20 for(i = 0; i < pMenu->NrItems; i++)
21 {
22 if(pMenu->Item[i].Selectable) Cnt++;
23 }
24 if(Cnt == 0)
25 {
26 TRACEEXIT();
27 return -1;
28 }
29
30 do
31 {
32 CurrentSelection++;
33 if(CurrentSelection >= pMenu->NrItems)
34 {
35 if(pMenu->ScrollLoop)
36 CurrentSelection = 0;
37 else
38 {
39 TRACEEXIT();
40 return -1;
41 }
42 }
43 } while(!pMenu->Item[CurrentSelection].Selectable);
44
45 TRACEEXIT();
46 return CurrentSelection;
47}
tMenu Menu[NRMENULEVELS]
Definition: OSDMenuInit.c:6
dword CurrentMenuLevel
Definition: OSDMenuInit.c:7
int OSDMenuFindNextSelectableEntry(int CurrentSelection)
#define TRACEEXIT()
Definition: libFireBird.h:1244
#define TRACEENTER()
Definition: libFireBird.h:1243
bool Selectable
tItem * Item
bool ScrollLoop