add alternative function for setting list selections

Sat, 30 Aug 2025 10:14:46 +0200

author
Olaf Wintermann <olaf.wintermann@gmail.com>
date
Sat, 30 Aug 2025 10:14:46 +0200
changeset 736
3ad4792ffadc
parent 735
c249b497ab2e
child 737
ac7f0869e8ae

add alternative function for setting list selections

ui/common/wrapper.c file | annotate | diff | comparison | revisions
ui/common/wrapper.h file | annotate | diff | comparison | revisions
--- a/ui/common/wrapper.c	Thu Aug 28 20:12:43 2025 +0200
+++ b/ui/common/wrapper.c	Sat Aug 30 10:14:46 2025 +0200
@@ -236,6 +236,15 @@
     return sel->rows;
 }
 
+UIEXPORT void ui_list_set_selected_indices(UiList *list, int *indices, int num) {
+    UiListSelection sel;
+    sel.rows = indices;
+    sel.count = num;
+    if(list->setselection) {
+        list->setselection(list, sel);
+    }
+}
+
 void ui_list_selection_free(UiListSelection *sel) {
     ui_listselection_free(*sel);
     free(sel);
--- a/ui/common/wrapper.h	Thu Aug 28 20:12:43 2025 +0200
+++ b/ui/common/wrapper.h	Sat Aug 30 10:14:46 2025 +0200
@@ -77,6 +77,7 @@
 UIEXPORT UiListSelection* ui_list_get_selection_allocated(UiList *list);
 UIEXPORT int ui_list_selection_get_count(UiListSelection *sel);
 UIEXPORT int* ui_list_selection_get_rows(UiListSelection *sel);
+UIEXPORT void ui_list_set_selected_indices(UiList *list, int *indices, int num);
 UIEXPORT void ui_list_selection_free(UiListSelection *sel);
 
 UIEXPORT int ui_filelist_count(UiFileList *flist);

mercurial