ui/gtk/button.c

branch
newapi
changeset 343
54f5d7eb1335
parent 339
b68b5f984074
equal deleted inserted replaced
342:99f83fbf48e9 343:54f5d7eb1335
89 89
90 UIWIDGET ui_button_create(UiObject *obj, UiButtonArgs args) { 90 UIWIDGET ui_button_create(UiObject *obj, UiButtonArgs args) {
91 UiObject* current = uic_current_obj(obj); 91 UiObject* current = uic_current_obj(obj);
92 GtkWidget *button = ui_create_button(obj, args.label, args.icon, args.onclick, args.onclickdata); 92 GtkWidget *button = ui_create_button(obj, args.label, args.icon, args.onclick, args.onclickdata);
93 ui_set_name_and_style(button, args.name, args.style_class); 93 ui_set_name_and_style(button, args.name, args.style_class);
94 ui_set_widget_groups(obj->ctx, button, args.groups);
94 UI_APPLY_LAYOUT1(current, args); 95 UI_APPLY_LAYOUT1(current, args);
95 current->container->add(current->container, button, FALSE); 96 current->container->add(current->container, button, FALSE);
96 return button; 97 return button;
97 } 98 }
98 99
230 static UIWIDGET togglebutton_create(UiObject *obj, GtkWidget *widget, UiToggleArgs args) { 231 static UIWIDGET togglebutton_create(UiObject *obj, GtkWidget *widget, UiToggleArgs args) {
231 UiObject* current = uic_current_obj(obj); 232 UiObject* current = uic_current_obj(obj);
232 233
233 ui_setup_togglebutton(current, widget, args.label, args.icon, args.varname, args.value, args.onchange, args.onchangedata); 234 ui_setup_togglebutton(current, widget, args.label, args.icon, args.varname, args.value, args.onchange, args.onchangedata);
234 ui_set_name_and_style(widget, args.name, args.style_class); 235 ui_set_name_and_style(widget, args.name, args.style_class);
236 ui_set_widget_groups(obj->ctx, widget, args.groups);
235 237
236 UI_APPLY_LAYOUT1(current, args); 238 UI_APPLY_LAYOUT1(current, args);
237 current->container->add(current->container, widget, FALSE); 239 current->container->add(current->container, widget, FALSE);
238 240
239 return widget; 241 return widget;
280 args.value, 282 args.value,
281 (ui_toggled_func)ui_checkbox_callback, 283 (ui_toggled_func)ui_checkbox_callback,
282 args.onchange, 284 args.onchange,
283 args.onchangedata); 285 args.onchangedata);
284 286
287 ui_set_name_and_style(widget, args.name, args.style_class);
288 ui_set_widget_groups(obj->ctx, widget, args.groups);
289
285 UI_APPLY_LAYOUT1(current, args); 290 UI_APPLY_LAYOUT1(current, args);
286 current->container->add(current->container, widget, FALSE); 291 current->container->add(current->container, widget, FALSE);
287 292
288 return widget; 293 return widget;
289 } 294 }
341 } 346 }
342 } 347 }
343 348
344 GtkWidget *rbutton = RADIOBUTTON_NEW(rg, args.label); 349 GtkWidget *rbutton = RADIOBUTTON_NEW(rg, args.label);
345 ui_set_name_and_style(rbutton, args.name, args.style_class); 350 ui_set_name_and_style(rbutton, args.name, args.style_class);
351 ui_set_widget_groups(obj->ctx, rbutton, args.groups);
346 if(rgroup) { 352 if(rgroup) {
347 #if GTK_MAJOR_VERSION >= 4 353 #if GTK_MAJOR_VERSION >= 4
348 if(rg) { 354 if(rg) {
349 gtk_check_button_set_group(GTK_CHECK_BUTTON(rbutton), rg->data); 355 gtk_check_button_set_group(GTK_CHECK_BUTTON(rbutton), rg->data);
350 } 356 }

mercurial