Defined an interface for menus.
This commit is contained in:
parent
845104a1a1
commit
fbe806a348
8
menu.c
8
menu.c
|
@ -6,7 +6,9 @@
|
|||
static volatile char dummyQuit = 'q';
|
||||
static volatile char dummyPreferences = 'p';
|
||||
static volatile char dummyAbout = 'a';
|
||||
static volatile char dummySeparator = 's';
|
||||
|
||||
const char *const uiMenuQuitItem = &dummyQuit;
|
||||
const char *const uiMenuPreferencesItem = &dummyPreferences;
|
||||
const char *const uiMenuAboutItem = &dummyAbout;
|
||||
const char *const uiMenuItemQuit = &dummyQuit;
|
||||
const char *const uiMenuItemPreferences = &dummyPreferences;
|
||||
const char *const uiMenuItemAbout = &dummyAbout;
|
||||
const char *const uiMenuItemSeparator = &dummySeparator;
|
||||
|
|
31
ui.idl
31
ui.idl
|
@ -20,6 +20,13 @@ struct InitOptions {
|
|||
// If nonzero, allocations will be logged to stderr.
|
||||
// See leaks.awk.
|
||||
field debugLogAllocations int;
|
||||
|
||||
// This is the menu that the application will use.
|
||||
// To give this menu to a uiWindow, specify nonzero for the hasMenu parameter to uiNewWindow().
|
||||
// This value, nor any element of the array it points to, should never change during execution of the program.
|
||||
// TODO make it a proper const *const
|
||||
// TODO idl2h doesn't support making this even const * yet...
|
||||
field Menu *Menu;
|
||||
};
|
||||
|
||||
// TODO const char
|
||||
|
@ -128,6 +135,30 @@ interface Tab from Control {
|
|||
};
|
||||
func NewTab(void) *Tab;
|
||||
|
||||
struct Menu {
|
||||
field Name *const char;
|
||||
// TODO make a proper const *const
|
||||
// TODO idl2h doesn't support making this even const * yet...
|
||||
field Items *MenuItem;
|
||||
};
|
||||
|
||||
struct MenuItem {
|
||||
field Name *const char;
|
||||
field Type MenuItemType;
|
||||
};
|
||||
|
||||
enum MenuItemType {
|
||||
Command,
|
||||
Checkbox,
|
||||
Separator,
|
||||
};
|
||||
|
||||
// TODO allow these to be specified directly in the IDL
|
||||
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 "#endif";
|
||||
|
||||
};
|
||||
|
|
Loading…
Reference in New Issue