static void gtk_offscreen_box_realize (GtkWidget *widget);
static void gtk_offscreen_box_unrealize (GtkWidget *widget);
-static void gtk_offscreen_box_size_request (GtkWidget *widget,
- GtkRequisition *requisition);
+static void gtk_offscreen_box_get_preferred_width (GtkWidget *widget,
+ gint *minimum,
+ gint *natural);
+static void gtk_offscreen_box_get_preferred_height (GtkWidget *widget,
+ gint *minimum,
+ gint *natural);
static void gtk_offscreen_box_size_allocate (GtkWidget *widget,
GtkAllocation *allocation);
static gboolean gtk_offscreen_box_damage (GtkWidget *widget,
widget_class->realize = gtk_offscreen_box_realize;
widget_class->unrealize = gtk_offscreen_box_unrealize;
- widget_class->size_request = gtk_offscreen_box_size_request;
+ widget_class->get_preferred_width = gtk_offscreen_box_get_preferred_width;
+ widget_class->get_preferred_height = gtk_offscreen_box_get_preferred_height;
widget_class->size_allocate = gtk_offscreen_box_size_allocate;
widget_class->draw = gtk_offscreen_box_draw;
{
GtkOffscreenBox *offscreen_box = GTK_OFFSCREEN_BOX (widget);
GtkAllocation allocation, child_area;
- GtkStyle *style;
+ GtkStyleContext *context;
GdkWindow *window;
GdkWindowAttr attributes;
gint attributes_mask;
g_signal_connect (offscreen_box->offscreen_window2, "from-embedder",
G_CALLBACK (offscreen_window_from_parent2), offscreen_box);
- gtk_widget_style_attach (widget);
- style = gtk_widget_get_style (widget);
- gtk_style_set_background (style, window, GTK_STATE_NORMAL);
- gtk_style_set_background (style, offscreen_box->offscreen_window1, GTK_STATE_NORMAL);
- gtk_style_set_background (style, offscreen_box->offscreen_window2, GTK_STATE_NORMAL);
+ context = gtk_widget_get_style_context (widget);
+ gtk_style_context_set_background (context, window);
+ gtk_style_context_set_background (context, offscreen_box->offscreen_window1);
+ gtk_style_context_set_background (context, offscreen_box->offscreen_window2);
gdk_window_show (offscreen_box->offscreen_window1);
gdk_window_show (offscreen_box->offscreen_window2);
requisition->height = border_width * 2 + h;
}
+static void
+gtk_offscreen_box_get_preferred_width (GtkWidget *widget,
+ gint *minimum,
+ gint *natural)
+{
+ GtkRequisition requisition;
+
+ gtk_offscreen_box_size_request (widget, &requisition);
+
+ *minimum = *natural = requisition.width;
+}
+
+static void
+gtk_offscreen_box_get_preferred_height (GtkWidget *widget,
+ gint *minimum,
+ gint *natural)
+{
+ GtkRequisition requisition;
+
+ gtk_offscreen_box_size_request (widget, &requisition);
+
+ *minimum = *natural = requisition.height;
+}
+
static void
gtk_offscreen_box_size_allocate (GtkWidget *widget,
GtkAllocation *allocation)
}
else if (gtk_cairo_should_draw_window (cr, offscreen_box->offscreen_window1))
{
- gtk_paint_flat_box (gtk_widget_get_style (widget), cr,
- GTK_STATE_NORMAL, GTK_SHADOW_NONE,
- widget, "blah",
- 0, 0,
- gdk_window_get_width (offscreen_box->offscreen_window1),
- gdk_window_get_height (offscreen_box->offscreen_window1));
+ gtk_render_background (gtk_widget_get_style_context (widget), cr,
+ 0, 0,
+
+ gdk_window_get_width (offscreen_box->offscreen_window1),
+ gdk_window_get_height (offscreen_box->offscreen_window1));
if (offscreen_box->child1)
gtk_container_propagate_draw (GTK_CONTAINER (widget),
}
else if (gtk_cairo_should_draw_window (cr, offscreen_box->offscreen_window2))
{
- gtk_paint_flat_box (gtk_widget_get_style (widget), cr,
- GTK_STATE_NORMAL, GTK_SHADOW_NONE,
- widget, "blah",
- 0, 0,
- gdk_window_get_width (offscreen_box->offscreen_window2),
- gdk_window_get_height (offscreen_box->offscreen_window2));
+ gtk_render_background (gtk_widget_get_style_context (widget), cr,
+ 0, 0,
+ gdk_window_get_width (offscreen_box->offscreen_window2),
+ gdk_window_get_height (offscreen_box->offscreen_window2));
if (offscreen_box->child2)
gtk_container_propagate_draw (GTK_CONTAINER (widget),