[gtk+/wip/otte/snapshot: 28/30] snapshot: Convert box gadget
- From: Benjamin Otte <otte src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk+/wip/otte/snapshot: 28/30] snapshot: Convert box gadget
- Date: Tue, 15 Nov 2016 06:33:59 +0000 (UTC)
commit d49942f1f353d5cb807a86b2ffb8015f7f2f628b
Author: Benjamin Otte <otte redhat com>
Date: Tue Nov 15 07:06:57 2016 +0100
snapshot: Convert box gadget
Makes spinbuttons have text again!
gtk/gtkboxgadget.c | 30 ++++++++++++++++++++++++++++++
1 files changed, 30 insertions(+), 0 deletions(-)
---
diff --git a/gtk/gtkboxgadget.c b/gtk/gtkboxgadget.c
index e312a2a..555bb17 100644
--- a/gtk/gtkboxgadget.c
+++ b/gtk/gtkboxgadget.c
@@ -519,6 +519,35 @@ gtk_box_gadget_draw (GtkCssGadget *gadget,
return FALSE;
}
+static gboolean
+gtk_box_gadget_snapshot (GtkCssGadget *gadget,
+ GtkSnapshot *snapshot,
+ int x,
+ int y,
+ int width,
+ int height)
+{
+ GtkBoxGadgetPrivate *priv = gtk_box_gadget_get_instance_private (GTK_BOX_GADGET (gadget));
+ GtkWidget *owner = gtk_css_gadget_get_owner (gadget);
+ guint i;
+
+ for (i = 0; i < priv->children->len; i++)
+ {
+ guint draw_index = priv->draw_reverse ? priv->children->len - 1 - i : i;
+ GtkBoxGadgetChild *child = &g_array_index (priv->children, GtkBoxGadgetChild, draw_index);
+
+ if (GTK_IS_WIDGET (child->object))
+ gtk_container_snapshot_child (GTK_CONTAINER (owner), GTK_WIDGET (child->object), snapshot);
+ else
+ gtk_css_gadget_snapshot (GTK_CSS_GADGET (child->object), snapshot);
+ }
+
+ if (priv->draw_focus && gtk_widget_has_visible_focus (owner))
+ return TRUE;
+
+ return FALSE;
+}
+
static GskRenderNode *
gtk_box_gadget_get_render_node (GtkCssGadget *gadget,
GskRenderer *renderer,
@@ -576,6 +605,7 @@ gtk_box_gadget_class_init (GtkBoxGadgetClass *klass)
gadget_class->get_preferred_size = gtk_box_gadget_get_preferred_size;
gadget_class->allocate = gtk_box_gadget_allocate;
gadget_class->draw = gtk_box_gadget_draw;
+ gadget_class->snapshot = gtk_box_gadget_snapshot;
gadget_class->get_render_node = gtk_box_gadget_get_render_node;
gadget_class->has_content = gtk_box_gadget_has_content;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]