ui/common/types.c

branch
newapi
changeset 360
681b930abe84
parent 342
99f83fbf48e9
--- a/ui/common/types.c	Sun Oct 27 11:34:25 2024 +0100
+++ b/ui/common/types.c	Sun Oct 27 12:08:10 2024 +0100
@@ -501,6 +501,15 @@
     return (UiListSelection){ 0, NULL };
 }
 
+UIEXPORT void ui_list_setselection(UiList *list, int index) {
+    if (list->setselection && index >= 0) {
+        UiListSelection sel;
+        sel.count = 1;
+        sel.rows = &index;
+        list->setselection(list, sel);
+    }
+}
+
 UIEXPORT void ui_listselection_free(UiListSelection selection) {
     if (selection.rows) {
         free(selection.rows);

mercurial