mirror of
https://gitlab.gnome.org/GNOME/gtk.git
synced 2024-11-10 19:00:08 +00:00
API: Remove GtkStyleProperties
This commit is contained in:
parent
dd83f9ca86
commit
1a5b842682
@ -5644,34 +5644,6 @@ GTK_STYLE_PROVIDER_GET_IFACE
|
||||
gtk_style_provider_get_type
|
||||
</SECTION>
|
||||
|
||||
<SECTION>
|
||||
<FILE>gtkstyleproperties</FILE>
|
||||
<TITLE>GtkStyleProperties</TITLE>
|
||||
GtkStyleProperties
|
||||
gtk_style_properties_clear
|
||||
gtk_style_properties_get
|
||||
gtk_style_properties_get_property
|
||||
gtk_style_properties_get_valist
|
||||
gtk_style_properties_lookup_color
|
||||
gtk_style_properties_lookup_property
|
||||
gtk_style_properties_map_color
|
||||
gtk_style_properties_merge
|
||||
gtk_style_properties_new
|
||||
GtkStylePropertyParser
|
||||
gtk_style_properties_register_property
|
||||
gtk_style_properties_unset_property
|
||||
<SUBSECTION Standard>
|
||||
GTK_TYPE_STYLE_PROPERTIES
|
||||
GTK_IS_STYLE_PROPERTIES
|
||||
GTK_IS_STYLE_PROPERTIES_CLASS
|
||||
GTK_STYLE_PROPERTIES
|
||||
GTK_STYLE_PROPERTIES_CLASS
|
||||
GTK_STYLE_PROPERTIES_GET_CLASS
|
||||
<SUBSECTION Private>
|
||||
GtkStylePropertiesPrivate
|
||||
gtk_style_properties_get_type
|
||||
</SECTION>
|
||||
|
||||
<SECTION>
|
||||
<FILE>gtkstylecontext</FILE>
|
||||
<TITLE>GtkStyleContext</TITLE>
|
||||
|
@ -7,7 +7,6 @@ deprecated_h_sources = \
|
||||
deprecated/gtkradioaction.h \
|
||||
deprecated/gtkrecentaction.h \
|
||||
deprecated/gtkstock.h \
|
||||
deprecated/gtkstyleproperties.h \
|
||||
deprecated/gtksymboliccolor.h \
|
||||
deprecated/gtktable.h \
|
||||
deprecated/gtktoggleaction.h \
|
||||
@ -26,7 +25,6 @@ deprecated_c_sources = \
|
||||
deprecated/gtkradioaction.c \
|
||||
deprecated/gtkrecentaction.c \
|
||||
deprecated/gtkstock.c \
|
||||
deprecated/gtkstyleproperties.c \
|
||||
deprecated/gtksymboliccolor.c \
|
||||
deprecated/gtktable.c \
|
||||
deprecated/gtktoggleaction.c \
|
||||
|
@ -23,7 +23,6 @@
|
||||
#include "gtkcsscolorvalueprivate.h"
|
||||
#include "gtkcssrgbavalueprivate.h"
|
||||
#include "gtkstylecontextprivate.h"
|
||||
#include "gtkstyleproperties.h"
|
||||
#include "gtksymboliccolorprivate.h"
|
||||
|
||||
/**
|
||||
@ -241,67 +240,6 @@ gtk_gradient_unref (GtkGradient *gradient)
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* gtk_gradient_resolve:
|
||||
* @gradient: a #GtkGradient
|
||||
* @props: #GtkStyleProperties to use when resolving named colors
|
||||
* @resolved_gradient: (out): return location for the resolved pattern
|
||||
*
|
||||
* If @gradient is resolvable, @resolved_gradient will be filled in
|
||||
* with the resolved gradient as a cairo_pattern_t, and %TRUE will
|
||||
* be returned. Generally, if @gradient can’t be resolved, it is
|
||||
* due to it being defined on top of a named color that doesn't
|
||||
* exist in @props.
|
||||
*
|
||||
* Returns: %TRUE if the gradient has been resolved
|
||||
*
|
||||
* Since: 3.0
|
||||
*
|
||||
* Deprecated: 3.8: #GtkGradient is deprecated.
|
||||
**/
|
||||
gboolean
|
||||
gtk_gradient_resolve (GtkGradient *gradient,
|
||||
GtkStyleProperties *props,
|
||||
cairo_pattern_t **resolved_gradient)
|
||||
{
|
||||
cairo_pattern_t *pattern;
|
||||
guint i;
|
||||
|
||||
g_return_val_if_fail (gradient != NULL, FALSE);
|
||||
g_return_val_if_fail (GTK_IS_STYLE_PROPERTIES (props), FALSE);
|
||||
g_return_val_if_fail (resolved_gradient != NULL, FALSE);
|
||||
|
||||
if (gradient->radius0 == 0 && gradient->radius1 == 0)
|
||||
pattern = cairo_pattern_create_linear (gradient->x0, gradient->y0,
|
||||
gradient->x1, gradient->y1);
|
||||
else
|
||||
pattern = cairo_pattern_create_radial (gradient->x0, gradient->y0,
|
||||
gradient->radius0,
|
||||
gradient->x1, gradient->y1,
|
||||
gradient->radius1);
|
||||
|
||||
for (i = 0; i < gradient->stops->len; i++)
|
||||
{
|
||||
ColorStop *stop;
|
||||
GdkRGBA color;
|
||||
|
||||
stop = &g_array_index (gradient->stops, ColorStop, i);
|
||||
|
||||
if (!gtk_symbolic_color_resolve (stop->color, props, &color))
|
||||
{
|
||||
cairo_pattern_destroy (pattern);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
cairo_pattern_add_color_stop_rgba (pattern, stop->offset,
|
||||
color.red, color.green,
|
||||
color.blue, color.alpha);
|
||||
}
|
||||
|
||||
*resolved_gradient = pattern;
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
cairo_pattern_t *
|
||||
_gtk_gradient_resolve_full (GtkGradient *gradient,
|
||||
GtkStyleProviderPrivate *provider,
|
||||
|
@ -23,12 +23,12 @@
|
||||
#endif
|
||||
|
||||
#include <gdk/gdk.h>
|
||||
#include <gtk/gtkstylecontext.h>
|
||||
#include <gtk/deprecated/gtkstyleproperties.h>
|
||||
#include <gtk/deprecated/gtksymboliccolor.h>
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
typedef struct _GtkGradient GtkGradient;
|
||||
|
||||
#define GTK_TYPE_GRADIENT (gtk_gradient_get_type ())
|
||||
|
||||
GDK_DEPRECATED_IN_3_8
|
||||
@ -57,16 +57,6 @@ GtkGradient * gtk_gradient_ref (GtkGradient *gradient);
|
||||
GDK_DEPRECATED_IN_3_8
|
||||
void gtk_gradient_unref (GtkGradient *gradient);
|
||||
|
||||
GDK_DEPRECATED_IN_3_8
|
||||
gboolean gtk_gradient_resolve (GtkGradient *gradient,
|
||||
GtkStyleProperties *props,
|
||||
cairo_pattern_t **resolved_gradient);
|
||||
GDK_DEPRECATED_IN_3_8
|
||||
cairo_pattern_t *
|
||||
gtk_gradient_resolve_for_context
|
||||
(GtkGradient *gradient,
|
||||
GtkStyleContext *context);
|
||||
|
||||
GDK_DEPRECATED_IN_3_8
|
||||
char * gtk_gradient_to_string (GtkGradient *gradient);
|
||||
|
||||
|
@ -1,790 +0,0 @@
|
||||
/* GTK - The GIMP Toolkit
|
||||
* Copyright (C) 2010 Carlos Garnacho <carlosg@gnome.org>
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include "config.h"
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <gobject/gvaluecollector.h>
|
||||
#include <cairo-gobject.h>
|
||||
|
||||
#include "gtkstyleprovider.h"
|
||||
#include "gtkcssshorthandpropertyprivate.h"
|
||||
#include "gtkcsstypedvalueprivate.h"
|
||||
#include "gtkcsstypesprivate.h"
|
||||
|
||||
#include "gtkprivatetypebuiltins.h"
|
||||
#include "gtkstylepropertyprivate.h"
|
||||
#include "gtkstyleproviderprivate.h"
|
||||
#include "gtkintl.h"
|
||||
|
||||
#include "deprecated/gtkgradient.h"
|
||||
#include "deprecated/gtksymboliccolorprivate.h"
|
||||
|
||||
G_GNUC_BEGIN_IGNORE_DEPRECATIONS;
|
||||
|
||||
/**
|
||||
* SECTION:gtkstyleproperties
|
||||
* @Short_description: Store for style property information
|
||||
* @Title: GtkStyleProperties
|
||||
*
|
||||
* GtkStyleProperties provides the storage for style information
|
||||
* that is used by #GtkStyleContext and other #GtkStyleProvider
|
||||
* implementations.
|
||||
*
|
||||
* Before style properties can be stored in GtkStyleProperties, they
|
||||
* must be registered with gtk_style_properties_register_property().
|
||||
*
|
||||
* Unless you are writing a #GtkStyleProvider implementation, you
|
||||
* are unlikely to use this API directly, as gtk_style_context_get()
|
||||
* and its variants are the preferred way to access styling information
|
||||
* from widget implementations and theming engine implementations
|
||||
* should use the APIs provided by #GtkThemingEngine instead.
|
||||
*
|
||||
* #GtkStyleProperties has been deprecated in GTK 3.16. The CSS
|
||||
* machinery does not use it anymore and all users of this object
|
||||
* have been deprecated.
|
||||
*/
|
||||
|
||||
typedef struct PropertyData PropertyData;
|
||||
typedef struct ValueData ValueData;
|
||||
|
||||
struct ValueData
|
||||
{
|
||||
GtkStateFlags state;
|
||||
GtkCssValue *value;
|
||||
};
|
||||
|
||||
struct PropertyData
|
||||
{
|
||||
GArray *values;
|
||||
};
|
||||
|
||||
struct _GtkStylePropertiesPrivate
|
||||
{
|
||||
GHashTable *color_map;
|
||||
GHashTable *properties;
|
||||
};
|
||||
|
||||
static void gtk_style_properties_provider_init (GtkStyleProviderIface *iface);
|
||||
static void gtk_style_properties_provider_private_init (GtkStyleProviderPrivateInterface *iface);
|
||||
static void gtk_style_properties_finalize (GObject *object);
|
||||
|
||||
|
||||
G_DEFINE_TYPE_WITH_CODE (GtkStyleProperties, gtk_style_properties, G_TYPE_OBJECT,
|
||||
G_ADD_PRIVATE (GtkStyleProperties)
|
||||
G_IMPLEMENT_INTERFACE (GTK_TYPE_STYLE_PROVIDER,
|
||||
gtk_style_properties_provider_init)
|
||||
G_IMPLEMENT_INTERFACE (GTK_TYPE_STYLE_PROVIDER_PRIVATE,
|
||||
gtk_style_properties_provider_private_init));
|
||||
|
||||
static void
|
||||
gtk_style_properties_class_init (GtkStylePropertiesClass *klass)
|
||||
{
|
||||
GObjectClass *object_class = G_OBJECT_CLASS (klass);
|
||||
|
||||
object_class->finalize = gtk_style_properties_finalize;
|
||||
}
|
||||
|
||||
static PropertyData *
|
||||
property_data_new (void)
|
||||
{
|
||||
PropertyData *data;
|
||||
|
||||
data = g_slice_new0 (PropertyData);
|
||||
data->values = g_array_new (FALSE, FALSE, sizeof (ValueData));
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
static void
|
||||
property_data_remove_values (PropertyData *data)
|
||||
{
|
||||
guint i;
|
||||
|
||||
for (i = 0; i < data->values->len; i++)
|
||||
{
|
||||
ValueData *value_data;
|
||||
|
||||
value_data = &g_array_index (data->values, ValueData, i);
|
||||
|
||||
_gtk_css_value_unref (value_data->value);
|
||||
value_data->value = NULL;
|
||||
}
|
||||
|
||||
if (data->values->len > 0)
|
||||
g_array_remove_range (data->values, 0, data->values->len);
|
||||
}
|
||||
|
||||
static void
|
||||
property_data_free (PropertyData *data)
|
||||
{
|
||||
property_data_remove_values (data);
|
||||
g_array_free (data->values, TRUE);
|
||||
g_slice_free (PropertyData, data);
|
||||
}
|
||||
|
||||
static gboolean
|
||||
property_data_find_position (PropertyData *data,
|
||||
GtkStateFlags state,
|
||||
guint *pos)
|
||||
{
|
||||
gint min, max, mid;
|
||||
gboolean found = FALSE;
|
||||
guint position;
|
||||
|
||||
if (pos)
|
||||
*pos = 0;
|
||||
|
||||
if (data->values->len == 0)
|
||||
return FALSE;
|
||||
|
||||
/* Find position for the given state, or the position where
|
||||
* it would be if not found, the array is ordered by the
|
||||
* state flags.
|
||||
*/
|
||||
min = 0;
|
||||
max = data->values->len - 1;
|
||||
|
||||
do
|
||||
{
|
||||
ValueData *value_data;
|
||||
|
||||
mid = (min + max) / 2;
|
||||
value_data = &g_array_index (data->values, ValueData, mid);
|
||||
|
||||
if (value_data->state == state)
|
||||
{
|
||||
found = TRUE;
|
||||
position = mid;
|
||||
}
|
||||
else if (value_data->state < state)
|
||||
position = min = mid + 1;
|
||||
else
|
||||
{
|
||||
max = mid - 1;
|
||||
position = mid;
|
||||
}
|
||||
}
|
||||
while (!found && min <= max);
|
||||
|
||||
if (pos)
|
||||
*pos = position;
|
||||
|
||||
return found;
|
||||
}
|
||||
|
||||
static ValueData *
|
||||
property_data_get_value (PropertyData *data,
|
||||
GtkStateFlags state)
|
||||
{
|
||||
guint pos;
|
||||
|
||||
if (!property_data_find_position (data, state, &pos))
|
||||
{
|
||||
ValueData new = { 0 };
|
||||
|
||||
new.state = state;
|
||||
g_array_insert_val (data->values, pos, new);
|
||||
}
|
||||
|
||||
return &g_array_index (data->values, ValueData, pos);
|
||||
}
|
||||
|
||||
static GtkCssValue *
|
||||
property_data_match_state (PropertyData *data,
|
||||
GtkStateFlags state)
|
||||
{
|
||||
guint pos;
|
||||
gint i;
|
||||
|
||||
if (property_data_find_position (data, state, &pos))
|
||||
{
|
||||
ValueData *val_data;
|
||||
|
||||
/* Exact match */
|
||||
val_data = &g_array_index (data->values, ValueData, pos);
|
||||
return val_data->value;
|
||||
}
|
||||
|
||||
if (pos >= data->values->len)
|
||||
pos = data->values->len - 1;
|
||||
|
||||
/* No exact match, go downwards the list to find
|
||||
* the closest match to the given state flags, as
|
||||
* a side effect, there is an implicit precedence
|
||||
* of higher flags over the smaller ones.
|
||||
*/
|
||||
for (i = pos; i >= 0; i--)
|
||||
{
|
||||
ValueData *val_data;
|
||||
|
||||
val_data = &g_array_index (data->values, ValueData, i);
|
||||
|
||||
/* Check whether any of the requested
|
||||
* flags are set, and no other flags are.
|
||||
*
|
||||
* Also, no flags acts as a wildcard, such
|
||||
* value should be always in the first position
|
||||
* in the array (if present) anyways.
|
||||
*/
|
||||
if (val_data->state == 0 ||
|
||||
((val_data->state & state) != 0 &&
|
||||
(val_data->state & ~state) == 0))
|
||||
return val_data->value;
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_style_properties_init (GtkStyleProperties *props)
|
||||
{
|
||||
props->priv = gtk_style_properties_get_instance_private (props);
|
||||
props->priv->properties = g_hash_table_new_full (NULL, NULL, NULL,
|
||||
(GDestroyNotify) property_data_free);
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_style_properties_finalize (GObject *object)
|
||||
{
|
||||
GtkStylePropertiesPrivate *priv;
|
||||
GtkStyleProperties *props;
|
||||
|
||||
props = GTK_STYLE_PROPERTIES (object);
|
||||
priv = props->priv;
|
||||
g_hash_table_destroy (priv->properties);
|
||||
|
||||
if (priv->color_map)
|
||||
g_hash_table_destroy (priv->color_map);
|
||||
|
||||
G_OBJECT_CLASS (gtk_style_properties_parent_class)->finalize (object);
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_style_properties_provider_init (GtkStyleProviderIface *iface)
|
||||
{
|
||||
}
|
||||
|
||||
static GtkCssValue *
|
||||
gtk_style_properties_provider_get_color (GtkStyleProviderPrivate *provider,
|
||||
const char *name)
|
||||
{
|
||||
GtkSymbolicColor *symbolic;
|
||||
|
||||
symbolic = gtk_style_properties_lookup_color (GTK_STYLE_PROPERTIES (provider), name);
|
||||
if (symbolic == NULL)
|
||||
return NULL;
|
||||
|
||||
return _gtk_symbolic_color_get_css_value (symbolic);
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_style_properties_provider_lookup (GtkStyleProviderPrivate *provider,
|
||||
const GtkCssMatcher *matcher,
|
||||
GtkCssLookup *lookup,
|
||||
GtkCssChange *change)
|
||||
{
|
||||
GtkStyleProperties *props;
|
||||
GtkStylePropertiesPrivate *priv;
|
||||
GHashTableIter iter;
|
||||
gpointer key, value;
|
||||
|
||||
props = GTK_STYLE_PROPERTIES (provider);
|
||||
priv = props->priv;
|
||||
|
||||
/* Merge symbolic style properties */
|
||||
g_hash_table_iter_init (&iter, priv->properties);
|
||||
|
||||
while (g_hash_table_iter_next (&iter, &key, &value))
|
||||
{
|
||||
GtkCssStyleProperty *prop = key;
|
||||
PropertyData *data = value;
|
||||
GtkCssValue *val;
|
||||
guint id;
|
||||
|
||||
id = _gtk_css_style_property_get_id (prop);
|
||||
|
||||
if (!_gtk_css_lookup_is_missing (lookup, id))
|
||||
continue;
|
||||
|
||||
val = property_data_match_state (data, _gtk_css_matcher_get_state (matcher));
|
||||
if (val == NULL)
|
||||
continue;
|
||||
|
||||
_gtk_css_lookup_set (lookup, id, NULL, val);
|
||||
}
|
||||
|
||||
if (change)
|
||||
*change = GTK_CSS_CHANGE_STATE;
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_style_properties_provider_private_init (GtkStyleProviderPrivateInterface *iface)
|
||||
{
|
||||
iface->get_color = gtk_style_properties_provider_get_color;
|
||||
iface->lookup = gtk_style_properties_provider_lookup;
|
||||
}
|
||||
|
||||
/* GtkStyleProperties methods */
|
||||
|
||||
/**
|
||||
* gtk_style_properties_new:
|
||||
*
|
||||
* Returns a newly created #GtkStyleProperties
|
||||
*
|
||||
* Returns: a new #GtkStyleProperties
|
||||
*
|
||||
* Deprecated: 3.16: #GtkStyleProperties are deprecated.
|
||||
**/
|
||||
GtkStyleProperties *
|
||||
gtk_style_properties_new (void)
|
||||
{
|
||||
return g_object_new (GTK_TYPE_STYLE_PROPERTIES, NULL);
|
||||
}
|
||||
|
||||
/**
|
||||
* gtk_style_properties_map_color:
|
||||
* @props: a #GtkStyleProperties
|
||||
* @name: color name
|
||||
* @color: #GtkSymbolicColor to map @name to
|
||||
*
|
||||
* Maps @color so it can be referenced by @name. See
|
||||
* gtk_style_properties_lookup_color()
|
||||
*
|
||||
* Since: 3.0
|
||||
*
|
||||
* Deprecated: 3.8: #GtkSymbolicColor is deprecated.
|
||||
**/
|
||||
void
|
||||
gtk_style_properties_map_color (GtkStyleProperties *props,
|
||||
const gchar *name,
|
||||
GtkSymbolicColor *color)
|
||||
{
|
||||
GtkStylePropertiesPrivate *priv;
|
||||
|
||||
g_return_if_fail (GTK_IS_STYLE_PROPERTIES (props));
|
||||
g_return_if_fail (name != NULL);
|
||||
g_return_if_fail (color != NULL);
|
||||
|
||||
priv = props->priv;
|
||||
|
||||
if (G_UNLIKELY (!priv->color_map))
|
||||
priv->color_map = g_hash_table_new_full (g_str_hash,
|
||||
g_str_equal,
|
||||
(GDestroyNotify) g_free,
|
||||
(GDestroyNotify) gtk_symbolic_color_unref);
|
||||
|
||||
g_hash_table_replace (priv->color_map,
|
||||
g_strdup (name),
|
||||
gtk_symbolic_color_ref (color));
|
||||
|
||||
_gtk_style_provider_private_changed (GTK_STYLE_PROVIDER_PRIVATE (props));
|
||||
}
|
||||
|
||||
/**
|
||||
* gtk_style_properties_lookup_color:
|
||||
* @props: a #GtkStyleProperties
|
||||
* @name: color name to lookup
|
||||
*
|
||||
* Returns the symbolic color that is mapped
|
||||
* to @name.
|
||||
*
|
||||
* Returns: (transfer none): The mapped color
|
||||
*
|
||||
* Since: 3.0
|
||||
*
|
||||
* Deprecated: 3.8: #GtkSymbolicColor is deprecated.
|
||||
**/
|
||||
GtkSymbolicColor *
|
||||
gtk_style_properties_lookup_color (GtkStyleProperties *props,
|
||||
const gchar *name)
|
||||
{
|
||||
GtkStylePropertiesPrivate *priv;
|
||||
|
||||
g_return_val_if_fail (GTK_IS_STYLE_PROPERTIES (props), NULL);
|
||||
g_return_val_if_fail (name != NULL, NULL);
|
||||
|
||||
priv = props->priv;
|
||||
|
||||
if (!priv->color_map)
|
||||
return NULL;
|
||||
|
||||
return g_hash_table_lookup (priv->color_map, name);
|
||||
}
|
||||
|
||||
typedef struct {
|
||||
GtkStyleProperties *props;
|
||||
GtkStateFlags state;
|
||||
} StyleQueryData;
|
||||
|
||||
static GtkCssValue *
|
||||
style_query_func (guint id,
|
||||
gpointer data)
|
||||
{
|
||||
StyleQueryData *query = data;
|
||||
PropertyData *prop;
|
||||
|
||||
prop = g_hash_table_lookup (query->props->priv->properties,
|
||||
_gtk_css_style_property_lookup_by_id (id));
|
||||
if (prop == NULL)
|
||||
return NULL;
|
||||
|
||||
return property_data_match_state (prop, query->state);
|
||||
}
|
||||
|
||||
/**
|
||||
* 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
|
||||
*
|
||||
* Deprecated: 3.16: #GtkStyleProperties are deprecated.
|
||||
**/
|
||||
gboolean
|
||||
gtk_style_properties_get_property (GtkStyleProperties *props,
|
||||
const gchar *property,
|
||||
GtkStateFlags state,
|
||||
GValue *value)
|
||||
{
|
||||
StyleQueryData query = { props, state };
|
||||
GtkStyleProperty *node;
|
||||
|
||||
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);
|
||||
|
||||
node = _gtk_style_property_lookup (property);
|
||||
if (!node)
|
||||
{
|
||||
g_warning ("Style property \"%s\" is not registered", property);
|
||||
return FALSE;
|
||||
}
|
||||
if (_gtk_style_property_get_value_type (node) == G_TYPE_NONE)
|
||||
{
|
||||
g_warning ("Style property \"%s\" is not gettable", property);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
_gtk_style_property_query (node,
|
||||
value,
|
||||
style_query_func,
|
||||
&query);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
/**
|
||||
* 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
|
||||
*
|
||||
* Deprecated: 3.16: #GtkStyleProperties are deprecated.
|
||||
**/
|
||||
void
|
||||
gtk_style_properties_get_valist (GtkStyleProperties *props,
|
||||
GtkStateFlags state,
|
||||
va_list args)
|
||||
{
|
||||
const gchar *property_name;
|
||||
|
||||
g_return_if_fail (GTK_IS_STYLE_PROPERTIES (props));
|
||||
|
||||
property_name = va_arg (args, const gchar *);
|
||||
|
||||
while (property_name)
|
||||
{
|
||||
gchar *error = NULL;
|
||||
GValue value = G_VALUE_INIT;
|
||||
|
||||
if (!gtk_style_properties_get_property (props,
|
||||
property_name,
|
||||
state,
|
||||
&value))
|
||||
break;
|
||||
|
||||
G_VALUE_LCOPY (&value, args, 0, &error);
|
||||
g_value_unset (&value);
|
||||
|
||||
if (error)
|
||||
{
|
||||
g_warning ("Could not get style property \"%s\": %s", property_name, error);
|
||||
g_free (error);
|
||||
break;
|
||||
}
|
||||
|
||||
property_name = va_arg (args, const gchar *);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* gtk_style_properties_get:
|
||||
* @props: a #GtkStyleProperties
|
||||
* @state: state to retrieve the property values for
|
||||
* @...: property name /return value pairs, followed by %NULL
|
||||
*
|
||||
* Retrieves several style property values from @props for a
|
||||
* given state.
|
||||
*
|
||||
* Since: 3.0
|
||||
*
|
||||
* Deprecated: 3.16: #GtkStyleProperties are deprecated.
|
||||
**/
|
||||
void
|
||||
gtk_style_properties_get (GtkStyleProperties *props,
|
||||
GtkStateFlags state,
|
||||
...)
|
||||
{
|
||||
va_list args;
|
||||
|
||||
g_return_if_fail (GTK_IS_STYLE_PROPERTIES (props));
|
||||
|
||||
va_start (args, state);
|
||||
gtk_style_properties_get_valist (props, state, args);
|
||||
va_end (args);
|
||||
}
|
||||
|
||||
/**
|
||||
* gtk_style_properties_unset_property:
|
||||
* @props: a #GtkStyleProperties
|
||||
* @property: property to unset
|
||||
* @state: state to unset
|
||||
*
|
||||
* Unsets a style property in @props.
|
||||
*
|
||||
* Since: 3.0
|
||||
*
|
||||
* Deprecated: 3.16: #GtkStyleProperties are deprecated.
|
||||
**/
|
||||
void
|
||||
gtk_style_properties_unset_property (GtkStyleProperties *props,
|
||||
const gchar *property,
|
||||
GtkStateFlags state)
|
||||
{
|
||||
GtkStylePropertiesPrivate *priv;
|
||||
GtkStyleProperty *node;
|
||||
PropertyData *prop;
|
||||
guint pos;
|
||||
|
||||
g_return_if_fail (GTK_IS_STYLE_PROPERTIES (props));
|
||||
g_return_if_fail (property != NULL);
|
||||
|
||||
node = _gtk_style_property_lookup (property);
|
||||
|
||||
if (!node)
|
||||
{
|
||||
g_warning ("Style property \"%s\" is not registered", property);
|
||||
return;
|
||||
}
|
||||
if (_gtk_style_property_get_value_type (node) == G_TYPE_NONE)
|
||||
{
|
||||
g_warning ("Style property \"%s\" is not settable", property);
|
||||
return;
|
||||
}
|
||||
|
||||
if (GTK_IS_CSS_SHORTHAND_PROPERTY (node))
|
||||
{
|
||||
GtkCssShorthandProperty *shorthand = GTK_CSS_SHORTHAND_PROPERTY (node);
|
||||
|
||||
for (pos = 0; pos < _gtk_css_shorthand_property_get_n_subproperties (shorthand); pos++)
|
||||
{
|
||||
GtkCssStyleProperty *sub = _gtk_css_shorthand_property_get_subproperty (shorthand, pos);
|
||||
gtk_style_properties_unset_property (props,
|
||||
_gtk_style_property_get_name (GTK_STYLE_PROPERTY (sub)),
|
||||
state);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
priv = props->priv;
|
||||
prop = g_hash_table_lookup (priv->properties, node);
|
||||
|
||||
if (!prop)
|
||||
return;
|
||||
|
||||
if (property_data_find_position (prop, state, &pos))
|
||||
{
|
||||
ValueData *data;
|
||||
|
||||
data = &g_array_index (prop->values, ValueData, pos);
|
||||
|
||||
_gtk_css_value_unref (data->value);
|
||||
data->value = NULL;
|
||||
|
||||
g_array_remove_index (prop->values, pos);
|
||||
|
||||
_gtk_style_provider_private_changed (GTK_STYLE_PROVIDER_PRIVATE (props));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* gtk_style_properties_clear:
|
||||
* @props: a #GtkStyleProperties
|
||||
*
|
||||
* Clears all style information from @props.
|
||||
*
|
||||
* Deprecated: 3.16: #GtkStyleProperties are deprecated.
|
||||
**/
|
||||
void
|
||||
gtk_style_properties_clear (GtkStyleProperties *props)
|
||||
{
|
||||
GtkStylePropertiesPrivate *priv;
|
||||
|
||||
g_return_if_fail (GTK_IS_STYLE_PROPERTIES (props));
|
||||
|
||||
priv = props->priv;
|
||||
g_hash_table_remove_all (priv->properties);
|
||||
|
||||
_gtk_style_provider_private_changed (GTK_STYLE_PROVIDER_PRIVATE (props));
|
||||
}
|
||||
|
||||
/**
|
||||
* gtk_style_properties_merge:
|
||||
* @props: a #GtkStyleProperties
|
||||
* @props_to_merge: a second #GtkStyleProperties
|
||||
* @replace: whether to replace values or not
|
||||
*
|
||||
* Merges into @props all the style information contained
|
||||
* in @props_to_merge. If @replace is %TRUE, the values
|
||||
* will be overwritten, if it is %FALSE, the older values
|
||||
* will prevail.
|
||||
*
|
||||
* Since: 3.0
|
||||
*
|
||||
* Deprecated: 3.16: #GtkStyleProperties are deprecated.
|
||||
**/
|
||||
void
|
||||
gtk_style_properties_merge (GtkStyleProperties *props,
|
||||
const GtkStyleProperties *props_to_merge,
|
||||
gboolean replace)
|
||||
{
|
||||
GtkStylePropertiesPrivate *priv, *priv_to_merge;
|
||||
GHashTableIter iter;
|
||||
gpointer key, val;
|
||||
|
||||
g_return_if_fail (GTK_IS_STYLE_PROPERTIES (props));
|
||||
g_return_if_fail (GTK_IS_STYLE_PROPERTIES (props_to_merge));
|
||||
|
||||
priv = props->priv;
|
||||
priv_to_merge = props_to_merge->priv;
|
||||
|
||||
/* Merge symbolic color map */
|
||||
if (priv_to_merge->color_map)
|
||||
{
|
||||
g_hash_table_iter_init (&iter, priv_to_merge->color_map);
|
||||
|
||||
while (g_hash_table_iter_next (&iter, &key, &val))
|
||||
{
|
||||
const gchar *name;
|
||||
GtkSymbolicColor *color;
|
||||
|
||||
name = key;
|
||||
color = val;
|
||||
|
||||
if (!replace &&
|
||||
g_hash_table_lookup (priv->color_map, name))
|
||||
continue;
|
||||
|
||||
gtk_style_properties_map_color (props, name, color);
|
||||
}
|
||||
}
|
||||
|
||||
/* Merge symbolic style properties */
|
||||
g_hash_table_iter_init (&iter, priv_to_merge->properties);
|
||||
|
||||
while (g_hash_table_iter_next (&iter, &key, &val))
|
||||
{
|
||||
PropertyData *prop_to_merge = val;
|
||||
PropertyData *prop;
|
||||
guint i, j;
|
||||
|
||||
prop = g_hash_table_lookup (priv->properties, key);
|
||||
|
||||
if (!prop)
|
||||
{
|
||||
prop = property_data_new ();
|
||||
g_hash_table_insert (priv->properties, key, prop);
|
||||
}
|
||||
|
||||
for (i = 0; i < prop_to_merge->values->len; i++)
|
||||
{
|
||||
ValueData *data;
|
||||
ValueData *value;
|
||||
|
||||
data = &g_array_index (prop_to_merge->values, ValueData, i);
|
||||
|
||||
if (replace && data->state == GTK_STATE_FLAG_NORMAL &&
|
||||
_gtk_is_css_typed_value_of_type (data->value, PANGO_TYPE_FONT_DESCRIPTION))
|
||||
{
|
||||
/* Let normal state override all states
|
||||
* previously set in the original set
|
||||
*/
|
||||
property_data_remove_values (prop);
|
||||
}
|
||||
|
||||
value = property_data_get_value (prop, data->state);
|
||||
|
||||
if (_gtk_is_css_typed_value_of_type (data->value, PANGO_TYPE_FONT_DESCRIPTION) &&
|
||||
value->value != NULL)
|
||||
{
|
||||
PangoFontDescription *font_desc;
|
||||
PangoFontDescription *font_desc_to_merge;
|
||||
|
||||
/* Handle merging of font descriptions */
|
||||
font_desc = g_value_get_boxed (_gtk_css_typed_value_get (value->value));
|
||||
font_desc_to_merge = g_value_get_boxed (_gtk_css_typed_value_get (data->value));
|
||||
|
||||
pango_font_description_merge (font_desc, font_desc_to_merge, replace);
|
||||
}
|
||||
else if (_gtk_is_css_typed_value_of_type (data->value, G_TYPE_PTR_ARRAY) &&
|
||||
value->value != NULL)
|
||||
{
|
||||
GPtrArray *array, *array_to_merge;
|
||||
|
||||
/* Append the array, mainly thought
|
||||
* for the gtk-key-bindings property
|
||||
*/
|
||||
array = g_value_get_boxed (_gtk_css_typed_value_get (value->value));
|
||||
array_to_merge = g_value_get_boxed (_gtk_css_typed_value_get (data->value));
|
||||
|
||||
for (j = 0; j < array_to_merge->len; j++)
|
||||
g_ptr_array_add (array, g_ptr_array_index (array_to_merge, j));
|
||||
}
|
||||
else if (replace || value->value == NULL)
|
||||
{
|
||||
_gtk_css_value_unref (value->value);
|
||||
value->value = _gtk_css_value_ref (data->value);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
_gtk_style_provider_private_changed (GTK_STYLE_PROVIDER_PRIVATE (props));
|
||||
}
|
||||
|
||||
G_GNUC_END_IGNORE_DEPRECATIONS;
|
@ -1,120 +0,0 @@
|
||||
/* GTK - The GIMP Toolkit
|
||||
* Copyright (C) 2010 Carlos Garnacho <carlosg@gnome.org>
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef __GTK_STYLE_PROPERTIES_H__
|
||||
#define __GTK_STYLE_PROPERTIES_H__
|
||||
|
||||
#if !defined (__GTK_H_INSIDE__) && !defined (GTK_COMPILATION)
|
||||
#error "Only <gtk/gtk.h> can be included directly."
|
||||
#endif
|
||||
|
||||
#include <glib-object.h>
|
||||
#include <gdk/gdk.h>
|
||||
#include <gtk/gtkenums.h>
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
#define GTK_TYPE_STYLE_PROPERTIES (gtk_style_properties_get_type ())
|
||||
#define GTK_STYLE_PROPERTIES(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), GTK_TYPE_STYLE_PROPERTIES, GtkStyleProperties))
|
||||
#define GTK_STYLE_PROPERTIES_CLASS(c) (G_TYPE_CHECK_CLASS_CAST ((c), GTK_TYPE_STYLE_PROPERTIES, GtkStylePropertiesClass))
|
||||
#define GTK_IS_STYLE_PROPERTIES(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), GTK_TYPE_STYLE_PROPERTIES))
|
||||
#define GTK_IS_STYLE_PROPERTIES_CLASS(c) (G_TYPE_CHECK_CLASS_TYPE ((c), GTK_TYPE_STYLE_PROPERTIES))
|
||||
#define GTK_STYLE_PROPERTIES_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), GTK_TYPE_STYLE_PROPERTIES, GtkStylePropertiesClass))
|
||||
|
||||
typedef struct _GtkStyleProperties GtkStyleProperties;
|
||||
typedef struct _GtkStylePropertiesClass GtkStylePropertiesClass;
|
||||
typedef struct _GtkStylePropertiesPrivate GtkStylePropertiesPrivate;
|
||||
|
||||
typedef struct _GtkSymbolicColor GtkSymbolicColor;
|
||||
typedef struct _GtkGradient GtkGradient;
|
||||
|
||||
struct _GtkStyleProperties
|
||||
{
|
||||
/*< private >*/
|
||||
GObject parent_object;
|
||||
GtkStylePropertiesPrivate *priv;
|
||||
};
|
||||
|
||||
struct _GtkStylePropertiesClass
|
||||
{
|
||||
/*< private >*/
|
||||
GObjectClass parent_class;
|
||||
|
||||
/* Padding for future expansion */
|
||||
void (*_gtk_reserved1) (void);
|
||||
void (*_gtk_reserved2) (void);
|
||||
void (*_gtk_reserved3) (void);
|
||||
void (*_gtk_reserved4) (void);
|
||||
};
|
||||
|
||||
typedef gboolean (* GtkStylePropertyParser) (const gchar *string,
|
||||
GValue *value,
|
||||
GError **error);
|
||||
|
||||
GDK_DEPRECATED_IN_3_16
|
||||
GType gtk_style_properties_get_type (void) G_GNUC_CONST;
|
||||
|
||||
/* Next 2 are implemented in gtkcsscustomproperty.c */
|
||||
GDK_DEPRECATED_IN_3_8
|
||||
void gtk_style_properties_register_property (GtkStylePropertyParser parse_func,
|
||||
GParamSpec *pspec);
|
||||
GDK_DEPRECATED_IN_3_8
|
||||
gboolean gtk_style_properties_lookup_property (const gchar *property_name,
|
||||
GtkStylePropertyParser *parse_func,
|
||||
GParamSpec **pspec);
|
||||
|
||||
GDK_DEPRECATED_IN_3_16
|
||||
GtkStyleProperties * gtk_style_properties_new (void);
|
||||
|
||||
GDK_DEPRECATED_IN_3_8
|
||||
void gtk_style_properties_map_color (GtkStyleProperties *props,
|
||||
const gchar *name,
|
||||
GtkSymbolicColor *color);
|
||||
GDK_DEPRECATED_IN_3_8
|
||||
GtkSymbolicColor * gtk_style_properties_lookup_color (GtkStyleProperties *props,
|
||||
const gchar *name);
|
||||
|
||||
GDK_DEPRECATED_IN_3_16
|
||||
gboolean gtk_style_properties_get_property (GtkStyleProperties *props,
|
||||
const gchar *property,
|
||||
GtkStateFlags state,
|
||||
GValue *value);
|
||||
GDK_DEPRECATED_IN_3_16
|
||||
void gtk_style_properties_get_valist (GtkStyleProperties *props,
|
||||
GtkStateFlags state,
|
||||
va_list args);
|
||||
GDK_DEPRECATED_IN_3_16
|
||||
void gtk_style_properties_get (GtkStyleProperties *props,
|
||||
GtkStateFlags state,
|
||||
...) G_GNUC_NULL_TERMINATED;
|
||||
|
||||
GDK_DEPRECATED_IN_3_16
|
||||
void gtk_style_properties_unset_property (GtkStyleProperties *props,
|
||||
const gchar *property,
|
||||
GtkStateFlags state);
|
||||
|
||||
GDK_DEPRECATED_IN_3_16
|
||||
void gtk_style_properties_clear (GtkStyleProperties *props);
|
||||
|
||||
GDK_DEPRECATED_IN_3_16
|
||||
void gtk_style_properties_merge (GtkStyleProperties *props,
|
||||
const GtkStyleProperties *props_to_merge,
|
||||
gboolean replace);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
#endif /* __GTK_STYLE_PROPERTIES_H__ */
|
@ -25,7 +25,6 @@
|
||||
#include "gtkhslaprivate.h"
|
||||
#include "gtkstylepropertyprivate.h"
|
||||
#include "gtksymboliccolorprivate.h"
|
||||
#include "gtkstyleproperties.h"
|
||||
#include "gtkintl.h"
|
||||
#include "gtkwin32themeprivate.h"
|
||||
|
||||
@ -292,7 +291,6 @@ gtk_symbolic_color_unref (GtkSymbolicColor *color)
|
||||
**/
|
||||
gboolean
|
||||
gtk_symbolic_color_resolve (GtkSymbolicColor *color,
|
||||
GtkStyleProperties *props,
|
||||
GdkRGBA *resolved_color)
|
||||
{
|
||||
GdkRGBA pink = { 1.0, 0.5, 0.5, 1.0 };
|
||||
@ -300,11 +298,10 @@ gtk_symbolic_color_resolve (GtkSymbolicColor *color,
|
||||
|
||||
g_return_val_if_fail (color != NULL, FALSE);
|
||||
g_return_val_if_fail (resolved_color != NULL, FALSE);
|
||||
g_return_val_if_fail (props == NULL || GTK_IS_STYLE_PROPERTIES (props), FALSE);
|
||||
|
||||
current = _gtk_css_rgba_value_new_from_rgba (&pink);
|
||||
v = _gtk_css_color_value_resolve (color->value,
|
||||
GTK_STYLE_PROVIDER_PRIVATE (props),
|
||||
NULL,
|
||||
current,
|
||||
NULL);
|
||||
_gtk_css_value_unref (current);
|
||||
|
@ -23,10 +23,11 @@
|
||||
#endif
|
||||
|
||||
#include <gdk/gdk.h>
|
||||
#include <gtk/deprecated/gtkstyleproperties.h>
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
typedef struct _GtkSymbolicColor GtkSymbolicColor;
|
||||
|
||||
#define GTK_TYPE_SYMBOLIC_COLOR (gtk_symbolic_color_get_type ())
|
||||
|
||||
GDK_DEPRECATED_IN_3_8
|
||||
@ -60,7 +61,6 @@ char * gtk_symbolic_color_to_string (GtkSymbolicColor *color);
|
||||
|
||||
GDK_DEPRECATED_IN_3_8
|
||||
gboolean gtk_symbolic_color_resolve (GtkSymbolicColor *color,
|
||||
GtkStyleProperties *props,
|
||||
GdkRGBA *resolved_color);
|
||||
|
||||
G_END_DECLS
|
||||
|
@ -159,7 +159,6 @@ G_DEFINE_AUTOPTR_CLEANUP_FUNC(GtkStack, g_object_unref)
|
||||
G_DEFINE_AUTOPTR_CLEANUP_FUNC(GtkStackSwitcher, g_object_unref)
|
||||
G_DEFINE_AUTOPTR_CLEANUP_FUNC(GtkStatusbar, g_object_unref)
|
||||
G_DEFINE_AUTOPTR_CLEANUP_FUNC(GtkStyleContext, g_object_unref)
|
||||
G_DEFINE_AUTOPTR_CLEANUP_FUNC(GtkStyleProperties, g_object_unref)
|
||||
G_DEFINE_AUTOPTR_CLEANUP_FUNC(GtkStyleProvider, g_object_unref)
|
||||
G_DEFINE_AUTOPTR_CLEANUP_FUNC(GtkSwitch, g_object_unref)
|
||||
G_DEFINE_AUTOPTR_CLEANUP_FUNC(GtkTextBuffer, g_object_unref)
|
||||
|
@ -252,7 +252,6 @@
|
||||
#include <gtk/deprecated/gtkradioaction.h>
|
||||
#include <gtk/deprecated/gtkrecentaction.h>
|
||||
#include <gtk/deprecated/gtkstock.h>
|
||||
#include <gtk/deprecated/gtkstyleproperties.h>
|
||||
#include <gtk/deprecated/gtksymboliccolor.h>
|
||||
#include <gtk/deprecated/gtktable.h>
|
||||
#include <gtk/deprecated/gtktoggleaction.h>
|
||||
|
@ -34,6 +34,10 @@ G_BEGIN_DECLS
|
||||
typedef struct _GtkCssCustomProperty GtkCssCustomProperty;
|
||||
typedef struct _GtkCssCustomPropertyClass GtkCssCustomPropertyClass;
|
||||
|
||||
typedef gboolean (* GtkStylePropertyParser) (const gchar *string,
|
||||
GValue *value,
|
||||
GError **error);
|
||||
|
||||
struct _GtkCssCustomProperty
|
||||
{
|
||||
GtkCssStyleProperty parent;
|
||||
|
@ -146,7 +146,7 @@ rgba_value_parse (GtkCssParser *parser,
|
||||
if (symbolic == NULL)
|
||||
return FALSE;
|
||||
|
||||
if (gtk_symbolic_color_resolve (symbolic, NULL, &rgba))
|
||||
if (gtk_symbolic_color_resolve (symbolic, &rgba))
|
||||
{
|
||||
g_value_set_boxed (value, &rgba);
|
||||
gtk_symbolic_color_unref (symbolic);
|
||||
@ -234,7 +234,7 @@ color_value_parse (GtkCssParser *parser,
|
||||
if (symbolic == NULL)
|
||||
return FALSE;
|
||||
|
||||
if (gtk_symbolic_color_resolve (symbolic, NULL, &rgba))
|
||||
if (gtk_symbolic_color_resolve (symbolic, &rgba))
|
||||
{
|
||||
GdkColor color;
|
||||
|
||||
|
@ -54,38 +54,6 @@ gtk_style_provider_iface_init (gpointer g_iface)
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* gtk_style_provider_get_style:
|
||||
* @provider: a #GtkStyleProvider
|
||||
* @path: #GtkWidgetPath to query
|
||||
*
|
||||
* Returns the style settings affecting a widget defined by @path, or %NULL if
|
||||
* @provider doesn’t contemplate styling @path.
|
||||
*
|
||||
* Returns: (nullable) (transfer full): a #GtkStyleProperties containing the
|
||||
* style settings affecting @path
|
||||
*
|
||||
* Since: 3.0
|
||||
*
|
||||
* Deprecated: 3.8: Will always return %NULL for all GTK-provided style providers
|
||||
* as the interface cannot correctly work the way CSS is specified.
|
||||
**/
|
||||
GtkStyleProperties *
|
||||
gtk_style_provider_get_style (GtkStyleProvider *provider,
|
||||
GtkWidgetPath *path)
|
||||
{
|
||||
GtkStyleProviderIface *iface;
|
||||
|
||||
g_return_val_if_fail (GTK_IS_STYLE_PROVIDER (provider), NULL);
|
||||
|
||||
iface = GTK_STYLE_PROVIDER_GET_IFACE (provider);
|
||||
|
||||
if (!iface->get_style)
|
||||
return NULL;
|
||||
|
||||
return iface->get_style (provider, path);
|
||||
}
|
||||
|
||||
/**
|
||||
* gtk_style_provider_get_style_property:
|
||||
* @provider: a #GtkStyleProvider
|
||||
|
@ -22,9 +22,8 @@
|
||||
#error "Only <gtk/gtk.h> can be included directly."
|
||||
#endif
|
||||
|
||||
#include <glib-object.h>
|
||||
#include <gdk/gdk.h>
|
||||
#include <gtk/gtkenums.h>
|
||||
#include <gtk/deprecated/gtkstyleproperties.h>
|
||||
#include <gtk/gtktypes.h>
|
||||
|
||||
G_BEGIN_DECLS
|
||||
@ -101,9 +100,6 @@ struct _GtkStyleProviderIface
|
||||
|
||||
/*< public >*/
|
||||
|
||||
GtkStyleProperties * (* get_style) (GtkStyleProvider *provider,
|
||||
GtkWidgetPath *path);
|
||||
|
||||
gboolean (* get_style_property) (GtkStyleProvider *provider,
|
||||
GtkWidgetPath *path,
|
||||
GtkStateFlags state,
|
||||
@ -114,10 +110,6 @@ struct _GtkStyleProviderIface
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
GType gtk_style_provider_get_type (void) G_GNUC_CONST;
|
||||
|
||||
GDK_DEPRECATED_IN_3_8
|
||||
GtkStyleProperties *gtk_style_provider_get_style (GtkStyleProvider *provider,
|
||||
GtkWidgetPath *path);
|
||||
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
gboolean gtk_style_provider_get_style_property (GtkStyleProvider *provider,
|
||||
GtkWidgetPath *path,
|
||||
|
Loading…
Reference in New Issue
Block a user