ui/gtk/menu.c

changeset 435
883a569cc9a3
parent 400
a1946c97de09
child 440
7c4b9cba09ca
--- a/ui/gtk/menu.c	Sun Jan 05 10:14:52 2025 +0100
+++ b/ui/gtk/menu.c	Sun Jan 05 10:30:39 2025 +0100
@@ -390,7 +390,25 @@
 
 #if GTK_MAJOR_VERSION >= 4
 
+GtkWidget *ui_create_menubar(UiObject *obj) {
+    UiMenu *menus_begin = uic_get_menu_list();
+    if(menus_begin == NULL) {
+        return NULL;
+    }
+    
+    GMenu *menu = g_menu_new();
+    UiMenu *ls = menus_begin;
+    while(ls) {
+        GMenu *sub_menu = g_menu_new();
+        ui_gmenu_add_menu_items(sub_menu, 0, ls, obj);
+        g_menu_append_submenu(menu, ls->label, G_MENU_MODEL(sub_menu));
+        ls = (UiMenu*)ls->item.next;
+    }
+    
 
+    // Create a menubar from the menu model
+    return gtk_popover_menu_bar_new_from_model(G_MENU_MODEL(menu));
+}
 
 static ui_gmenu_add_f createMenuItem[] = {
     /* UI_MENU                 */ ui_gmenu_add_menu,

mercurial