Commit 4cc1fe5b authored by Alexander Larsson's avatar Alexander Larsson

GtkStyleContext: Add gtk_style_context_get/set_scale

parent 6cc5d297
......@@ -364,6 +364,7 @@ struct _GtkStyleContextPrivate
GtkWidgetPath *widget_path;
GHashTable *style_data;
GtkStyleInfo *info;
gint scale;
GdkFrameClock *frame_clock;
guint frame_clock_update_id;
......@@ -997,6 +998,7 @@ build_properties (GtkStyleContext *context,
_gtk_css_lookup_resolve (lookup,
GTK_STYLE_PROVIDER_PRIVATE (priv->cascade),
priv->scale,
values,
priv->parent ? style_data_lookup (priv->parent)->store : NULL);
......@@ -1527,6 +1529,47 @@ gtk_style_context_get_state (GtkStyleContext *context)
return context->priv->info->state_flags;
}
/**
* gtk_style_context_set_scale:
* @context: a #GtkStyleContext
* @scale: scale
*
* Sets the scale to use when getting image assets for the style .
*
* Since: 3.10
**/
void
gtk_style_context_set_scale (GtkStyleContext *context,
gint scale)
{
g_return_if_fail (GTK_IS_STYLE_CONTEXT (context));
if (context->priv->scale == scale)
return;
context->priv->scale = scale;
gtk_style_context_queue_invalidate_internal (context, GTK_CSS_CHANGE_SOURCE);
}
/**
* gtk_style_context_get_scale:
* @context: a #GtkStyleContext
*
* Returns the scale used for assets.
*
* Returns: the scale
*
* Since: 3.10
**/
gint
gtk_style_context_get_scale (GtkStyleContext *context)
{
g_return_val_if_fail (GTK_IS_STYLE_CONTEXT (context), 0);
return context->priv->scale;
}
/**
* gtk_style_context_state_is_running:
* @context: a #GtkStyleContext
......
......@@ -817,6 +817,12 @@ void gtk_style_context_set_state (GtkStyleContext *context,
GDK_AVAILABLE_IN_ALL
GtkStateFlags gtk_style_context_get_state (GtkStyleContext *context);
GDK_AVAILABLE_IN_3_10
void gtk_style_context_set_scale (GtkStyleContext *context,
gint scale);
GDK_AVAILABLE_IN_3_10
gint gtk_style_context_get_scale (GtkStyleContext *context);
GDK_DEPRECATED_IN_3_6
gboolean gtk_style_context_state_is_running (GtkStyleContext *context,
GtkStateType state,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment