fix treeview contextmenu (GTK) newapi

Tue, 26 Nov 2024 10:02:04 +0100

author
Olaf Wintermann <olaf.wintermann@gmail.com>
date
Tue, 26 Nov 2024 10:02:04 +0100
branch
newapi
changeset 391
fc0df448dfbc
parent 390
b130f80ec7f9
child 392
df62b7205bd3

fix treeview contextmenu (GTK)

ui/gtk/list.c file | annotate | diff | comparison | revisions
ui/gtk/menu.c file | annotate | diff | comparison | revisions
ui/winui/appmenu.cpp file | annotate | diff | comparison | revisions
--- a/ui/gtk/list.c	Thu Nov 21 18:45:47 2024 +0100
+++ b/ui/gtk/list.c	Tue Nov 26 10:02:04 2024 +0100
@@ -402,11 +402,7 @@
     }
     // TODO: destroy callback
     
-    if(args.contextmenu) {
-        UIMENU menu = ui_contextmenu_create(args.contextmenu, obj, view);
-        ui_widget_set_contextmenu(view, menu);
-    }
-    
+      
     GtkTreeSelection *selection = gtk_tree_view_get_selection (GTK_TREE_VIEW(view));
     if(args.multiselection) {
         gtk_tree_selection_set_mode(selection, GTK_SELECTION_MULTIPLE);
@@ -420,6 +416,11 @@
             GTK_POLICY_AUTOMATIC); // GTK_POLICY_ALWAYS  
     SCROLLEDWINDOW_SET_CHILD(scroll_area, view);
     
+    if(args.contextmenu) {
+        UIMENU menu = ui_contextmenu_create(args.contextmenu, obj, scroll_area);
+        ui_widget_set_contextmenu(scroll_area, menu);
+    }
+    
     UI_APPLY_LAYOUT1(current, args);
     current->container->add(current->container, scroll_area, FALSE);
     
--- a/ui/gtk/menu.c	Thu Nov 21 18:45:47 2024 +0100
+++ b/ui/gtk/menu.c	Tue Nov 26 10:02:04 2024 +0100
@@ -367,7 +367,6 @@
         if(e->button == 3) {
             gtk_widget_show_all(GTK_WIDGET(menu));
             ui_contextmenu_popup(menu, widget, 0, 0);
-            return TRUE;
         }
     }
     return FALSE;
--- a/ui/winui/appmenu.cpp	Thu Nov 21 18:45:47 2024 +0100
+++ b/ui/winui/appmenu.cpp	Tue Nov 26 10:02:04 2024 +0100
@@ -285,3 +285,11 @@
 
     return flyout;
 }
+
+UIMENU ui_contextmenu_create(UiMenuBuilder *builder, UiObject *obj, UIWIDGET widget) {
+    return NULL;
+}
+
+void ui_contextmenu_popup(UIMENU menu, UIWIDGET widget, int x, int y) {
+    
+}

mercurial