ui/gtk/list.h

changeset 100
d2bd73d28ff1
parent 90
f501f0efc9a8
--- a/ui/gtk/list.h	Fri Nov 29 22:21:36 2024 +0100
+++ b/ui/gtk/list.h	Thu Dec 12 20:01:43 2024 +0100
@@ -32,6 +32,8 @@
 #include "../ui/tree.h"
 #include "toolkit.h"
 
+#include <cx/array_list.h>
+
 #ifdef	__cplusplus
 extern "C" {
 #endif
@@ -57,7 +59,33 @@
     void        *activatedata;
     void        *selectiondata;
 } UiTreeEventData;
+
+typedef struct UiListBox UiListBox;
+
+typedef struct UiListBoxSubList {
+    UiVar       *var;
+    size_t      numitems;
+    char        *header;
+    UiBool      separator;
+    CxList      *widgets;
+    UiListBox   *listbox;
+    void        *userdata;
+    size_t      index;
+} UiListBoxSubList;
+
+struct UiListBox {
+    UiObject                 *obj;
+    GtkListBox               *listbox;
+    CxList                   *sublists; // contains UiListBoxSubList elements
+    ui_sublist_getvalue_func getvalue;
+    ui_callback              onactivate;
+    void                     *onactivatedata;
+    ui_callback              onbuttonclick;
+    void                     *onbuttonclickdata;
     
+    GtkListBoxRow            *first_row;
+};
+
 void* ui_strmodel_getvalue(void *elm, int column);
 
 UIWIDGET ui_listview_var(UiObject *obj, UiVar *var, ui_getvaluefunc getvalue, ui_callback f, void *udata);
@@ -94,6 +122,12 @@
 void ui_combobox_modelupdate(UiList *list, int i);
 UiListSelection ui_combobox_getselection(UiList *list);
 void ui_combobox_setselection(UiList *list, UiListSelection selection);
+
+void ui_listbox_update(UiListBox *listbox, int from, int to);
+void ui_listbox_update_sublist(UiListBox *listbox, UiListBoxSubList *sublist, size_t listbox_insert_index);
+void ui_listbox_list_update(UiList *list, int i);
+
+void ui_listbox_row_activate(GtkListBox *self, GtkListBoxRow *row, gpointer user_data);
         
 #ifdef	__cplusplus
 }

mercurial