31 |
31 |
32 #include "button.h" |
32 #include "button.h" |
33 #include "container.h" |
33 #include "container.h" |
34 #include "../../ucx/mempool.h" |
34 #include "../../ucx/mempool.h" |
35 #include "../common/context.h" |
35 #include "../common/context.h" |
|
36 #include "../common/object.h" |
36 |
37 |
37 UIWIDGET ui_button(UiObject *obj, char *label, ui_callback f, void *data) { |
38 UIWIDGET ui_button(UiObject *obj, char *label, ui_callback f, void *data) { |
38 GtkWidget *button = gtk_button_new_with_label(label); |
39 GtkWidget *button = gtk_button_new_with_label(label); |
39 |
40 |
40 if(f) { |
41 if(f) { |
72 e.document = event->obj->document; |
73 e.document = event->obj->document; |
73 e.eventdata = NULL; |
74 e.eventdata = NULL; |
74 e.intval = event->value; |
75 e.intval = event->value; |
75 event->callback(&e, event->user_data); |
76 event->callback(&e, event->user_data); |
76 } |
77 } |
|
78 |
|
79 void ui_button_toggled(GtkToggleToolButton *widget, UiEventData *event) { |
|
80 UiEvent e; |
|
81 e.obj = event->obj; |
|
82 e.window = event->obj->window; |
|
83 e.document = event->obj->document; |
|
84 e.eventdata = NULL; |
|
85 e.intval = gtk_toggle_tool_button_get_active(widget); |
|
86 event->callback(&e, event->user_data); |
|
87 } |