#include <math.h>
#include "gtkborderimageprivate.h"
+#include "gtkstylepropertiesprivate.h"
/* this is in case round() is not provided by the compiler,
* such as in the case of C89 compilers, like MSVC
void
_gtk_border_image_pack (GValue *value,
GtkStyleProperties *props,
- GtkStateFlags state)
+ GtkStateFlags state,
+ GtkStylePropertyContext *context)
{
GtkBorderImage *image;
cairo_pattern_t *source;
GtkBorder *slice, *width;
GtkCssBorderImageRepeat *repeat;
- gtk_style_properties_get (props, state,
- "border-image-source", &source,
- "border-image-slice", &slice,
- "border-image-repeat", &repeat,
- "border-image-width", &width,
- NULL);
+ _gtk_style_properties_get (props, state, context,
+ "border-image-source", &source,
+ "border-image-slice", &slice,
+ "border-image-repeat", &repeat,
+ "border-image-width", &width,
+ NULL);
if (source == NULL)
{
#include "gtkstyleproperties.h"
#include "gtkthemingengine.h"
#include "gtkcsstypesprivate.h"
+#include "gtkstylecontextprivate.h"
G_BEGIN_DECLS
guint *n_params);
void _gtk_border_image_pack (GValue *value,
GtkStyleProperties *props,
- GtkStateFlags state);
+ GtkStateFlags state,
+ GtkStylePropertyContext *context);
G_END_DECLS
gtk_style_properties_get_property (data->store, property, state, value);
}
+void
+_gtk_style_context_get_valist (GtkStyleContext *context,
+ GtkStateFlags state,
+ GtkStylePropertyContext *property_context,
+ va_list args)
+{
+ GtkStyleContextPrivate *priv;
+ StyleData *data;
+
+ g_return_if_fail (GTK_IS_STYLE_CONTEXT (context));
+
+ priv = context->priv;
+ g_return_if_fail (priv->widget_path != NULL);
+
+ data = style_data_lookup (context);
+ _gtk_style_properties_get_valist (data->store, state, property_context, args);
+}
+
/**
* gtk_style_context_get_valist:
* @context: a #GtkStyleContext
G_BEGIN_DECLS
-
+typedef struct _GtkStylePropertyContext GtkStylePropertyContext;
+struct _GtkStylePropertyContext
+{
+ int width;
+ int height;
+};
+
+void _gtk_style_context_get_valist (GtkStyleContext *context,
+ GtkStateFlags state,
+ GtkStylePropertyContext *property_context,
+ va_list args);
const GValue * _gtk_style_context_peek_style_property (GtkStyleContext *context,
GType widget_type,
GtkStateFlags state,
_gtk_style_properties_peek_property (GtkStyleProperties *props,
const gchar *prop_name,
GtkStateFlags state,
+ GtkStylePropertyContext *context,
const GtkStyleProperty **property)
{
GtkStylePropertiesPrivate *priv;
if (val == NULL)
return NULL;
- _gtk_style_property_resolve (node, props, state, val);
+ _gtk_style_property_resolve (node, props, state, context, val);
return val;
}
-/**
- * gtk_style_properties_get_property:
- * @props: a #GtkStyleProperties
- * @property: style property name
- * @state: state to retrieve the property value for
- * @value: (out) (transfer full): return location for the style property value.
- *
- * Gets a style property from @props for the given state. When done with @value,
- * g_value_unset() needs to be called to free any allocated memory.
- *
- * Returns: %TRUE if the property exists in @props, %FALSE otherwise
- *
- * Since: 3.0
- **/
gboolean
-gtk_style_properties_get_property (GtkStyleProperties *props,
- const gchar *property,
- GtkStateFlags state,
- GValue *value)
+_gtk_style_properties_get_property (GtkStyleProperties *props,
+ const gchar *property,
+ GtkStateFlags state,
+ GtkStylePropertyContext *context,
+ GValue *value)
{
const GtkStyleProperty *node;
const GValue *val;
g_return_val_if_fail (property != NULL, FALSE);
g_return_val_if_fail (value != NULL, FALSE);
- val = _gtk_style_properties_peek_property (props, property, state, &node);
+ val = _gtk_style_properties_peek_property (props, property, state, context, &node);
if (!node)
return FALSE;
if (val)
g_value_copy (val, value);
else if (_gtk_style_property_is_shorthand (node))
- _gtk_style_property_pack (node, props, state, value);
+ _gtk_style_property_pack (node, props, state, context, value);
else
_gtk_style_property_default_value (node, props, state, value);
}
/**
- * gtk_style_properties_get_valist:
+ * gtk_style_properties_get_property:
* @props: a #GtkStyleProperties
- * @state: state to retrieve the property values for
- * @args: va_list of property name/return location pairs, followed by %NULL
+ * @property: style property name
+ * @state: state to retrieve the property value for
+ * @value: (out) (transfer full): return location for the style property value.
*
- * Retrieves several style property values from @props for a given state.
+ * Gets a style property from @props for the given state. When done with @value,
+ * g_value_unset() needs to be called to free any allocated memory.
+ *
+ * Returns: %TRUE if the property exists in @props, %FALSE otherwise
*
* Since: 3.0
**/
+gboolean
+gtk_style_properties_get_property (GtkStyleProperties *props,
+ const gchar *property,
+ GtkStateFlags state,
+ GValue *value)
+{
+ GtkStylePropertyContext context = { 100, 100};
+
+ g_return_val_if_fail (GTK_IS_STYLE_PROPERTIES (props), FALSE);
+ g_return_val_if_fail (property != NULL, FALSE);
+ g_return_val_if_fail (value != NULL, FALSE);
+
+ return _gtk_style_properties_get_property (props,
+ property,
+ state, &context, value);
+}
+
void
-gtk_style_properties_get_valist (GtkStyleProperties *props,
- GtkStateFlags state,
- va_list args)
+_gtk_style_properties_get_valist (GtkStyleProperties *props,
+ GtkStateFlags state,
+ GtkStylePropertyContext *context,
+ va_list args)
{
const gchar *property_name;
gchar *error = NULL;
const GValue *val;
- val = _gtk_style_properties_peek_property (props, property_name, state, &node);
+ val = _gtk_style_properties_peek_property (props, property_name, state, context, &node);
if (!node)
break;
GValue packed = G_VALUE_INIT;
g_value_init (&packed, node->pspec->value_type);
- _gtk_style_property_pack (node, props, state, &packed);
+ _gtk_style_property_pack (node, props, state, context, &packed);
G_VALUE_LCOPY (&packed, args, 0, &error);
g_value_unset (&packed);
}
}
}
+/**
+ * gtk_style_properties_get_valist:
+ * @props: a #GtkStyleProperties
+ * @state: state to retrieve the property values for
+ * @args: va_list of property name/return location pairs, followed by %NULL
+ *
+ * Retrieves several style property values from @props for a given state.
+ *
+ * Since: 3.0
+ **/
+void
+gtk_style_properties_get_valist (GtkStyleProperties *props,
+ GtkStateFlags state,
+ va_list args)
+{
+ GtkStylePropertyContext context = { 100, 100};
+
+ return _gtk_style_properties_get_valist (props, state, &context, args);
+}
+
+void
+_gtk_style_properties_get (GtkStyleProperties *props,
+ GtkStateFlags state,
+ GtkStylePropertyContext *context,
+ ...)
+{
+ va_list args;
+
+ g_return_if_fail (GTK_IS_STYLE_PROPERTIES (props));
+
+ va_start (args, context);
+ _gtk_style_properties_get_valist (props, state, context, args);
+ va_end (args);
+}
+
/**
* gtk_style_properties_get:
* @props: a #GtkStyleProperties
#include "gtkstyleproperties.h"
#include "gtkstylepropertyprivate.h"
+#include "gtkstylecontextprivate.h"
G_BEGIN_DECLS
const GValue * _gtk_style_properties_peek_property (GtkStyleProperties *props,
const gchar *prop_name,
GtkStateFlags state,
+ GtkStylePropertyContext *context,
const GtkStyleProperty **property);
+void _gtk_style_properties_get (GtkStyleProperties *props,
+ GtkStateFlags state,
+ GtkStylePropertyContext *context,
+ ...);
+void _gtk_style_properties_get_valist (GtkStyleProperties *props,
+ GtkStateFlags state,
+ GtkStylePropertyContext *context,
+ va_list args);
+
+const GValue * _gtk_style_properties_resolve_property (GtkStyleProperties *props,
+ const gchar *prop_name,
+ GtkStateFlags state,
+ const GtkStyleProperty **property,
+ GtkStylePropertyContext *context,
+ GValue *value);
void _gtk_style_properties_set_property_by_property (GtkStyleProperties *props,
const GtkStyleProperty *property,
static void
pack_border_width (GValue *value,
GtkStyleProperties *props,
- GtkStateFlags state)
+ GtkStateFlags state,
+ GtkStylePropertyContext *context)
{
pack_border (value, props, state,
"border-top-width", "border-left-width",
static void
pack_padding (GValue *value,
GtkStyleProperties *props,
- GtkStateFlags state)
+ GtkStateFlags state,
+ GtkStylePropertyContext *context)
{
pack_border (value, props, state,
"padding-top", "padding-left",
static void
pack_margin (GValue *value,
GtkStyleProperties *props,
- GtkStateFlags state)
+ GtkStateFlags state,
+ GtkStylePropertyContext *context)
{
pack_border (value, props, state,
"margin-top", "margin-left",
static void
pack_border_radius (GValue *value,
GtkStyleProperties *props,
- GtkStateFlags state)
+ GtkStateFlags state,
+ GtkStylePropertyContext *context)
{
GtkCssBorderCornerRadius *top_left;
static void
pack_font_description (GValue *value,
GtkStyleProperties *props,
- GtkStateFlags state)
+ GtkStateFlags state,
+ GtkStylePropertyContext *context)
{
PangoFontDescription *description;
char **families;
static void
pack_border_color (GValue *value,
GtkStyleProperties *props,
- GtkStateFlags state)
+ GtkStateFlags state,
+ GtkStylePropertyContext *context)
{
/* NB: We are a color property, so we have to resolve to a color here.
* So we just resolve to a color. We pick one and stick to it.
_gtk_style_property_resolve (const GtkStyleProperty *property,
GtkStyleProperties *props,
GtkStateFlags state,
+ GtkStylePropertyContext *context,
GValue *val)
{
if (G_VALUE_TYPE (val) == GTK_TYPE_SYMBOLIC_COLOR)
_gtk_style_property_pack (const GtkStyleProperty *property,
GtkStyleProperties *props,
GtkStateFlags state,
+ GtkStylePropertyContext *context,
GValue *value)
{
g_return_if_fail (property != NULL);
g_return_if_fail (GTK_IS_STYLE_PROPERTIES (props));
g_return_if_fail (G_IS_VALUE (value));
- property->pack_func (value, props, state);
+ property->pack_func (value, props, state, context);
}
static void
#define __GTK_STYLEPROPERTY_PRIVATE_H__
#include "gtkcssparserprivate.h"
+#include "gtkstylecontextprivate.h"
G_BEGIN_DECLS
guint *n_params);
typedef void (* GtkStylePackFunc) (GValue *value,
GtkStyleProperties *props,
- GtkStateFlags state);
+ GtkStateFlags state,
+ GtkStylePropertyContext *context);
typedef gboolean (* GtkStyleParseFunc) (GtkCssParser *parser,
GFile *base,
GValue *value);
void _gtk_style_property_resolve (const GtkStyleProperty *property,
GtkStyleProperties *properties,
GtkStateFlags state,
- GValue *value);
+ GtkStylePropertyContext *context,
+ GValue *orig_value);
gboolean _gtk_style_property_is_shorthand (const GtkStyleProperty *property);
GParameter * _gtk_style_property_unpack (const GtkStyleProperty *property,
void _gtk_style_property_pack (const GtkStyleProperty *property,
GtkStyleProperties *props,
GtkStateFlags state,
+ GtkStylePropertyContext *context,
GValue *value);
gboolean _gtk_style_property_parse_value (const GtkStyleProperty *property,
gtk_style_context_get_valist (priv->context, state, args);
}
+void
+_gtk_theming_engine_get (GtkThemingEngine *engine,
+ GtkStateFlags state,
+ GtkStylePropertyContext *property_context,
+ ...)
+{
+ GtkThemingEnginePrivate *priv;
+ va_list args;
+
+ g_return_if_fail (GTK_IS_THEMING_ENGINE (engine));
+
+ priv = engine->priv;
+
+ va_start (args, property_context);
+ _gtk_style_context_get_valist (priv->context, state, property_context, args);
+ va_end (args);
+}
+
+
/**
* gtk_theming_engine_get:
* @engine: a #GtkThemingEngine
#define __GTK_THEMING_ENGINE_PRIVATE_H__
#include <gdk/gdk.h>
+#include "gtkstylecontextprivate.h"
+
+void _gtk_theming_engine_get (GtkThemingEngine *engine,
+ GtkStateFlags state,
+ GtkStylePropertyContext *property_context,
+ ...) G_GNUC_NULL_TERMINATED;
+
void _gtk_theming_engine_paint_spinner (cairo_t *cr,
gdouble radius,