Decided what to do about menuless menubars and implemented it.
This commit is contained in:
parent
99216435c7
commit
c6b4d80602
2
TODO.md
2
TODO.md
|
@ -16,7 +16,6 @@ ultimately:
|
|||
- in which case, hide leading or trailing separators?
|
||||
- generate libui.lib and related files
|
||||
- make OS-specific headers generated by an IDL
|
||||
- figure out what to do on Windows and GTK+ if we don't have menus but the user wants a menubar (zero-height widget? don't bother? complain?)
|
||||
- bin.c
|
||||
- find a way to move the has parent check at the beginning of binDestroy()
|
||||
- menu item state change while the menu is visible (not in response to user action)
|
||||
|
@ -41,3 +40,4 @@ notes to self
|
|||
- note that uiInitOptions should be initialized to zero
|
||||
- explicitly document that uiCheckboxSetChecked() and uiEntrySetText() do not fire uiCheckboxOnToggled() and uiEntryOnChanged(), respectively
|
||||
- note that uiControlResize() on a uiContainer also updates
|
||||
- note that if a menu is requested on systems with menubars on windows but no menus are defined, the result is a blank menubar, with whatever that means left up to the OS to decide
|
||||
|
|
19
unix/menu.c
19
unix/menu.c
|
@ -297,15 +297,16 @@ GtkWidget *makeMenubar(uiWindow *w)
|
|||
|
||||
menubar = gtk_menu_bar_new();
|
||||
|
||||
for (i = 0; i < menus->len; i++) {
|
||||
m = g_array_index(menus, struct menu *, i);
|
||||
menuitem = gtk_menu_item_new_with_label(m->name);
|
||||
submenu = gtk_menu_new();
|
||||
gtk_menu_item_set_submenu(GTK_MENU_ITEM(menuitem), submenu);
|
||||
for (j = 0; j < m->items->len; j++)
|
||||
appendMenuItem(GTK_MENU_SHELL(submenu), g_array_index(m->items, struct menuItem *, j), w);
|
||||
gtk_menu_shell_append(GTK_MENU_SHELL(menubar), menuitem);
|
||||
}
|
||||
if (menus != NULL)
|
||||
for (i = 0; i < menus->len; i++) {
|
||||
m = g_array_index(menus, struct menu *, i);
|
||||
menuitem = gtk_menu_item_new_with_label(m->name);
|
||||
submenu = gtk_menu_new();
|
||||
gtk_menu_item_set_submenu(GTK_MENU_ITEM(menuitem), submenu);
|
||||
for (j = 0; j < m->items->len; j++)
|
||||
appendMenuItem(GTK_MENU_SHELL(submenu), g_array_index(m->items, struct menuItem *, j), w);
|
||||
gtk_menu_shell_append(GTK_MENU_SHELL(menubar), menuitem);
|
||||
}
|
||||
|
||||
gtk_widget_set_hexpand(menubar, TRUE);
|
||||
gtk_widget_set_halign(menubar, GTK_ALIGN_FILL);
|
||||
|
|
Loading…
Reference in New Issue