ui/winui/toolkit.cpp

changeset 83
a612adaee43d
parent 79
483d7342b439
--- a/ui/winui/toolkit.cpp	Wed Nov 13 22:10:03 2024 +0100
+++ b/ui/winui/toolkit.cpp	Thu Nov 14 17:25:23 2024 +0100
@@ -355,3 +355,27 @@
 	pool->EnqueueJob(job);
 }
 
+
+
+void ui_set_widget_groups(UiContext *ctx, UIWIDGET widget, const int *groups) {
+	if(!groups) {
+		return;
+	}
+	size_t ngroups = uic_group_array_size(groups);
+	ui_set_widget_ngroups(ctx, widget, groups, ngroups);
+}
+
+void ui_set_widget_ngroups(UiContext *ctx, UIWIDGET widget, const int *groups, size_t ngroups) {
+	if(ngroups > 0) {
+		uic_add_group_widget_i(ctx, widget, (ui_enablefunc)ui_set_enabled, groups, ngroups);
+		ui_set_enabled(widget, FALSE);
+	}
+}
+
+
+UIEXPORT void ui_set_enabled(UIWIDGET widget, int enabled) {
+	Control ctrl = widget->uielement.as<Control>();
+	if (ctrl) {
+		ctrl.IsEnabled(enabled);
+	}
+}

mercurial