Added a test for uiOnShouldQuit().
This commit is contained in:
parent
8032c24f74
commit
4e9fa46aec
|
@ -20,6 +20,12 @@ int onClosing(uiWindow *w, void *data)
|
|||
return 1;
|
||||
}
|
||||
|
||||
int onShouldQuit(void *data)
|
||||
{
|
||||
printf("in onShouldQuit()\n");
|
||||
return uiMenuItemChecked(shouldQuitItem);
|
||||
}
|
||||
|
||||
uiBox *mainBox;
|
||||
uiTab *mainTab;
|
||||
|
||||
|
@ -51,6 +57,8 @@ int main(int argc, char *argv[])
|
|||
if (!nomenus)
|
||||
initMenus();
|
||||
|
||||
uiOnShouldQuit(onShouldQuit, NULL);
|
||||
|
||||
w = newWindow("Main Window", 320, 240, 1);
|
||||
uiWindowOnClosing(w, onClosing, NULL);
|
||||
printf("main window %p\n", w);
|
||||
|
|
|
@ -4,6 +4,7 @@
|
|||
uiMenu *fileMenu;
|
||||
uiMenuItem *newItem;
|
||||
uiMenuItem *openItem;
|
||||
uiMenuItem *shouldQuitItem;
|
||||
uiMenuItem *quitItem;
|
||||
uiMenu *editMenu;
|
||||
uiMenuItem *undoItem;
|
||||
|
@ -53,6 +54,8 @@ void initMenus(void)
|
|||
fileMenu = uiNewMenu("File");
|
||||
newItem = uiMenuAppendItem(fileMenu, "New");
|
||||
openItem = uiMenuAppendItem(fileMenu, "Open");
|
||||
uiMenuAppendSeparator(fileMenu);
|
||||
shouldQuitItem = uiMenuAppendCheckItem(fileMenu, "Should Quit");
|
||||
quitItem = uiMenuAppendQuitItem(fileMenu);
|
||||
|
||||
editMenu = uiNewMenu("Edit");
|
||||
|
|
|
@ -20,6 +20,7 @@ extern uiBox *newVerticalBox(void);
|
|||
extern uiTab *newTab(void);
|
||||
|
||||
// menus.c
|
||||
extern uiMenuItem *shouldQuitItem;
|
||||
extern void initMenus(void);
|
||||
|
||||
// page1.c
|
||||
|
|
Loading…
Reference in New Issue