--- a/ui/gtk/button.c Thu May 15 12:55:54 2025 +0200 +++ b/ui/gtk/button.c Thu May 29 12:03:32 2025 +0200 @@ -96,12 +96,12 @@ return button; } -UIWIDGET ui_button_create(UiObject *obj, UiButtonArgs args) { +UIWIDGET ui_button_create(UiObject *obj, UiButtonArgs *args) { UiObject* current = uic_current_obj(obj); - GtkWidget *button = ui_create_button(obj, args.label, args.icon, args.onclick, args.onclickdata, 0, FALSE); - ui_set_name_and_style(button, args.name, args.style_class); - ui_set_widget_groups(obj->ctx, button, args.groups); - UI_APPLY_LAYOUT1(current, args); + GtkWidget *button = ui_create_button(obj, args->label, args->icon, args->onclick, args->onclickdata, 0, FALSE); + ui_set_name_and_style(button, args->name, args->style_class); + ui_set_widget_groups(obj->ctx, button, args->groups); + UI_APPLY_LAYOUT2(current, args); current->container->add(current->container, button, FALSE); return button; } @@ -274,29 +274,29 @@ } } -static UIWIDGET togglebutton_create(UiObject *obj, GtkWidget *widget, UiToggleArgs args) { +static UIWIDGET togglebutton_create(UiObject *obj, GtkWidget *widget, UiToggleArgs *args) { UiObject* current = uic_current_obj(obj); ui_setup_togglebutton( obj, widget, - args.label, - args.icon, - args.varname, - args.value, - args.onchange, - args.onchangedata, - args.enable_group); - ui_set_name_and_style(widget, args.name, args.style_class); - ui_set_widget_groups(obj->ctx, widget, args.groups); + args->label, + args->icon, + args->varname, + args->value, + args->onchange, + args->onchangedata, + args->enable_group); + ui_set_name_and_style(widget, args->name, args->style_class); + ui_set_widget_groups(obj->ctx, widget, args->groups); - UI_APPLY_LAYOUT1(current, args); + UI_APPLY_LAYOUT2(current, args); current->container->add(current->container, widget, FALSE); return widget; } -UIWIDGET ui_togglebutton_create(UiObject* obj, UiToggleArgs args) { +UIWIDGET ui_togglebutton_create(UiObject* obj, UiToggleArgs *args) { return togglebutton_create(obj, gtk_toggle_button_new(), args); } @@ -333,39 +333,39 @@ } } -UIWIDGET ui_checkbox_create(UiObject* obj, UiToggleArgs args) { +UIWIDGET ui_checkbox_create(UiObject* obj, UiToggleArgs *args) { UiObject* current = uic_current_obj(obj); - GtkWidget *widget = gtk_check_button_new_with_label(args.label); + GtkWidget *widget = gtk_check_button_new_with_label(args->label); ui_bind_togglebutton( obj, widget, ui_check_button_get, ui_check_button_set, - args.varname, - args.value, + args->varname, + args->value, (ui_toggled_func)ui_checkbox_callback, - args.onchange, - args.onchangedata, + args->onchange, + args->onchangedata, (ui_toggled_func)ui_checkbox_enable_state, - args.enable_group); + args->enable_group); - ui_set_name_and_style(widget, args.name, args.style_class); - ui_set_widget_groups(obj->ctx, widget, args.groups); + ui_set_name_and_style(widget, args->name, args->style_class); + ui_set_widget_groups(obj->ctx, widget, args->groups); - UI_APPLY_LAYOUT1(current, args); + UI_APPLY_LAYOUT2(current, args); current->container->add(current->container, widget, FALSE); return widget; } #else -UIWIDGET ui_checkbox_create(UiObject* obj, UiToggleArgs args) { +UIWIDGET ui_checkbox_create(UiObject* obj, UiToggleArgs *args) { return togglebutton_create(obj, gtk_check_button_new(), args); } #endif -UIWIDGET ui_switch_create(UiObject* obj, UiToggleArgs args) { +UIWIDGET ui_switch_create(UiObject* obj, UiToggleArgs *args) { #ifdef UI_GTK3 return NULL; // TODO #else @@ -415,13 +415,13 @@ free(data); } -UIWIDGET ui_radiobutton_create(UiObject *obj, UiToggleArgs args) { +UIWIDGET ui_radiobutton_create(UiObject *obj, UiToggleArgs *args) { UiObject* current = uic_current_obj(obj); GSList *rg = NULL; UiInteger *rgroup; - UiVar* var = uic_widget_var(obj->ctx, current->ctx, args.value, args.varname, UI_VAR_INTEGER); + UiVar* var = uic_widget_var(obj->ctx, current->ctx, args->value, args->varname, UI_VAR_INTEGER); UiBool first = FALSE; if(var) { @@ -432,9 +432,9 @@ } } - GtkWidget *rbutton = RADIOBUTTON_NEW(rg, args.label); - ui_set_name_and_style(rbutton, args.name, args.style_class); - ui_set_widget_groups(obj->ctx, rbutton, args.groups); + GtkWidget *rbutton = RADIOBUTTON_NEW(rg, args->label); + ui_set_name_and_style(rbutton, args->name, args->style_class); + ui_set_widget_groups(obj->ctx, rbutton, args->groups); if(rgroup) { #if GTK_MAJOR_VERSION >= 4 if(rg) { @@ -476,11 +476,11 @@ rbdata); } - if(args.onchange) { + if(args->onchange) { UiEventData *event = malloc(sizeof(UiEventData)); event->obj = obj; - event->userdata = args.onchangedata; - event->callback = args.onchange; + event->userdata = args->onchangedata; + event->callback = args->onchange; event->value = 0; event->customdata = NULL; @@ -496,7 +496,7 @@ event); } - UI_APPLY_LAYOUT1(current, args); + UI_APPLY_LAYOUT2(current, args); current->container->add(current->container, rbutton, FALSE); return rbutton;