diff --git a/GNUmakefile b/GNUmakefile index 66553419..80b22ba7 100644 --- a/GNUmakefile +++ b/GNUmakefile @@ -19,7 +19,6 @@ endif CFILES = \ box.c \ - menu.c \ test.c HFILES = \ ui.h \ diff --git a/menu.c b/menu.c deleted file mode 100644 index dfe636d7..00000000 --- a/menu.c +++ /dev/null @@ -1,19 +0,0 @@ -// 20 april 2015 -#include "uipriv.h" - -#if 0 -TODO - -// dummy items for various predefined menu identifiers -// these are so we can get a definite unique pointer value -static volatile char dummyQuit = 'q'; -static volatile char dummyPreferences = 'p'; -static volatile char dummyAbout = 'a'; -static volatile char dummySeparator = 's'; - -const char *const uiMenuItemQuit = &dummyQuit; -const char *const uiMenuItemPreferences = &dummyPreferences; -const char *const uiMenuItemAbout = &dummyAbout; -const char *const uiMenuItemSeparator = &dummySeparator; - -#endif diff --git a/test.c b/test.c index 0358f6e3..50dbdf28 100644 --- a/test.c +++ b/test.c @@ -6,26 +6,26 @@ // TODO convert to using the new conversion macros // TODO why can't these be const? -static uiMenuItem fileMenu[] = { - { "New", uiMenuItemTypeCommand }, - { "Open", uiMenuItemTypeCommand }, - { uiMenuItemQuit, uiMenuItemTypeCommand }, - { NULL, 0 }, +static const uiMenuItem fileMenu[] = { + { uiMenuItemTypeCommand, "New" }, + { uiMenuItemTypeCommand, "Open" }, + { uiMenuItemTypeQuit, NULL }, + { 0, NULL }, }; -static uiMenuItem editMenu[] = { - { "Undo", uiMenuItemTypeCommand }, - { uiMenuItemSeparator, uiMenuItemTypeSeparator }, - { "Check Me", uiMenuItemTypeCheckbox }, - { "A&ccelerator T_est", uiMenuItemTypeCommand }, - { uiMenuItemPreferences, uiMenuItemTypeCommand }, - { NULL, 0 }, +static const uiMenuItem editMenu[] = { + { uiMenuItemTypeCommand, "Undo" }, + { uiMenuItemTypeSeparator, NULL }, + { uiMenuItemTypeCheckbox, "Check Me" }, + { uiMenuItemTypeCommand, "A&ccelerator T_est" }, + { uiMenuItemTypePreferences, NULL }, + { 0, NULL }, }; -static uiMenuItem helpMenu[] = { - { "Help", uiMenuItemTypeCommand }, - { uiMenuItemAbout, uiMenuItemTypeCommand }, - { NULL, 0 }, +static const uiMenuItem helpMenu[] = { + { uiMenuItemTypeCommand, "Help" }, + { uiMenuItemTypeAbout, NULL }, + { 0, NULL }, }; static uiMenu menu[] = { diff --git a/ui.idl b/ui.idl index 737ce9e2..0a6b0769 100644 --- a/ui.idl +++ b/ui.idl @@ -143,28 +143,20 @@ struct Menu { }; struct MenuItem { - field Name *const char; field Type MenuItemType; + field Name *const char; }; enum MenuItemType { + End, // Name must be NULL; specicfy this as 0 Command, Checkbox, - Separator, + Quit, // Name must be NULL + Preferences, // Name must be NULL + About, // Name must be NULL + Separator, // Name must be NULL }; -// TODO allow these to be specified directly in the IDL -/* TODO -raw "extern const char *const uiMenuItemQuit;"; -raw "extern const char *const uiMenuItemPreferences;"; -raw "extern const char *const uiMenuItemAbout;"; -raw "extern const char *const uiMenuItemSeparator;"; -*/ -raw "#define uiMenuItemQuit ((char *)1)"; -raw "#define uiMenuItemPreferences ((char *)2)"; -raw "#define uiMenuItemAbout ((char *)3)"; -raw "#define uiMenuItemSeparator ((char *)4)"; - raw "#endif"; };