ui/gtk/button.c

changeset 58
0d25f15e2625
parent 56
294d5515583a
equal deleted inserted replaced
57:d5a7dbc945ef 58:0d25f15e2625
58 UiObject *obj, 58 UiObject *obj,
59 const char *label, 59 const char *label,
60 const char *icon, 60 const char *icon,
61 ui_callback onclick, 61 ui_callback onclick,
62 void *userdata, 62 void *userdata,
63 int event_value) 63 int event_value,
64 bool activate_event)
64 { 65 {
65 GtkWidget *button = gtk_button_new_with_label(label); 66 GtkWidget *button = gtk_button_new_with_label(label);
66 ui_button_set_icon_name(button, icon); 67 ui_button_set_icon_name(button, icon);
67 68
68 if(onclick) { 69 if(onclick) {
81 g_signal_connect( 82 g_signal_connect(
82 button, 83 button,
83 "destroy", 84 "destroy",
84 G_CALLBACK(ui_destroy_userdata), 85 G_CALLBACK(ui_destroy_userdata),
85 event); 86 event);
87 if(activate_event) {
88 g_signal_connect(
89 button,
90 "activate",
91 G_CALLBACK(ui_button_clicked),
92 event);
93 }
86 } 94 }
87 95
88 return button; 96 return button;
89 } 97 }
90 98
91 UIWIDGET ui_button_create(UiObject *obj, UiButtonArgs args) { 99 UIWIDGET ui_button_create(UiObject *obj, UiButtonArgs args) {
92 UiObject* current = uic_current_obj(obj); 100 UiObject* current = uic_current_obj(obj);
93 GtkWidget *button = ui_create_button(obj, args.label, args.icon, args.onclick, args.onclickdata, 0); 101 GtkWidget *button = ui_create_button(obj, args.label, args.icon, args.onclick, args.onclickdata, 0, FALSE);
94 ui_set_name_and_style(button, args.name, args.style_class); 102 ui_set_name_and_style(button, args.name, args.style_class);
95 ui_set_widget_groups(obj->ctx, button, args.groups); 103 ui_set_widget_groups(obj->ctx, button, args.groups);
96 UI_APPLY_LAYOUT1(current, args); 104 UI_APPLY_LAYOUT1(current, args);
97 current->container->add(current->container, button, FALSE); 105 current->container->add(current->container, button, FALSE);
98 return button; 106 return button;

mercurial