6 #ifndef LWPP_CONTEXMENU_H
7 #define LWPP_CONTEXMENU_H
26 LWPanPopupDesc description;
40 ContextMenu(
int width,
size_t (*countFn)(
void *),
char *(*nameFn)(
void *,
int),
void *userdata)
43 Create(width, countFn, nameFn, userdata);
54 if (menu)
globPtr->cmenuDestroy(menu);
55 menu =
globPtr->cmenuCreate(&description, userdata);
58 void Create(
int width,
size_t (*countFn)(
void *),
char *(*nameFn)(
void *,
int),
void *userdata)
62 if (menu)
globPtr->cmenuDestroy(menu);
63 description.type = LWT_POPUP;
64 description.width = width;
65 description.countFn = (int (*)(
void *))countFn;
66 description.nameFn = nameFn;
67 menu =
globPtr->cmenuCreate(&description, userdata);
76 int Deploy(LWPanelID panel,
int select)
83 dout <<
"Deploy Context Menu: 0x" << menu <<
"\n";
84 dout <<
" Panel: 0x" << panel <<
"\n";
85 dout <<
" Global: 0x" <<
globPtr <<
"\n";
86 dout <<
" Function: 0x" << globPtr->cmenuDeploy <<
"\n";
89 return globPtr->cmenuDeploy( menu, panel, select);
105 const char **entries;
106 virtual size_t count(
void)
110 virtual const char *name(
int n)
117 while (_entries[num_entries]) num_entries++;
122 return menu.
Deploy(panel, select);
137 menuEntry(
const char *_title,
unsigned int _id) :
name(_title), id(_id) {}
138 menuEntry(std::string _title,
unsigned int _id) :
name(_title), id(_id) {}
139 const char *getName(
void)
const {
return name.c_str();}
140 const int getID(
void)
const {
return id;}
143 std::vector<menuEntry> Entries;
147 const char *
name(
int n);
150 int Deploy(LWPanelID panel,
int select);
153 void AddEntry (
const char *entry,
unsigned int id);
154 void AddEntry (std::string entry,
unsigned int id);
157 #endif // LWPP_CONTEXMENU_H