--- a/ui/gtk/list.h Sun Jan 05 10:30:39 2025 +0100 +++ b/ui/gtk/list.h Sun Jan 05 16:44:37 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,20 @@ 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(GtkColumnView* self, guint position, gpointer userdata); +void ui_listview_selection_changed(GtkSelectionModel* self, guint position, guint n_items, gpointer user_data); + +#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);