80 e.intval = 0; |
81 e.intval = 0; |
81 eventdata->callback(&e, eventdata->userdata); |
82 eventdata->callback(&e, eventdata->userdata); |
82 } |
83 } |
83 return TRUE; |
84 return TRUE; |
84 } |
85 } |
|
86 #endif |
85 |
87 |
86 void ui_drawingarea_getsize(UIWIDGET drawingarea, int *width, int *height) { |
88 void ui_drawingarea_getsize(UIWIDGET drawingarea, int *width, int *height) { |
87 #ifdef UI_GTK3 |
89 #if GTK_MAJOR_VERSION >= 4 |
88 *width = gtk_widget_get_allocated_width(drawingarea); |
90 *width = gtk_widget_get_width(drawingarea); |
89 *height = gtk_widget_get_allocated_height(drawingarea); |
91 *height = gtk_widget_get_height(drawingarea); |
|
92 #elif GTK_MAJOR_VERSION == 3 |
|
93 *width = gtk_widget_get_allocated_width(drawingarea); |
|
94 *height = gtk_widget_get_allocated_height(drawingarea); |
90 #else |
95 #else |
91 *width = drawingarea->allocation.width; |
96 *width = drawingarea->allocation.width; |
92 *height = drawingarea->allocation.height; |
97 *height = drawingarea->allocation.height; |
93 #endif |
98 #endif |
94 } |
99 } |
95 |
100 |
96 void ui_drawingarea_redraw(UIWIDGET drawingarea) { |
101 void ui_drawingarea_redraw(UIWIDGET drawingarea) { |
97 gtk_widget_queue_draw(drawingarea); |
102 gtk_widget_queue_draw(drawingarea); |
98 } |
103 } |
99 |
104 |
100 void ui_drawingarea_mousehandler(UiObject *obj, UIWIDGET widget, ui_callback f, void *u) { |
105 void ui_drawingarea_mousehandler(UiObject *obj, UIWIDGET widget, ui_callback f, void *u) { |
|
106 #if GTK_MAJOR_VERSION >= 4 |
|
107 // TODO |
|
108 #else |
101 gtk_widget_set_events(widget, GDK_BUTTON_PRESS_MASK); |
109 gtk_widget_set_events(widget, GDK_BUTTON_PRESS_MASK); |
102 if(f) { |
110 if(f) { |
103 UiEventData *event = malloc(sizeof(UiEventData)); |
111 UiEventData *event = malloc(sizeof(UiEventData)); |
104 event->obj = obj; |
112 event->obj = obj; |
105 event->callback = f; |
113 event->callback = f; |