ui/gtk/button.c

branch
newapi
changeset 350
70305d427f25
parent 344
870dd3d41d83
--- a/ui/gtk/button.c	Wed Oct 23 17:16:51 2024 +0200
+++ b/ui/gtk/button.c	Fri Oct 25 15:37:02 2024 +0200
@@ -60,7 +60,8 @@
         const char *icon,
         ui_callback onclick,
         void *userdata,
-        int event_value)
+        int event_value,
+        bool activate_event)
 {
     GtkWidget *button = gtk_button_new_with_label(label);
     ui_button_set_icon_name(button, icon);
@@ -83,6 +84,13 @@
                 "destroy",
                 G_CALLBACK(ui_destroy_userdata),
                 event);
+        if(activate_event) {
+            g_signal_connect(
+                button,
+                "activate",
+                G_CALLBACK(ui_button_clicked),
+                event);
+        }
     }
     
     return button;
@@ -90,7 +98,7 @@
 
 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);
+    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);

mercurial