ui/gtk/list.c

changeset 88
e27526429d85
parent 80
1a908b060122
child 90
f501f0efc9a8
--- a/ui/gtk/list.c	Sun Nov 17 15:19:32 2024 +0100
+++ b/ui/gtk/list.c	Tue Nov 26 10:40:45 2024 +0100
@@ -37,6 +37,7 @@
 
 #include "list.h"
 #include "icon.h"
+#include "menu.h"
 
 
 void* ui_strmodel_getvalue(void *elm, int column) {
@@ -235,6 +236,10 @@
                 G_CALLBACK(ui_listview_selection_event),
                 event);
     }
+    if(args.contextmenu) {
+        UIMENU menu = ui_contextmenu_create(args.contextmenu, obj, view);
+        ui_widget_set_contextmenu(view, menu);
+    }
     
     
     // add widget to the current container
@@ -370,6 +375,7 @@
     // bind var
     list->update = ui_listview_update;
     list->getselection = ui_listview_getselection;
+    list->setselection = ui_listview_setselection;
     list->obj = tableview;
     
     // add callback
@@ -396,8 +402,8 @@
                 event);
     }
     // TODO: destroy callback
-
     
+      
     GtkTreeSelection *selection = gtk_tree_view_get_selection (GTK_TREE_VIEW(view));
     if(args.multiselection) {
         gtk_tree_selection_set_mode(selection, GTK_SELECTION_MULTIPLE);
@@ -411,6 +417,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);
     

mercurial