ui/gtk/list.h

changeset 101
7b3a3130be44
parent 100
d2bd73d28ff1
--- a/ui/gtk/list.h	Thu Dec 12 20:01:43 2024 +0100
+++ b/ui/gtk/list.h	Mon Jan 06 22:22:55 2025 +0100
@@ -37,21 +37,39 @@
 #ifdef	__cplusplus
 extern "C" {
 #endif
+    
+typedef struct UiColData UiColData;
 
 typedef struct UiListView {
-    UiObject    *obj;
-    GtkWidget   *widget;
-    UiVar       *var;
-    UiModel     *model;
-    ui_callback ondragstart;
-    void        *ondragstartdata;
-    ui_callback ondragcomplete;
-    void        *ondragcompletedata;
-    ui_callback ondrop;
-    void        *ondropdata;
+    UiObject          *obj;
+    GtkWidget         *widget;
+    UiVar             *var;
+    UiModel           *model;
+#if GTK_CHECK_VERSION(4, 10, 0)
+    GListStore        *liststore;
+    GtkSelectionModel *selectionmodel;
+    UiColData         *columns;
+#endif
+    ui_callback       onactivate;
+    void              *onactivatedata;
+    ui_callback       onselection;
+    void              *onselectiondata;
+    ui_callback       ondragstart;
+    void              *ondragstartdata;
+    ui_callback       ondragcomplete;
+    void              *ondragcompletedata;
+    ui_callback       ondrop;
+    void              *ondropdata;
+    UiListSelection   selection;
     
 } UiListView;
 
+struct UiColData {
+    UiListView *listview;
+    int model_column;
+    int data_column;
+};
+
 typedef struct UiTreeEventData {
     UiObject    *obj;
     ui_callback activate;
@@ -86,6 +104,22 @@
     GtkListBoxRow            *first_row;
 };
 
+
+#if GTK_CHECK_VERSION(4, 10, 0)
+
+void ui_update_liststore(GListStore *liststore, UiList *list);
+
+void ui_listview_update2(UiList *list, int i);
+UiListSelection ui_listview_getselection2(UiList *list);
+void ui_listview_setselection2(UiList *list, UiListSelection selection);
+
+void ui_columnview_activate(void *ignore, guint position, gpointer userdata);
+void ui_listview_selection_changed(GtkSelectionModel* self, guint position, guint n_items, gpointer user_data);
+
+void ui_dropdown_activate(GtkDropDown* self, gpointer userdata);
+
+#endif
+
 void* ui_strmodel_getvalue(void *elm, int column);
 
 UIWIDGET ui_listview_var(UiObject *obj, UiVar *var, ui_getvaluefunc getvalue, ui_callback f, void *udata);
@@ -100,6 +134,9 @@
 void ui_combobox_destroy(GtkWidget *w, UiListView *v);
 void ui_listview_destroy(GtkWidget *w, UiListView *v);
 
+#if GTK_CHECK_VERSION(4, 10, 0)
+
+#else
 void ui_listview_activate_event(
         GtkTreeView *tree_view,
         GtkTreePath *path,
@@ -112,6 +149,7 @@
         GtkTreeSelection *selection,
         UiTreeEventData *event);
 int ui_tree_path_list_index(GtkTreePath *path);
+#endif
 
 void ui_listview_add_dnd(UiListView *listview, UiListArgs *args);
 void ui_listview_enable_drop(UiListView *listview, UiListArgs *args);

mercurial