ui/gtk/list.h

branch
newapi
changeset 411
3e91b7aff6a1
parent 394
bedd499b640d
--- a/ui/gtk/list.h	Thu Dec 05 20:02:30 2024 +0100
+++ b/ui/gtk/list.h	Fri Dec 06 13:11:09 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