Started to lay down the foundation for events. More thorough accelerator string testing.

This commit is contained in:
Pietro Gagliardi 2015-04-21 18:58:29 -04:00
parent ac8e59c004
commit cdbd31c554
2 changed files with 20 additions and 13 deletions

31
test.c
View File

@ -6,26 +6,31 @@
// TODO convert to using the new conversion macros // TODO convert to using the new conversion macros
// TODO why can't these be const? // TODO why can't these be const?
void noopMenu(void *source, void *data)
{
// do nothing
}
static const uiMenuItem fileMenu[] = { static const uiMenuItem fileMenu[] = {
{ uiMenuItemTypeCommand, "New" }, { uiMenuItemTypeCommand, "New", noopMenu, NULL },
{ uiMenuItemTypeCommand, "Open" }, { uiMenuItemTypeCommand, "Open", noopMenu, NULL },
{ uiMenuItemTypeQuit, NULL }, { uiMenuItemTypeQuit, NULL, noopMenu, NULL },
{ 0, NULL }, { 0, NULL, NULL, NULL },
}; };
static const uiMenuItem editMenu[] = { static const uiMenuItem editMenu[] = {
{ uiMenuItemTypeCommand, "Undo" }, { uiMenuItemTypeCommand, "Undo", noopMenu, NULL },
{ uiMenuItemTypeSeparator, NULL }, { uiMenuItemTypeSeparator, NULL, NULL, NULL },
{ uiMenuItemTypeCheckbox, "Check Me" }, { uiMenuItemTypeCheckbox, "Check Me", noopMenu, NULL },
{ uiMenuItemTypeCommand, "A&ccelerator T_est" }, { uiMenuItemTypeCommand, "A&ccelerator T_est\tTest", noopMenu, NULL },
{ uiMenuItemTypePreferences, NULL }, { uiMenuItemTypePreferences, NULL, noopMenu, NULL },
{ 0, NULL }, { 0, NULL, NULL, NULL },
}; };
static const uiMenuItem helpMenu[] = { static const uiMenuItem helpMenu[] = {
{ uiMenuItemTypeCommand, "Help" }, { uiMenuItemTypeCommand, "Help", noopMenu, NULL },
{ uiMenuItemTypeAbout, NULL }, { uiMenuItemTypeAbout, NULL, noopMenu, NULL },
{ 0, NULL }, { 0, NULL, NULL, NULL },
}; };
static uiMenu menu[] = { static uiMenu menu[] = {

2
ui.idl
View File

@ -145,6 +145,8 @@ struct Menu {
struct MenuItem { struct MenuItem {
field Type MenuItemType; field Type MenuItemType;
field Name *const char; field Name *const char;
field OnClicked *func(sender *void, data *void);
field OnClickedData *void;
}; };
enum MenuItemType { enum MenuItemType {