gadget: Add a get_render_node vfunc

This will let us do box gadgets like we do containers.
This commit is contained in:
Matthias Clasen 2016-10-28 12:55:33 -04:00
parent 3656c9f94c
commit 30a56acc7d
2 changed files with 21 additions and 4 deletions

View File

@ -261,6 +261,10 @@ gtk_css_gadget_has_content (GtkCssGadget *gadget)
return gadget_class->draw != gtk_css_gadget_real_draw; return gadget_class->draw != gtk_css_gadget_real_draw;
} }
static GskRenderNode * gtk_css_gadget_real_get_render_node (GtkCssGadget *gadget,
GskRenderer *renderer,
gboolean draw_focus);
static void static void
gtk_css_gadget_class_init (GtkCssGadgetClass *klass) gtk_css_gadget_class_init (GtkCssGadgetClass *klass)
{ {
@ -273,6 +277,7 @@ gtk_css_gadget_class_init (GtkCssGadgetClass *klass)
klass->get_preferred_size = gtk_css_gadget_real_get_preferred_size; klass->get_preferred_size = gtk_css_gadget_real_get_preferred_size;
klass->allocate = gtk_css_gadget_real_allocate; klass->allocate = gtk_css_gadget_real_allocate;
klass->draw = gtk_css_gadget_real_draw; klass->draw = gtk_css_gadget_real_draw;
klass->get_render_node = gtk_css_gadget_real_get_render_node;
klass->style_changed = gtk_css_gadget_real_style_changed; klass->style_changed = gtk_css_gadget_real_style_changed;
klass->has_content = gtk_css_gadget_has_content; klass->has_content = gtk_css_gadget_has_content;
@ -812,8 +817,8 @@ gtk_css_gadget_allocate (GtkCssGadget *gadget,
priv->clip = *out_clip; priv->clip = *out_clip;
} }
GskRenderNode * static GskRenderNode *
gtk_css_gadget_get_render_node (GtkCssGadget *gadget, gtk_css_gadget_real_get_render_node (GtkCssGadget *gadget,
GskRenderer *renderer, GskRenderer *renderer,
gboolean draw_focus) gboolean draw_focus)
{ {
@ -1112,6 +1117,14 @@ gtk_css_gadget_draw (GtkCssGadget *gadget,
#endif #endif
} }
GskRenderNode *
gtk_css_gadget_get_render_node (GtkCssGadget *gadget,
GskRenderer *renderer,
gboolean draw_focus)
{
return GTK_CSS_GADGET_GET_CLASS (gadget)->get_render_node (gadget, renderer, draw_focus);
}
void void
gtk_css_gadget_queue_resize (GtkCssGadget *gadget) gtk_css_gadget_queue_resize (GtkCssGadget *gadget)
{ {

View File

@ -68,6 +68,10 @@ struct _GtkCssGadgetClass
int width, int width,
int height); int height);
GskRenderNode * (* get_render_node) (GtkCssGadget *gadget,
GskRenderer *renderer,
gboolean draw_focus);
void (* style_changed) (GtkCssGadget *gadget, void (* style_changed) (GtkCssGadget *gadget,
GtkCssStyleChange *change); GtkCssStyleChange *change);