mirror of
https://gitlab.gnome.org/GNOME/gtk.git
synced 2024-11-17 14:30:15 +00:00
themingengine: Add a private function to query lengths
This commit is contained in:
parent
762ea4793f
commit
82c2dad178
@ -2372,6 +2372,22 @@ _gtk_style_context_peek_property (GtkStyleContext *context,
|
|||||||
return _gtk_css_computed_values_get_value_by_name (data->store, property_name);
|
return _gtk_css_computed_values_get_value_by_name (data->store, property_name);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
double
|
||||||
|
_gtk_style_context_get_number (GtkStyleContext *context,
|
||||||
|
const char *property_name,
|
||||||
|
double one_hundred_percent)
|
||||||
|
{
|
||||||
|
const GValue *value;
|
||||||
|
const GtkCssNumber *number;
|
||||||
|
|
||||||
|
value = _gtk_style_context_peek_property (context, property_name);
|
||||||
|
number = g_value_get_boxed (value);
|
||||||
|
if (number->unit == GTK_CSS_PERCENT)
|
||||||
|
return number->value * one_hundred_percent * 0.01;
|
||||||
|
else
|
||||||
|
return number->value;
|
||||||
|
}
|
||||||
|
|
||||||
const GValue *
|
const GValue *
|
||||||
_gtk_style_context_peek_style_property (GtkStyleContext *context,
|
_gtk_style_context_peek_style_property (GtkStyleContext *context,
|
||||||
GType widget_type,
|
GType widget_type,
|
||||||
|
@ -27,6 +27,9 @@ G_BEGIN_DECLS
|
|||||||
|
|
||||||
const GValue * _gtk_style_context_peek_property (GtkStyleContext *context,
|
const GValue * _gtk_style_context_peek_property (GtkStyleContext *context,
|
||||||
const char *property_name);
|
const char *property_name);
|
||||||
|
double _gtk_style_context_get_number (GtkStyleContext *context,
|
||||||
|
const char *property_name,
|
||||||
|
double one_hundred_percent);
|
||||||
const GValue * _gtk_style_context_peek_style_property (GtkStyleContext *context,
|
const GValue * _gtk_style_context_peek_style_property (GtkStyleContext *context,
|
||||||
GType widget_type,
|
GType widget_type,
|
||||||
GtkStateFlags state,
|
GtkStateFlags state,
|
||||||
|
@ -340,6 +340,17 @@ _gtk_theming_engine_peek_property (GtkThemingEngine *engine,
|
|||||||
return _gtk_style_context_peek_property (engine->priv->context, property_name);
|
return _gtk_style_context_peek_property (engine->priv->context, property_name);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
double
|
||||||
|
_gtk_theming_engine_get_number (GtkThemingEngine *engine,
|
||||||
|
const char *property_name,
|
||||||
|
double one_hundred_percent)
|
||||||
|
{
|
||||||
|
g_return_val_if_fail (GTK_IS_THEMING_ENGINE (engine), 0.0);
|
||||||
|
g_return_val_if_fail (property_name != NULL, 0.0);
|
||||||
|
|
||||||
|
return _gtk_style_context_get_number (engine->priv->context, property_name, one_hundred_percent);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* gtk_theming_engine_get_property:
|
* gtk_theming_engine_get_property:
|
||||||
* @engine: a #GtkThemingEngine
|
* @engine: a #GtkThemingEngine
|
||||||
|
@ -30,5 +30,8 @@ void _gtk_theming_engine_paint_spinner (cairo_t *cr,
|
|||||||
|
|
||||||
const GValue *_gtk_theming_engine_peek_property (GtkThemingEngine *engine,
|
const GValue *_gtk_theming_engine_peek_property (GtkThemingEngine *engine,
|
||||||
const char *property_name);
|
const char *property_name);
|
||||||
|
double _gtk_theming_engine_get_number (GtkThemingEngine *engine,
|
||||||
|
const char *property_name,
|
||||||
|
double one_hundred_percent);
|
||||||
|
|
||||||
#endif /* __GTK_THEMING_ENGINE_PRIVATE_H__ */
|
#endif /* __GTK_THEMING_ENGINE_PRIVATE_H__ */
|
||||||
|
Loading…
Reference in New Issue
Block a user