FireBirdLib - Topfield TMS PVR TAP Programming Library
OSDMenuItemAdd.c
Go to the documentation of this file.
1
#include <string.h>
2
#include <stdlib.h>
3
#include "
FBLib_TMSOSDMenu.h
"
4
5
bool
OSDMenuItemAdd
(
const
char
*Name,
const
char
*Value, TYPE_GrData *pNameIconGd, TYPE_GrData *pValueIconGd,
bool
Selectable,
bool
ValueArrows, dword ID)
6
{
7
TRACEENTER
();
8
9
tMenu
*pMenu;
10
int
NewNrItems;
11
tItem
*TempItem;
12
13
pMenu = &
Menu
[
CurrentMenuLevel
];
14
15
if
(pMenu->
NrItems
>= pMenu->
MaxItems
)
16
{
17
NewNrItems = pMenu->
MaxItems
+ 30;
18
TempItem = TAP_MemAlloc(NewNrItems *
sizeof
(
tItem
));
19
if
(!TempItem)
20
{
21
TRACEEXIT
();
22
return
FALSE;
23
}
24
25
memset(TempItem, 0, NewNrItems *
sizeof
(
tItem
));
26
memcpy(TempItem, pMenu->
Item
, pMenu->
NrItems
*
sizeof
(
tItem
));
27
TAP_MemFree(pMenu->
Item
);
28
pMenu->
Item
= TempItem;
29
pMenu->
MaxItems
= NewNrItems;
30
}
31
32
if
(!Name || !Name[0])
33
{
34
TRACEEXIT
();
35
return
FALSE;
36
}
37
38
strncpy(pMenu->
Item
[pMenu->
NrItems
].
Name
, Name,
ITEMNAMESIZE
);
39
pMenu->
Item
[pMenu->
NrItems
].
Name
[
ITEMNAMESIZE
- 1] =
'\0'
;
40
41
if
(Value && Value[0])
42
{
43
strncpy(pMenu->
Item
[pMenu->
NrItems
].
Value
, Value,
ITEMVALUESIZE
);
44
pMenu->
Item
[pMenu->
NrItems
].
Value
[
ITEMVALUESIZE
- 1] =
'\0'
;
45
}
46
else
47
pMenu->
Item
[pMenu->
NrItems
].
Value
[0] =
'\0'
;
48
49
pMenu->
Item
[pMenu->
NrItems
].
pNameIconGd
= pNameIconGd;
50
pMenu->
Item
[pMenu->
NrItems
].
pValueIconGd
= pValueIconGd;
51
pMenu->
Item
[pMenu->
NrItems
].
Selectable
= Selectable;
52
pMenu->
Item
[pMenu->
NrItems
].
ValueArrows
= ValueArrows;
53
pMenu->
Item
[pMenu->
NrItems
].
ID
= ID;
54
pMenu->
Item
[pMenu->
NrItems
].
ColorPatch
= 0;
55
pMenu->
Item
[pMenu->
NrItems
].
NameColor
= RGB(255, 255, 255);
56
pMenu->
Item
[pMenu->
NrItems
].
TextColor
= RGB(255, 255, 255);
57
pMenu->
Item
[pMenu->
NrItems
].
CustomIndex
= -1;
58
pMenu->
Item
[pMenu->
NrItems
].
drawName
= TRUE;
59
pMenu->
Item
[pMenu->
NrItems
].
drawValue
= TRUE;
60
61
if
(ValueArrows) pMenu->
hasValueArrows
= TRUE;
62
63
pMenu->
NrItems
++;
64
65
ListDirty
= TRUE;
66
67
TRACEEXIT
();
68
return
TRUE;
69
}
FBLib_TMSOSDMenu.h
ITEMNAMESIZE
#define ITEMNAMESIZE
Definition:
FBLib_TMSOSDMenu.h:6
Menu
tMenu Menu[NRMENULEVELS]
Definition:
OSDMenuInit.c:6
ITEMVALUESIZE
#define ITEMVALUESIZE
Definition:
FBLib_TMSOSDMenu.h:7
CurrentMenuLevel
dword CurrentMenuLevel
Definition:
OSDMenuInit.c:7
ListDirty
bool ListDirty
Definition:
FBLib_TMSOSDMenu.h:223
OSDMenuItemAdd
bool OSDMenuItemAdd(const char *Name, const char *Value, TYPE_GrData *pNameIconGd, TYPE_GrData *pValueIconGd, bool Selectable, bool ValueArrows, dword ID)
Definition:
OSDMenuItemAdd.c:5
TRACEEXIT
#define TRACEEXIT()
Definition:
libFireBird.h:1244
TRACEENTER
#define TRACEENTER()
Definition:
libFireBird.h:1243
tItem
Definition:
FBLib_TMSOSDMenu.h:32
tItem::TextColor
dword TextColor
Definition:
FBLib_TMSOSDMenu.h:39
tItem::ColorPatch
dword ColorPatch
Definition:
FBLib_TMSOSDMenu.h:37
tItem::drawValue
bool drawValue
Definition:
FBLib_TMSOSDMenu.h:44
tItem::Name
char Name[ITEMNAMESIZE]
Definition:
FBLib_TMSOSDMenu.h:33
tItem::Selectable
bool Selectable
Definition:
FBLib_TMSOSDMenu.h:40
tItem::pNameIconGd
TYPE_GrData * pNameIconGd
Definition:
FBLib_TMSOSDMenu.h:35
tItem::CustomIndex
int CustomIndex
Definition:
FBLib_TMSOSDMenu.h:46
tItem::ID
dword ID
Definition:
FBLib_TMSOSDMenu.h:45
tItem::drawName
bool drawName
Definition:
FBLib_TMSOSDMenu.h:43
tItem::Value
char Value[ITEMVALUESIZE]
Definition:
FBLib_TMSOSDMenu.h:34
tItem::pValueIconGd
TYPE_GrData * pValueIconGd
Definition:
FBLib_TMSOSDMenu.h:36
tItem::NameColor
dword NameColor
Definition:
FBLib_TMSOSDMenu.h:38
tItem::ValueArrows
bool ValueArrows
Definition:
FBLib_TMSOSDMenu.h:41
tMenu
Definition:
FBLib_TMSOSDMenu.h:67
tMenu::Item
tItem * Item
Definition:
FBLib_TMSOSDMenu.h:71
tMenu::hasValueArrows
bool hasValueArrows
Definition:
FBLib_TMSOSDMenu.h:82
tMenu::MaxItems
int MaxItems
Definition:
FBLib_TMSOSDMenu.h:73
tMenu::NrItems
int NrItems
Definition:
FBLib_TMSOSDMenu.h:72
TMSOSDMenu
OSDMenuItemAdd.c
Generated on Fri Apr 29 2022 13:34:01 for FireBirdLib - Topfield TMS PVR TAP Programming Library by
1.9.3