-
Notifications
You must be signed in to change notification settings - Fork 50
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Old PR libui#384] add submenus api for all platforms #115
base: master
Are you sure you want to change the base?
Conversation
Probably not. Any non-default callback assigned to a submenu item onclick should be userbug for now yes.
The |
unlike macos, on windows and linux, each window has it's own menu, which is the reason for all of these problems... I refactored the unix code, not the best, but I think it's better, especially the |
A way to test this is to change diff --git a/test/page2.c b/test/page2.c
index abb06489..98b342de 100644
--- a/test/page2.c
+++ b/test/page2.c
@@ -39,6 +39,11 @@ static void movePage1(uiButton *b, void *data)
moveBack = 1;
}
+int closeWindow(uiWindow *w, void *data)
+{
+ return 1;
+}
+
static void openAnotherWindow(uiButton *bb, void *data)
{
uiWindow *w;
@@ -54,6 +59,7 @@ static void openAnotherWindow(uiButton *bb, void *data)
} else
uiWindowSetChild(w, uiControl(makePage6()));
uiWindowSetMargined(w, 1);
+ uiWindowOnClosing(w, closeWindow, NULL);
uiControlShow(uiControl(w));
} now you can open and close menued and menuless windows to verify that the free function works. as to |
What does this PR need for being accepted? I believe submenus are a must-have. |
This PR needs more rigorous testing to be merged. Ideally a new submenu section added to the |
I could try to do it myself, but I would need to learn how the unit tests work in this repository, because at first glance my impression is that user review of the results would be necessary for UI-related tests. I will take a look at how the tests work and I will try to add the tests if possible. |
There are actually three different sets of tests:
|
based on andlabs/libui#384.
notes:
does it make sense to have an onclick for an item with a submenu? should it be userbug to do so?windows will crash on callinguiMenuItemDisable
on an item with submenu.document the api and add a note for setting an onclick callback.