ui/gtk/graphics.c

changeset 118
bb21210e9cac
parent 115
102fc0b8fe3e
child 121
1cc365c34125
equal deleted inserted replaced
117:38c53b8a6139 118:bb21210e9cac
81 eventdata->callback(&e, eventdata->userdata); 81 eventdata->callback(&e, eventdata->userdata);
82 } 82 }
83 return TRUE; 83 return TRUE;
84 } 84 }
85 85
86 void ui_drawingarea_getsize(UIWIDGET drawingarea, int *width, int *height) {
87 #ifdef UI_GTK3
88 *width = gtk_widget_get_allocated_width(drawingarea);
89 *height = gtk_widget_get_allocated_height(drawingarea);
90 #else
91 *width = widget->allocation.width;
92 *height = widget->allocation.height;
93 #endif
94 }
95
96 void ui_drawingarea_redraw(UIWIDGET drawingarea) {
97 gtk_widget_queue_draw(drawingarea);
98 }
99
86 void ui_drawingarea_mousehandler(UiObject *obj, UIWIDGET widget, ui_callback f, void *u) { 100 void ui_drawingarea_mousehandler(UiObject *obj, UIWIDGET widget, ui_callback f, void *u) {
87 gtk_widget_set_events(widget, GDK_BUTTON_PRESS_MASK); 101 gtk_widget_set_events(widget, GDK_BUTTON_PRESS_MASK);
88 if(f) { 102 if(f) {
89 UiEventData *event = malloc(sizeof(UiEventData)); 103 UiEventData *event = malloc(sizeof(UiEventData));
90 event->obj = obj; 104 event->obj = obj;

mercurial