--- a/ui/ui/toolkit.h Thu Feb 08 10:35:07 2024 +0100 +++ b/ui/ui/toolkit.h Fri Feb 09 16:50:23 2024 +0100 @@ -157,6 +157,8 @@ typedef struct UiFileList UiFileList; +typedef struct UiListSelection UiListSelection; + /* begin opaque types */ typedef struct UiContext UiContext; typedef struct UiContainer UiContainer; @@ -329,8 +331,9 @@ /* private - implementation dependent */ void *data; - /* binding function */ + /* binding functions */ void (*update)(UiList *list, int i); + UiListSelection (*getselection)(UiList *list); /* binding object */ void *obj; @@ -338,6 +341,19 @@ UiObserver *observers; }; + +struct UiListSelection { + /* + * number of selected items + */ + int count; + + /* + * indices of selected rows + */ + int *rows; +}; + struct UiRange { double (*get)(UiRange *range); void (*set)(UiRange *range, double value); @@ -462,6 +478,8 @@ UIEXPORT void ui_list_addobsv(UiList *list, ui_callback f, void *data); UIEXPORT void ui_list_notify(UiList *list); +UIEXPORT UiListSelection ui_list_getselection(UiList *list); + UIEXPORT UiFileList ui_filelist_copy(UiFileList list); UIEXPORT void ui_filelist_free(UiFileList list); @@ -477,7 +495,7 @@ - +UIEXPORT void ui_listselection_free(UiListSelection selection); UIEXPORT UiIcon* ui_icon(const char* name, size_t size); UIEXPORT UiIcon* ui_imageicon(const char* file);