[gtk+/wip/otte/snapshot: 16/30] snapshot: Convert GtkButtonBox
- From: Benjamin Otte <otte src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk+/wip/otte/snapshot: 16/30] snapshot: Convert GtkButtonBox
- Date: Tue, 15 Nov 2016 06:32:59 +0000 (UTC)
commit e93e7112206337d3c7aeccd0e151dfa8fa828015
Author: Benjamin Otte <otte redhat com>
Date: Mon Nov 14 04:31:19 2016 +0100
snapshot: Convert GtkButtonBox
gtk/gtkbbox.c | 60 +++++++++++++++++++++++++++++++++++++++++---------------
1 files changed, 44 insertions(+), 16 deletions(-)
---
diff --git a/gtk/gtkbbox.c b/gtk/gtkbbox.c
index 98f8710..ab0e367 100644
--- a/gtk/gtkbbox.c
+++ b/gtk/gtkbbox.c
@@ -92,8 +92,8 @@ static void gtk_button_box_get_property (GObject *object,
guint prop_id,
GValue *value,
GParamSpec *pspec);
-static GskRenderNode *gtk_button_box_get_render_node (GtkWidget *widget,
- GskRenderer *renderer);
+static void gtk_button_box_snapshot (GtkWidget *widget,
+ GtkSnapshot *snapshot);
static void gtk_button_box_measure_ (GtkWidget *widget,
GtkOrientation orientation,
int for_size,
@@ -129,6 +129,13 @@ static void gtk_button_box_allocate (GtkCssGadget *gadget,
int baseline,
GtkAllocation *out_clip,
gpointer unused);
+static gboolean gtk_button_box_render (GtkCssGadget *gadget,
+ GtkSnapshot *snapshot,
+ int x,
+ int y,
+ int width,
+ int height,
+ gpointer data);
#define DEFAULT_LAYOUT_STYLE GTK_BUTTONBOX_EDGE
@@ -168,7 +175,7 @@ gtk_button_box_class_init (GtkButtonBoxClass *class)
widget_class->measure = gtk_button_box_measure_;
widget_class->size_allocate = gtk_button_box_size_allocate;
- widget_class->get_render_node = gtk_button_box_get_render_node;
+ widget_class->snapshot= gtk_button_box_snapshot;
container_class->remove = gtk_button_box_remove;
container_class->add = gtk_button_box_add;
@@ -203,24 +210,45 @@ gtk_button_box_class_init (GtkButtonBoxClass *class)
gtk_widget_class_set_css_name (widget_class, "buttonbox");
}
-static GskRenderNode *
-gtk_button_box_get_render_node (GtkWidget *widget,
- GskRenderer *renderer)
+static void
+gtk_button_box_snapshot_forall (GtkWidget *child,
+ gpointer snapshot)
{
- GtkButtonBoxPrivate *priv = GTK_BUTTON_BOX (widget)->priv;
- GskRenderNode *res;
+ gtk_container_snapshot_child (GTK_CONTAINER (gtk_widget_get_parent (child)),
+ child,
+ snapshot);
+}
- if (priv->layout_style == GTK_BUTTONBOX_EXPAND)
- return GTK_WIDGET_CLASS (gtk_button_box_parent_class)->get_render_node (widget, renderer);
+static gboolean
+gtk_button_box_render (GtkCssGadget *gadget,
+ GtkSnapshot *snapshot,
+ int x,
+ int y,
+ int width,
+ int height,
+ gpointer unused)
+{
+ gtk_container_forall (GTK_CONTAINER (gtk_css_gadget_get_owner (gadget)),
+ gtk_button_box_snapshot_forall,
+ snapshot);
+
+ return FALSE;
+}
- res = gtk_css_gadget_get_render_node (priv->gadget, renderer, FALSE);
- if (res == NULL)
- return NULL;
+static void
+gtk_button_box_snapshot (GtkWidget *widget,
+ GtkSnapshot *snapshot)
+{
+ GtkButtonBoxPrivate *priv = GTK_BUTTON_BOX (widget)->priv;
+ GtkCssGadget *gadget;
- gtk_container_propagate_render_node (GTK_CONTAINER (widget), renderer, res);
+ if (priv->layout_style == GTK_BUTTONBOX_EXPAND)
+ gadget = gtk_box_get_gadget (GTK_BOX (widget));
+ else
+ gadget = priv->gadget;
- return res;
+ gtk_css_gadget_snapshot (gadget, snapshot);
}
static void
@@ -236,7 +264,7 @@ gtk_button_box_init (GtkButtonBox *button_box)
gtk_button_box_measure,
gtk_button_box_allocate,
NULL,
- NULL,
+ gtk_button_box_render,
NULL,
NULL);
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]