ui/common/types.c

changeset 60
ee4e4742391e
parent 52
0c881944fa10
--- a/ui/common/types.c	Wed Oct 23 21:46:43 2024 +0200
+++ b/ui/common/types.c	Sun Oct 27 18:24:37 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