ui/gtk/graphics.c

changeset 854
9291921f21c5
parent 848
5a4b72489111
child 978
71446363dcf9
equal deleted inserted replaced
853:380ec881faa2 854:9291921f21c5
75 75
76 UIWIDGET ui_drawingarea_create(UiObject *obj, UiDrawingAreaArgs *args) { 76 UIWIDGET ui_drawingarea_create(UiObject *obj, UiDrawingAreaArgs *args) {
77 GtkWidget *widget = gtk_drawing_area_new(); 77 GtkWidget *widget = gtk_drawing_area_new();
78 ui_set_name_and_style(widget, args->name, args->style_class); 78 ui_set_name_and_style(widget, args->name, args->style_class);
79 79
80 #if GTK_CHECK_VERSION(4, 0, 0)
80 gtk_drawing_area_set_content_width(GTK_DRAWING_AREA(widget), args->width > 0 ? args->width : 100); 81 gtk_drawing_area_set_content_width(GTK_DRAWING_AREA(widget), args->width > 0 ? args->width : 100);
81 gtk_drawing_area_set_content_height(GTK_DRAWING_AREA(widget), args->height > 0 ? args->height : 100); 82 gtk_drawing_area_set_content_height(GTK_DRAWING_AREA(widget), args->height > 0 ? args->height : 100);
83 #else
84 int w = args->width > 0 ? args->width : 100;
85 int h = args->height > 0 ? args->height : 100;
86 gtk_widget_set_size_request(widget, w, h);
87 #endif
82 88
83 UiContainerPrivate *ct = (UiContainerPrivate*)obj->container_end; 89 UiContainerPrivate *ct = (UiContainerPrivate*)obj->container_end;
84 UiLayout layout = UI_ARGS2LAYOUT(args); 90 UiLayout layout = UI_ARGS2LAYOUT(args);
85 ct->add(ct, widget, &layout); 91 ct->add(ct, widget, &layout);
86 92

mercurial