allow NULL as enablefunc in ui_widget_set_groups

Wed, 24 Sep 2025 21:00:42 +0200

author
Olaf Wintermann <olaf.wintermann@gmail.com>
date
Wed, 24 Sep 2025 21:00:42 +0200
changeset 775
c39e71be2e18
parent 774
4531a342c5b3
child 776
867ff911492d

allow NULL as enablefunc in ui_widget_set_groups

ui/common/context.c file | annotate | diff | comparison | revisions
--- a/ui/common/context.c	Tue Sep 23 17:40:40 2025 +0200
+++ b/ui/common/context.c	Wed Sep 24 21:00:42 2025 +0200
@@ -542,6 +542,9 @@
 }
 
 void ui_widget_set_groups(UiContext *ctx, UIWIDGET widget, ui_enablefunc enable, ...) {
+    if(enable == NULL) {
+        enable = (ui_enablefunc)ui_set_enabled;
+    }
     // get groups
     CxList *groups = cxArrayListCreate(cxDefaultAllocator, NULL, sizeof(int), 16);
     va_list ap;
@@ -558,6 +561,9 @@
 }
 
 void ui_widget_set_groups2(UiContext *ctx, UIWIDGET widget, ui_enablefunc enable, int *groups, int ngroups) {
+    if(enable == NULL) {
+        enable = (ui_enablefunc)ui_set_enabled;
+    }
     CxList *ls = cxArrayListCreate(cxDefaultAllocator, NULL, sizeof(int), ngroups);
     for(int i=0;i<ngroups;i++) {
         cxListAdd(ls, groups+i);

mercurial