gtk_style_context_new
gtk_style_context_add_provider
gtk_style_context_add_provider_for_display
-gtk_style_context_get
gtk_style_context_get_parent
-gtk_style_context_get_property
gtk_style_context_get_display
gtk_style_context_get_state
-gtk_style_context_get_valist
gtk_style_context_get_color
gtk_style_context_get_border
gtk_style_context_get_padding
#include "gtkcellrenderertext.h"
+#include "gtkcssnumbervalueprivate.h"
#include "gtkeditable.h"
#include "gtkentry.h"
#include "gtkentryprivate.h"
#include "gtkprivate.h"
#include "gtksizerequest.h"
#include "gtksnapshot.h"
-#include "gtkstylecontext.h"
+#include "gtkstylecontextprivate.h"
#include "gtktreeprivate.h"
#include "a11y/gtktextcellaccessible.h"
style_context = gtk_widget_get_style_context (widget);
- gtk_style_context_get (style_context, "font", &font_desc, NULL);
+ font_desc = gtk_css_style_get_pango_font (gtk_style_context_lookup_style (style_context));
pango_font_description_merge_static (font_desc, priv->font, TRUE);
if (priv->scale_set)
#include "gtkadjustment.h"
#include "gtkbindings.h"
#include "gtkcontainerprivate.h"
+#include "gtkcsscolorvalueprivate.h"
#include "gtkcssnodeprivate.h"
#include "gtkgesturedrag.h"
#include "gtkgestureclick.h"
{
cairo_path_t *path;
GtkBorder border;
- GdkRGBA *border_color;
+ const GdkRGBA *border_color;
if (vertical)
path_from_vertical_line_rects (cr, (GdkRectangle *)lines->data, lines->len);
cairo_append_path (cr, path);
cairo_path_destroy (path);
- gtk_style_context_get (context, "border-color", &border_color, NULL);
+ border_color = gtk_css_color_value_get_rgba (_gtk_style_context_peek_property (context, GTK_CSS_PROPERTY_BORDER_TOP_COLOR));
gtk_style_context_get_border (context, &border);
cairo_set_line_width (cr, border.left);
gdk_cairo_set_source_rgba (cr, border_color);
cairo_stroke (cr);
- gdk_rgba_free (border_color);
}
g_array_free (lines, TRUE);
#include "gdk/gdkkeysyms.h"
#include "gdk/win32/gdkwin32.h"
#include "gtk/gtkimmodule.h"
-
-#include <pango/pango.h>
+#include "gtk/gtkstylecontextprivate.h"
+#include "gtk/gtkcssstyleprivate.h"
/* avoid warning */
#ifdef STRICT
PangoContext *pango_context;
PangoFont *font;
LOGFONT *logfont;
- GtkStyleContext *style;
PangoFontDescription *font_desc;
g_return_if_fail (GTK_IS_IM_CONTEXT_IME (context));
lang = ""; break;
}
- style = gtk_widget_get_style_context (widget);
- gtk_style_context_get (style,
- "font",
- &font_desc,
- NULL);
+ font_desc = gtk_css_style_get_pango_font (gtk_style_context_lookup_style (gtk_widget_get_style_context (widget)));
if (lang[0])
{
_gtk_style_cascade_remove_provider (cascade, provider);
}
-static GtkCssValue *
-gtk_style_context_query_func (guint id,
- gpointer values)
-{
- return gtk_css_style_get_value (values, id);
-}
-
-/**
- * gtk_style_context_get_property:
- * @context: a #GtkStyleContext
- * @property: style property name
- * @value: (out) (transfer full): return location for the style property value
- *
- * Gets a style property from @context for the current state.
- *
- * Note that not all CSS properties that are supported by GTK+ can be
- * retrieved in this way, since they may not be representable as #GValue.
- * GTK+ defines macros for a number of properties that can be used
- * with this function.
- *
- * When @value is no longer needed, g_value_unset() must be called
- * to free any allocated memory.
- **/
-void
-gtk_style_context_get_property (GtkStyleContext *context,
- const gchar *property,
- GValue *value)
-{
- GtkStyleContextPrivate *priv = gtk_style_context_get_instance_private (context);
- GtkStyleProperty *prop;
-
- g_return_if_fail (GTK_IS_STYLE_CONTEXT (context));
- g_return_if_fail (property != NULL);
- g_return_if_fail (value != NULL);
-
- prop = _gtk_style_property_lookup (property);
- if (prop == NULL)
- {
- g_warning ("Style property \"%s\" is not registered", property);
- return;
- }
- if (_gtk_style_property_get_value_type (prop) == G_TYPE_NONE)
- {
- g_warning ("Style property \"%s\" is not gettable", property);
- return;
- }
-
- _gtk_style_property_query (prop,
- value,
- gtk_style_context_query_func,
- gtk_css_node_get_style (priv->cssnode));
-}
-
-/**
- * gtk_style_context_get_valist:
- * @context: a #GtkStyleContext
- * @first_property_name: Name of the first property
- * @args: va_list of property name/return location pairs, followed by %NULL
- *
- * Retrieves several style property values from @context for a given state.
- *
- * See gtk_style_context_get_property() for details.
- *
- * As with g_object_get(), a copy is made of the property contents for
- * pointer-valued properties, and the caller is responsible for freeing the
- * memory in the appropriate manner for the type. For example, by calling
- * g_free() or g_object_unref(). Non-pointer-valued properties, such as
- * integers, are returned by value and do not need to be freed.
- */
-void
-gtk_style_context_get_valist (GtkStyleContext *context,
- const char *first_property_name,
- va_list args)
-{
- const gchar *property_name;
-
- g_return_if_fail (GTK_IS_STYLE_CONTEXT (context));
- g_return_if_fail (first_property_name != NULL);
-
- property_name = first_property_name;
-
- while (property_name)
- {
- gchar *error = NULL;
- GValue value = G_VALUE_INIT;
-
- gtk_style_context_get_property (context,
- property_name,
- &value);
-
- 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_context_get:
- * @context: a #GtkStyleContext
- * @first_property_name: Name of the first property
- * @...: property name /return value pairs, followed by %NULL
- *
- * Retrieves several style property values from @context for a
- * given state.
- *
- * See gtk_style_context_get_property() for details.
- *
- * As with g_object_get(), a copy is made of the property contents for
- * pointer-valued properties, and the caller is responsible for freeing the
- * memory in the appropriate manner for the type. For example, by calling
- * g_free() or g_object_unref(). Non-pointer-valued properties, such as
- * integers, are returned by value and do not need to be freed.
- */
-void
-gtk_style_context_get (GtkStyleContext *context,
- const char *first_property_name,
- ...)
-{
- va_list args;
-
- g_return_if_fail (GTK_IS_STYLE_CONTEXT (context));
- g_return_if_fail (first_property_name != NULL);
-
- va_start (args, first_property_name);
- gtk_style_context_get_valist (context, first_property_name, args);
- va_end (args);
-}
-
/*
* gtk_style_context_set_id:
* @context: a #GtkStyleContext
gtk_style_context_get_color (GtkStyleContext *context,
GdkRGBA *color)
{
- GdkRGBA *c;
-
g_return_if_fail (color != NULL);
g_return_if_fail (GTK_IS_STYLE_CONTEXT (context));
- gtk_style_context_get (context,
- "color", &c,
- NULL);
-
- *color = *c;
- gdk_rgba_free (c);
+ *color = *gtk_css_color_value_get_rgba (_gtk_style_context_peek_property (context, GTK_CSS_PROPERTY_COLOR));
}
/**
GdkRGBA *primary_color,
GdkRGBA *secondary_color)
{
- GdkRGBA *pc, *sc;
-
- gtk_style_context_get (context,
- "caret-color", &pc,
- "-gtk-secondary-caret-color", &sc,
- NULL);
if (primary_color)
- *primary_color = *pc;
+ *primary_color = *gtk_css_color_value_get_rgba (_gtk_style_context_peek_property (context, GTK_CSS_PROPERTY_CARET_COLOR));
if (secondary_color)
- *secondary_color = *sc;
-
- gdk_rgba_free (pc);
- gdk_rgba_free (sc);
+ *secondary_color = *gtk_css_color_value_get_rgba (_gtk_style_context_peek_property (context, GTK_CSS_PROPERTY_SECONDARY_CARET_COLOR));
}
static void
_gtk_style_context_get_attributes (AtkAttributeSet *attributes,
GtkStyleContext *context)
{
- GdkRGBA *bg;
- GdkRGBA color;
+ const GdkRGBA *color;
gchar *value;
- gtk_style_context_get (context, "background-color", &bg, NULL);
+ color = gtk_css_color_value_get_rgba (_gtk_style_context_peek_property (context, GTK_CSS_PROPERTY_BACKGROUND_COLOR));
value = g_strdup_printf ("%u,%u,%u",
- (guint) ceil (bg->red * 65536 - bg->red),
- (guint) ceil (bg->green * 65536 - bg->green),
- (guint) ceil (bg->blue * 65536 - bg->blue));
+ (guint) ceil (color->red * 65536 - color->red),
+ (guint) ceil (color->green * 65536 - color->green),
+ (guint) ceil (color->blue * 65536 - color->blue));
attributes = add_attribute (attributes, ATK_TEXT_ATTR_BG_COLOR, value);
- g_free (value);
- gdk_rgba_free (bg);
- gtk_style_context_get_color (context, &color);
+ color = gtk_css_color_value_get_rgba (_gtk_style_context_peek_property (context, GTK_CSS_PROPERTY_COLOR));
value = g_strdup_printf ("%u,%u,%u",
- (guint) ceil (color.red * 65536 - color.red),
- (guint) ceil (color.green * 65536 - color.green),
- (guint) ceil (color.blue * 65536 - color.blue));
+ (guint) ceil (color->red * 65536 - color->red),
+ (guint) ceil (color->green * 65536 - color->green),
+ (guint) ceil (color->blue * 65536 - color->blue));
attributes = add_attribute (attributes, ATK_TEXT_ATTR_FG_COLOR, value);
- g_free (value);
return attributes;
}
GDK_AVAILABLE_IN_ALL
void gtk_style_context_restore (GtkStyleContext *context);
-GDK_AVAILABLE_IN_ALL
-void gtk_style_context_get_property (GtkStyleContext *context,
- const gchar *property,
- GValue *value);
-GDK_AVAILABLE_IN_ALL
-void gtk_style_context_get_valist (GtkStyleContext *context,
- const char *first_property_name,
- va_list args);
-GDK_AVAILABLE_IN_ALL
-void gtk_style_context_get (GtkStyleContext *context,
- const char *first_property_name,
- ...) G_GNUC_NULL_TERMINATED;
-
GDK_AVAILABLE_IN_ALL
void gtk_style_context_set_state (GtkStyleContext *context,
GtkStateFlags flags);
*/
#include "config.h"
+
+#include "gtkcssnumbervalueprivate.h"
#include "gtkprivatetypebuiltins.h"
#include "gtktexthandleprivate.h"
#include "gtkmarshalers.h"
#include "gtkwidgetprivate.h"
#include "gtkgizmoprivate.h"
#include "gtkrendericonprivate.h"
+#include "gtkstylecontextprivate.h"
#include "gtkintl.h"
#include <gtk/gtk.h>
GtkStyleContext *context;
context = gtk_widget_get_style_context (widget);
-
- gtk_style_context_get (context,
- "min-width", width,
- "min-height", height,
- NULL);
+
+ *width = _gtk_css_number_value_get (_gtk_style_context_peek_property (context, GTK_CSS_PROPERTY_MIN_WIDTH), 100);
+ *height = _gtk_css_number_value_get (_gtk_style_context_peek_property (context, GTK_CSS_PROPERTY_MIN_HEIGHT), 100);
}
static gint
*/
#include "config.h"
+
+#include "gtktextlayoutprivate.h"
+
+#include "gtkcsscolorvalueprivate.h"
#include "gtkmarshalers.h"
#include "gtkstylecontextprivate.h"
-#include "gtktextlayoutprivate.h"
#include "gtktextbtree.h"
#include "gtktextbufferprivate.h"
#include "gtktextiterprivate.h"
int byte_offset = 0;
PangoLayoutIter *iter;
int screen_width;
- GdkRGBA *selection = NULL;
+ const GdkRGBA *selection = NULL;
gboolean first = TRUE;
g_return_if_fail (GTK_IS_TEXT_VIEW (crenderer->widget));
GtkCssNode *selection_node = gtk_text_view_get_selection_node ((GtkTextView*)crenderer->widget);
gtk_style_context_save_to_node (context, selection_node);
- gtk_style_context_get (context, "background-color", &selection, NULL);
+ selection = gtk_css_color_value_get_rgba (_gtk_style_context_peek_property (context, GTK_CSS_PROPERTY_BACKGROUND_COLOR));
gtk_style_context_restore (context);
}
if (offset_y)
gtk_snapshot_restore (crenderer->snapshot);
- gdk_rgba_free (selection);
pango_layout_iter_free (iter);
}
#include "gtktextview.h"
#include "gtktextutil.h"
+#include "gtkcsscolorvalueprivate.h"
+#include "gtkstylecontextprivate.h"
#include "gtktextbuffer.h"
#include "gtktextlayoutprivate.h"
#include "gtkintl.h"
return paintable;
}
-static GtkCssValue *
-query_func (guint id, gpointer values)
-{
- return gtk_css_style_get_value (values, id);
-}
-
static void
set_attributes_from_style (GtkWidget *widget,
GtkTextAttributes *values)
{
- GtkCssStyle *style;
+ GtkStyleContext *context;
const GdkRGBA black = { 0, };
- const GdkRGBA *color;
- GValue value = G_VALUE_INIT;
if (!values->appearance.bg_rgba)
values->appearance.bg_rgba = gdk_rgba_copy (&black);
if (!values->appearance.fg_rgba)
values->appearance.fg_rgba = gdk_rgba_copy (&black);
- style = gtk_css_node_get_style (gtk_widget_get_css_node (widget));
- color = gtk_css_color_value_get_rgba (gtk_css_style_get_value (style, GTK_CSS_PROPERTY_BACKGROUND_COLOR));
- *values->appearance.bg_rgba = *color;
- color = gtk_css_color_value_get_rgba (gtk_css_style_get_value (style, GTK_CSS_PROPERTY_BACKGROUND_COLOR));
- *values->appearance.fg_rgba = *color;
+ context = gtk_widget_get_style_context (widget);
+ *values->appearance.bg_rgba = *gtk_css_color_value_get_rgba (_gtk_style_context_peek_property (context, GTK_CSS_PROPERTY_BACKGROUND_COLOR));
+ *values->appearance.fg_rgba = *gtk_css_color_value_get_rgba (_gtk_style_context_peek_property (context, GTK_CSS_PROPERTY_COLOR));
if (values->font)
pango_font_description_free (values->font);
- _gtk_style_property_query (_gtk_style_property_lookup ("font"), &value, query_func, style);
-
- values->font = g_value_get_boxed (&value);
- g_value_unset (&value);
+ values->font = gtk_css_style_get_pango_font (gtk_style_context_lookup_style (context));
}
static gint
#include "gtkadjustmentprivate.h"
#include "gtkbindings.h"
+#include "gtkcsscolorvalueprivate.h"
#include "gtkdebug.h"
#include "gtkintl.h"
#include "gtkmain.h"
{
GtkStyleContext *context;
const GdkRGBA black = { 0, };
- GdkRGBA *bg;
+ const GdkRGBA *color;
if (!values->appearance.bg_rgba)
values->appearance.bg_rgba = gdk_rgba_copy (&black);
context = gtk_widget_get_style_context (GTK_WIDGET (text_view));
- gtk_style_context_get (context, "background-color", &bg, NULL);
- *values->appearance.bg_rgba = *bg;
- gdk_rgba_free (bg);
- gtk_style_context_get_color (context, values->appearance.fg_rgba);
+ color = gtk_css_color_value_get_rgba (_gtk_style_context_peek_property (context, GTK_CSS_PROPERTY_BACKGROUND_COLOR));
+ *values->appearance.bg_rgba = *color;
+ color = gtk_css_color_value_get_rgba (_gtk_style_context_peek_property (context, GTK_CSS_PROPERTY_COLOR));
+ *values->appearance.fg_rgba = *color;
if (values->font)
pango_font_description_free (values->font);
- gtk_style_context_get (context, "font", &values->font, NULL);
+ values->font = gtk_css_style_get_pango_font (gtk_style_context_lookup_style (context));
}
static void