Implemented uiMenu window identification in the test program. It works on all platforms.

This commit is contained in:
Pietro Gagliardi 2015-05-03 21:22:00 -04:00
parent d25c954d9f
commit 9e6678b635
2 changed files with 10 additions and 0 deletions

View File

@ -53,6 +53,7 @@ int main(int argc, char *argv[])
w = newWindow("Main Window", 320, 240, 1);
uiWindowOnClosing(w, onClosing, NULL);
printf("main window %p\n", w);
mainBox = newHorizontalBox();
uiWindowSetChild(w, uiControl(mainBox));

View File

@ -15,6 +15,7 @@ uiMenuItem *enabledItem;
uiMenuItem *enableThisItem;
uiMenuItem *forceCheckedItem;
uiMenuItem *forceUncheckedItem;
uiMenuItem *whatWindowItem;
uiMenu *moreTestsMenu;
uiMenuItem *quitEnabledItem;
uiMenuItem *prefsEnabledItem;
@ -42,6 +43,11 @@ static void forceOff(uiMenuItem *item, uiWindow *w, void *data)
uiMenuItemSetChecked(enabledItem, 0);
}
static void whatWindow(uiMenuItem *item, uiWindow *w, void *data)
{
printf("menu item clicked on window %p\n", w);
}
void initMenus(void)
{
fileMenu = uiNewMenu("File");
@ -66,6 +72,9 @@ void initMenus(void)
uiMenuItemOnClicked(forceCheckedItem, forceOn, NULL);
forceUncheckedItem = uiMenuAppendItem(testMenu, "Force Above Unchecked");
uiMenuItemOnClicked(forceUncheckedItem, forceOff, NULL);
uiMenuAppendSeparator(testMenu);
whatWindowItem = uiMenuAppendItem(testMenu, "What Window?");
uiMenuItemOnClicked(whatWindowItem, whatWindow, NULL);
moreTestsMenu = uiNewMenu("More Tests");
quitEnabledItem = uiMenuAppendCheckItem(moreTestsMenu, "Quit Item Enabled");