summaryrefslogtreecommitdiff
path: root/gtk
diff options
context:
space:
mode:
authorBenjamin Otte <otte@redhat.com>2016-10-06 22:37:42 +0200
committerBenjamin Otte <otte@redhat.com>2016-10-16 18:17:21 +0200
commit0df388051df5896a6199b36e47a133795bdc26be (patch)
treefa3f55ff9057b0b7c1a03588b1a3863fba406a3b /gtk
parent05763e4875d11b0f10617dad78bc211e9cf32e95 (diff)
downloadgtk+-0df388051df5896a6199b36e47a133795bdc26be.tar.gz
API: Remove GtkStyle
All the remaining gtkrc.c stuff like GtkRcStyle goes with it.
Diffstat (limited to 'gtk')
-rw-r--r--gtk/deprecated/Makefile.inc4
-rw-r--r--gtk/deprecated/gtkiconfactory.c87
-rw-r--r--gtk/deprecated/gtkiconfactory.h9
-rw-r--r--gtk/deprecated/gtkrc.c1966
-rw-r--r--gtk/deprecated/gtkrc.h405
-rw-r--r--gtk/deprecated/gtkstyle.c4769
-rw-r--r--gtk/deprecated/gtkstyle.h793
-rw-r--r--gtk/gtk-autocleanups.h2
-rw-r--r--gtk/gtk.h2
-rw-r--r--gtk/gtkicontheme.c91
-rw-r--r--gtk/gtkicontheme.h6
-rw-r--r--gtk/gtksizerequest.c5
-rw-r--r--gtk/gtktypes.h2
-rw-r--r--gtk/gtkwidget.c119
-rw-r--r--gtk/gtkwidget.h2
-rw-r--r--gtk/gtkwidgetprivate.h4
16 files changed, 0 insertions, 8266 deletions
diff --git a/gtk/deprecated/Makefile.inc b/gtk/deprecated/Makefile.inc
index e93bd66a58..0cf9b94940 100644
--- a/gtk/deprecated/Makefile.inc
+++ b/gtk/deprecated/Makefile.inc
@@ -18,10 +18,8 @@ deprecated_h_sources = \
deprecated/gtkimagemenuitem.h \
deprecated/gtkmisc.h \
deprecated/gtkradioaction.h \
- deprecated/gtkrc.h \
deprecated/gtkrecentaction.h \
deprecated/gtkstock.h \
- deprecated/gtkstyle.h \
deprecated/gtkstyleproperties.h \
deprecated/gtksymboliccolor.h \
deprecated/gtktable.h \
@@ -61,10 +59,8 @@ deprecated_c_sources = \
deprecated/gtkimagemenuitem.c \
deprecated/gtkmisc.c \
deprecated/gtkradioaction.c \
- deprecated/gtkrc.c \
deprecated/gtkrecentaction.c \
deprecated/gtkstock.c \
- deprecated/gtkstyle.c \
deprecated/gtkstyleproperties.c \
deprecated/gtksymboliccolor.c \
deprecated/gtktable.c \
diff --git a/gtk/deprecated/gtkiconfactory.c b/gtk/deprecated/gtkiconfactory.c
index 5ac19ca1a0..3be8fc4ebd 100644
--- a/gtk/deprecated/gtkiconfactory.c
+++ b/gtk/deprecated/gtkiconfactory.c
@@ -43,7 +43,6 @@
#include "gtkbuildable.h"
#include "gtkbuilderprivate.h"
#include "gtktypebuiltins.h"
-#include "gtkstyle.h"
#include "gtkstylecontextprivate.h"
#include "gtkrender.h"
#include "gtkrenderprivate.h"
@@ -1556,92 +1555,6 @@ G_GNUC_END_IGNORE_DEPRECATIONS;
return surface;
}
-/**
- * gtk_icon_set_render_icon:
- * @icon_set: a #GtkIconSet
- * @style: (allow-none): a #GtkStyle associated with @widget, or %NULL
- * @direction: text direction
- * @state: widget state
- * @size: (type int): icon size (#GtkIconSize). A size of `(GtkIconSize)-1`
- * means render at the size of the source and don’t scale.
- * @widget: (allow-none): widget that will display the icon, or %NULL.
- * The only use that is typically made of this
- * is to determine the appropriate #GdkScreen.
- * @detail: (allow-none): detail to pass to the theme engine, or %NULL.
- * Note that passing a detail of anything but %NULL
- * will disable caching.
- *
- * Renders an icon using gtk_style_render_icon(). In most cases,
- * gtk_widget_render_icon() is better, since it automatically provides
- * most of the arguments from the current widget settings. This
- * function never returns %NULL; if the icon can’t be rendered
- * (perhaps because an image file fails to load), a default "missing
- * image" icon will be returned instead.
- *
- * Returns: (transfer full): a #GdkPixbuf to be displayed
- *
- * Deprecated: 3.0: Use gtk_icon_set_render_icon_pixbuf() instead
- */
-GdkPixbuf*
-gtk_icon_set_render_icon (GtkIconSet *icon_set,
- GtkStyle *style,
- GtkTextDirection direction,
- GtkStateType state,
- GtkIconSize size,
- GtkWidget *widget,
- const char *detail)
-{
- GdkPixbuf *icon;
- GtkStyleContext *context = NULL;
- GtkStateFlags flags = 0;
-
- g_return_val_if_fail (icon_set != NULL, NULL);
-
-G_GNUC_BEGIN_IGNORE_DEPRECATIONS;
-
- g_return_val_if_fail (style == NULL || GTK_IS_STYLE (style), NULL);
-
- if (style && gtk_style_has_context (style))
- {
- g_object_get (style, "context", &context, NULL);
- /* g_object_get returns a refed object */
- if (context)
- g_object_unref (context);
- }
- else if (widget)
- {
- context = gtk_widget_get_style_context (widget);
- }
-
- if (!context)
- return render_fallback_image (gtk_style_context_lookup_style (context), direction, state, size);
-
- gtk_style_context_save (context);
-
- switch (state)
- {
- case GTK_STATE_PRELIGHT:
- flags |= GTK_STATE_FLAG_PRELIGHT;
- break;
- case GTK_STATE_INSENSITIVE:
- flags |= GTK_STATE_FLAG_INSENSITIVE;
- break;
- default:
- break;
- }
-
- gtk_style_context_set_state (context, flags);
- gtk_style_context_set_direction (context, direction);
-
-G_GNUC_END_IGNORE_DEPRECATIONS;
-
- icon = gtk_icon_set_render_icon_pixbuf (icon_set, context, size);
-
- gtk_style_context_restore (context);
-
- return icon;
-}
-
/* Order sources by their "wildness", so that "wilder" sources are
* greater than “specific” sources; for determining ordering,
* direction beats state beats size.
diff --git a/gtk/deprecated/gtkiconfactory.h b/gtk/deprecated/gtkiconfactory.h
index 7b5c54023b..cdb99a6e82 100644
--- a/gtk/deprecated/gtkiconfactory.h
+++ b/gtk/deprecated/gtkiconfactory.h
@@ -146,15 +146,6 @@ void gtk_icon_set_unref (GtkIconSet *icon_set);
GDK_DEPRECATED_IN_3_10
GtkIconSet* gtk_icon_set_copy (GtkIconSet *icon_set);
-GDK_DEPRECATED_IN_3_0_FOR(gtk_icon_set_render_icon_pixbuf)
-GdkPixbuf* gtk_icon_set_render_icon (GtkIconSet *icon_set,
- GtkStyle *style,
- GtkTextDirection direction,
- GtkStateType state,
- GtkIconSize size,
- GtkWidget *widget,
- const gchar *detail);
-
GDK_DEPRECATED_IN_3_10
void gtk_icon_set_add_source (GtkIconSet *icon_set,
const GtkIconSource *source);
diff --git a/gtk/deprecated/gtkrc.c b/gtk/deprecated/gtkrc.c
deleted file mode 100644
index 93fa01dee3..0000000000
--- a/gtk/deprecated/gtkrc.c
+++ /dev/null
@@ -1,1966 +0,0 @@
-/* GTK - The GIMP Toolkit
- * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
- *
- * 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/>.
- */
-
-/*
- * Modified by the GTK+ Team and others 1997-2000. See the AUTHORS
- * file for a list of people on the GTK+ Team. See the ChangeLog
- * files for a list of changes. These files are distributed with
- * GTK+ at ftp://ftp.gtk.org/pub/gtk/.
- */
-
-#include "config.h"
-
-#include <locale.h>
-#ifdef HAVE_UNISTD_H
-#include <unistd.h>
-#endif
-#include <sys/stat.h>
-#ifdef HAVE_SYS_PARAM_H
-#include <sys/param.h>
-#endif
-#include <fcntl.h>
-#include <string.h>
-#include <stdio.h>
-#include <stdlib.h>
-
-#define GDK_DISABLE_DEPRECATION_WARNINGS
-
-#include <glib.h>
-#include <glib/gstdio.h>
-#include "gdk/gdk.h"
-
-#include "gtkversion.h"
-#include "gtkrc.h"
-#include "gtkstyle.h"
-#include "gtkbindings.h"
-#include "gtkintl.h"
-#include "gtkiconfactory.h"
-#include "gtkmain.h"
-#include "gtkmodules.h"
-#include "gtkmodulesprivate.h"
-#include "gtkprivate.h"
-#include "gtksettingsprivate.h"
-#include "gtkwidgetpath.h"
-#include "gtkwindow.h"
-
-#ifdef G_OS_WIN32
-#include <io.h>
-#endif
-
-
-/**
- * SECTION:gtkrc
- * @Short_description: Deprecated routines for handling resource files
- * @Title: Resource Files
- *
- * GTK+ provides resource file mechanism for configuring
- * various aspects of the operation of a GTK+ program
- * at runtime.
- *
- * > In GTK+ 3.0, resource files have been deprecated and replaced by
- * > CSS-like style sheets, which are understood by #GtkCssProvider.
- *
- * # Default Files #
- *
- * An application can cause GTK+ to parse a specific RC
- * file by calling gtk_rc_parse(). In addition to this,
- * certain files will be read at the end of gtk_init().
- * Unless modified, the files looked for will be
- * `SYSCONFDIR/gtk-2.0/gtkrc`
- * and `.gtkrc-3.0` in the users home directory.
- * (`SYSCONFDIR` defaults to
- * `/usr/local/etc`. It can be changed with the
- * `--prefix` or `--sysconfdir` options when
- * configuring GTK+.)
- *
- * The set of these “default” files
- * can be retrieved with gtk_rc_get_default_files()
- * and modified with gtk_rc_add_default_file() and
- * gtk_rc_set_default_files().
- * Additionally, the `GTK2_RC_FILES` environment variable
- * can be set to a #G_SEARCHPATH_SEPARATOR_S-separated list of files
- * in order to overwrite the set of default files at runtime.
- *
- * # Locale Specific Files # {#locale-specific-rc}
- *
- * For each RC file, in addition to the file itself, GTK+ will look for
- * a locale-specific file that will be parsed after the main file.
- * For instance, if `LANG` is set to `ja_JP.ujis`,
- * when loading the default file `~/.gtkrc` then GTK+ looks
- * for `~/.gtkrc.ja_JP` and `~/.gtkrc.ja`,
- * and parses the first of those that exists.
- *
- * # Pathnames and Patterns #
- *
- * A resource file defines a number of styles and key bindings and
- * attaches them to particular widgets. The attachment is done
- * by the `widget`, `widget_class`,
- * and `class` declarations. As an example
- * of such a statement:
- *
- * |[
- * widget "mywindow.*.GtkEntry" style "my-entry-class"
- * ]|
- *
- * attaches the style `"my-entry-class"` to all
- * widgets whose “widget path” matches the
- * “pattern” `"mywindow.*.GtkEntry"`.
- * That is, all #GtkEntry widgets which are part of a #GtkWindow named
- * `"mywindow"`.
- *
- * The patterns here are given in the standard shell glob syntax.
- * The `"?"` wildcard matches any character, while
- * `"*"` matches zero or more of any character.
- * The three types of matching are against the widget path, the
- * “class path” and the class hierarchy. Both the
- * widget path and the class path consist of a `"."`
- * separated list of all the parents of the widget and the widget itself
- * from outermost to innermost. The difference is that in the widget path,
- * the name assigned by gtk_widget_set_name() is used if present, otherwise
- * the class name of the widget, while for the class path, the class name is
- * always used.
- *
- * Since GTK+ 2.10, `widget_class` paths can also contain <classname>
- * substrings, which are matching the class with the given name and any
- * derived classes. For instance,
- * |[
- * widget_class "*<GtkMenuItem>.GtkLabel" style "my-style"
- * ]|
- * will match #GtkLabel widgets which are contained in any kind of menu item.
- *
- * So, if you have a #GtkEntry named `"myentry"`, inside of a horizontal
- * box in a window named `"mywindow"`, then the widget path is:
- * `"mywindow.GtkHBox.myentry"` while the class path is:
- * `"GtkWindow.GtkHBox.GtkEntry"`.
- *
- * Matching against class is a little different. The pattern match is done
- * against all class names in the widgets class hierarchy (not the layout
- * hierarchy) in sequence, so the pattern:
- * |[
- * class "GtkButton" style "my-style"
- * ]|
- * will match not just #GtkButton widgets, but also #GtkToggleButton and
- * #GtkCheckButton widgets, since those classes derive from #GtkButton.
- *
- * Additionally, a priority can be specified for each pattern, and styles
- * override other styles first by priority, then by pattern type and then
- * by order of specification (later overrides earlier). The priorities
- * that can be specified are (highest to lowest):
- *
- * - `highest`
- *
- * - `rc`
- *
- * - `theme`
- *
- * - `application`
- *
- * - `gtk`
- *
- * - `lowest`
- *
- * `rc` is the default for styles
- * read from an RC file, `theme`
- * is the default for styles read from theme RC files,
- * `application`
- * should be used for styles an application sets
- * up, and `gtk` is used for styles
- * that GTK+ creates internally.
- *
- * # Theme gtkrc Files #
- *
- * Theme RC files are loaded first from under the `~/.themes/`,
- * then from the directory from gtk_rc_get_theme_dir(). The files looked at will
- * be `gtk-3.0/gtkrc`.
- *
- * When the application prefers dark themes
- * (see the #GtkSettings:gtk-application-prefer-dark-theme property for details),
- * `gtk-3.0/gtkrc-dark` will be loaded first, and if not present
- * `gtk-3.0/gtkrc` will be loaded.
- *
- * # Optimizing RC Style Matches #
- *
- * Everytime a widget is created and added to the layout hierarchy of a #GtkWindow
- * ("anchored" to be exact), a list of matching RC styles out of all RC styles read
- * in so far is composed.
- * For this, every RC style is matched against the widgets class path,
- * the widgets name path and widgets inheritance hierarchy.
- * As a consequence, significant slowdown can be caused by utilization of many
- * RC styles and by using RC style patterns that are slow or complicated to match
- * against a given widget.
- * The following ordered list provides a number of advices (prioritized by
- * effectiveness) to reduce the performance overhead associated with RC style
- * matches:
- *
- * 1. Move RC styles for specific applications into RC files dedicated to those
- * applications and parse application specific RC files only from
- * applications that are affected by them.
- * This reduces the overall amount of RC styles that have to be considered
- * for a match across a group of applications.
- *
- * 2. Merge multiple styles which use the same matching rule, for instance:
- * |[
- * style "Foo" { foo_content }
- * class "X" style "Foo"
- * style "Bar" { bar_content }
- * class "X" style "Bar"
- * ]|
- * is faster to match as:
- * |[
- * style "FooBar" { foo_content bar_content }
- * class "X" style "FooBar"
- * ]|
- *
- * 3. Use of wildcards should be avoided, this can reduce the individual RC style
- * match to a single integer comparison in most cases.
- *
- * 4. To avoid complex recursive matching, specification of full class names
- * (for `class` matches) or full path names (for
- * `widget` and `widget_class` matches)
- * is to be preferred over shortened names
- * containing `"*"` or `"?"`.
- *
- * 5. If at all necessary, wildcards should only be used at the tail or head
- * of a pattern. This reduces the match complexity to a string comparison
- * per RC style.
- *
- * 6. When using wildcards, use of `"?"` should be preferred
- * over `"*"`. This can reduce the matching complexity from
- * O(n^2) to O(n). For example `"Gtk*Box"` can be turned into
- * `"Gtk?Box"` and will still match #GtkHBox and #GtkVBox.
- *
- * 7. The use of `"*"` wildcards should be restricted as much
- * as possible, because matching `"A*B*C*RestString"` can
- * result in matching complexities of O(n^2) worst case.
- *
- * # Toplevel Declarations #
- *
- * An RC file is a text file which is composed of a sequence
- * of declarations. `“#”` characters delimit comments and
- * the portion of a line after a `“#”` is ignored when parsing
- * an RC file.
- *
- * The possible toplevel declarations are:
- *
- * * `binding name
- * { ... }`
- *
- * Declares a binding set.
- *
- * * `class pattern
- * [ style | binding ][ : priority ]
- * name`
- *
- * Specifies a style or binding set for a particular
- * branch of the inheritance hierarchy.
- *
- * * `include filename`
- *
- * Parses another file at this point. If
- * filename is not an absolute filename,
- * it is searched in the directories of the currently open RC files.
- *
- * GTK+ also tries to load a
- * [locale-specific variant][locale-specific-rc] of
- * the included file.
- *
- * * `module_path path`
- *
- * Sets a path (a list of directories separated
- * by colons) that will be searched for theme engines referenced in
- * RC files.
- *
- * * `pixmap_path path`
- *
- * Sets a path (a list of directories separated
- * by colons) that will be searched for pixmaps referenced in
- * RC files.
- *
- * * `im_module_file pathname`
- *
- * Sets the pathname for the IM modules file. Setting this from RC files
- * is deprecated; you should use the environment variable `GTK_IM_MODULE_FILE`
- * instead.
- *
- * * `style name [ =
- * parent ] { ... }`
- *
- * Declares a style.
- *
- * * `widget pattern
- * [ style | binding ][ : priority ]
- * name`
- *
- * Specifies a style or binding set for a particular
- * group of widgets by matching on the widget pathname.
- *
- * * `widget_class pattern
- * [ style | binding ][ : priority ]
- * name`
- *
- * Specifies a style or binding set for a particular
- * group of widgets by matching on the class pathname.
- *
- * * setting = value
- *
- * Specifies a value for a [setting][GtkSettings].
- * Note that settings in RC files are overwritten by system-wide settings
- * (which are managed by an XSettings manager on X11).
- *
- * # Styles #
- *
- * A RC style is specified by a `style`
- * declaration in a RC file, and then bound to widgets
- * with a `widget`, `widget_class`,
- * or `class` declaration. All styles
- * applying to a particular widget are composited together
- * with `widget` declarations overriding
- * `widget_class` declarations which, in
- * turn, override `class` declarations.
- * Within each type of declaration, later declarations override
- * earlier ones.
- *
- * Within a `style` declaration, the possible
- * elements are:
- *
- * * `bg[state] = color`
- *
- * Sets the color used for the background of most widgets.
- *
- * * `fg[state] = color`
- *
- * Sets the color used for the foreground of most widgets.
- *
- * * `base[state] = color`
- *
- * Sets the color used for the background of widgets displaying
- * editable text. This color is used for the background
- * of, among others, #GtkTextView, #GtkEntry.
- *
- * * `text[state] =
- * color`
- *
- * Sets the color used for foreground of widgets using
- * `base` for the background color.
- *
- * * `xthickness =
- * number`
- *
- * Sets the xthickness, which is used for various horizontal padding
- * values in GTK+.
- *
- * * `ythickness =
- * number`
- *
- * Sets the ythickness, which is used for various vertical padding
- * values in GTK+.
- *
- * * `bg_pixmap[state] =
- * pixmap`
- *
- * Sets a background pixmap to be used in place of the `bg` color
- * (or for #GtkText, in place of the `base` color. The special
- * value `"<parent>"` may be used to indicate that the widget should
- * use the same background pixmap as its parent. The special value
- * `"<none>"` may be used to indicate no background pixmap.
-
- * * `font = font`
- *
- * Starting with GTK+ 2.0, the “font” and “fontset”
- * declarations are ignored; use “font_name” declarations instead.
- *
- * * `fontset = font`
- *
- * Starting with GTK+ 2.0, the “font” and “fontset”
- * declarations are ignored; use “font_name” declarations instead.
- *
- * * `font_name = font`
- *
- * Sets the font for a widget. font must be
- * a Pango font name, e.g. “Sans Italic 10” .
- * For details about Pango font names, see
- * pango_font_description_from_string().
- *
- * * `stock["stock-id"] = { icon source specifications }`
- *
- * Defines the icon for a stock item.
- *
- * * `color["color-name"] = color specification`
- *
- * Since 2.10, this element can be used to defines symbolic colors. See below for
- * the syntax of color specifications.
- *
- * * `engine "engine" { engine-specific
- * settings }`
- *
- * Defines the engine to be used when drawing with this style.
- *
- * * `class::property = value`
- *
- * Sets a [style property][style-properties] for a widget class.
- *
- * The colors and background pixmaps are specified as a function of the
- * state of the widget. The states are:
- *
- * * `NORMAL`
- *
- * A color used for a widget in its normal state.
- *
- * * `ACTIVE`
- *
- * A variant of the `NORMAL` color used when the
- * widget is in the %GTK_STATE_ACTIVE state, and also for
- * the trough of a ScrollBar, tabs of a NoteBook
- * other than the current tab and similar areas.
- * Frequently, this should be a darker variant
- * of the `NORMAL` color.
- *
- * * `PRELIGHT`
- *
- * A color used for widgets in the %GTK_STATE_PRELIGHT state. This
- * state is the used for Buttons and MenuItems
- * that have the mouse cursor over them, and for
- * their children.
- *
- * * `SELECTED`
- *
- * A color used to highlight data selected by the user.
- * for instance, the selected items in a list widget, and the
- * selection in an editable widget.
- *
- * * `INSENSITIVE`
- *
- * A color used for the background of widgets that have
- * been set insensitive with gtk_widget_set_sensitive().
- *
- * ## Color Format ## {#color-format}
- *
- * Colors can be specified as a string containing a color name (GTK+ knows
- * all names from the X color database `/usr/lib/X11/rgb.txt`),
- * in one of the hexadecimal forms `#rrrrggggbbbb`,
- * `#rrrgggbbb`, `#rrggbb`,
- * or `#rgb`, where `r`,
- * `g` and `b` are
- * hex digits, or they can be specified as a triplet
- * `{ r, g,
- * b}`, where `r`,
- * `g` and `b` are either integers in
- * the range 0-65535 or floats in the range 0.0-1.0.
- *
- * Since 2.10, colors can also be specified by refering to a symbolic color, as
- * follows: `@color-name`, or by using expressions to combine
- * colors. The following expressions are currently supported:
- *
- * * mix (factor, color1, color2)
- *
- * Computes a new color by mixing color1 and
- * color2. The factor
- * determines how close the new color is to color1.
- * A factor of 1.0 gives pure color1, a factor of
- * 0.0 gives pure color2.
- *
- * * shade (factor, color)
- *
- * Computes a lighter or darker variant of color.
- * A factor of 1.0 leaves the color unchanged, smaller
- * factors yield darker colors, larger factors yield lighter colors.
- *
- * * lighter (color)
- *
- * This is an abbreviation for
- * `shade (1.3, color)`.
- *
- * * darker (color)
- *
- * This is an abbreviation for
- * `shade (0.7, color)`.
- *
- * Here are some examples of color expressions:
- *
- * |[
- * mix (0.5, "red", "blue")
- * shade (1.5, mix (0.3, "#0abbc0", { 0.3, 0.5, 0.9 }))
- * lighter (@foreground)
- * ]|
- *
- * In a `stock` definition, icon sources are specified as a
- * 4-tuple of image filename or icon name, text direction, widget state, and size, in that
- * order. Each icon source specifies an image filename or icon name to use with a given
- * direction, state, and size. Filenames are specified as a string such
- * as `"itemltr.png"`, while icon names (looked up
- * in the current icon theme), are specified with a leading
- * `@`, such as `@"item-ltr"`.
- * The `*` character can be used as a
- * wildcard, and if direction/state/size are omitted they default to
- * `*`. So for example, the following specifies different icons to
- * use for left-to-right and right-to-left languages:
- *
- * |[<!-- language="C" -->
- * stock["my-stock-item"] =
- * {
- * { "itemltr.png", LTR, *, * },
- * { "itemrtl.png", RTL, *, * }
- * }
- * ]|
- *
- * This could be abbreviated as follows:
- *
- * |[<!-- language="C" -->
- * stock["my-stock-item"] =
- * {
- * { "itemltr.png", LTR },
- * { "itemrtl.png", RTL }
- * }
- * ]|
- *
- * You can specify custom icons for specific sizes, as follows:
- *
- * |[<!-- language="C" -->
- * stock["my-stock-item"] =
- * {
- * { "itemmenusize.png", *, *, "gtk-menu" },
- * { "itemtoolbarsize.png", *, *, "gtk-large-toolbar" }
- * { "itemgeneric.png" } // implicit *, *, * as a fallback
- * }
- * ]|
- *
- * The sizes that come with GTK+ itself are `"gtk-menu"`,
- * `"gtk-small-toolbar"`, `"gtk-large-toolbar"`,
- * `"gtk-button"`, `"gtk-dialog"`. Applications
- * can define other sizes.
- *
- * It’s also possible to use custom icons for a given state, for example:
- *
- * |[<!-- language="C" -->
- * stock["my-stock-item"] =
- * {
- * { "itemprelight.png", *, PRELIGHT },
- * { "iteminsensitive.png", *, INSENSITIVE },
- * { "itemgeneric.png" } // implicit *, *, * as a fallback
- * }
- * ]|
- *
- * When selecting an icon source to use, GTK+ will consider text direction most
- * important, state second, and size third. It will select the best match based on
- * those criteria. If an attribute matches exactly (e.g. you specified
- * `PRELIGHT` or specified the size), GTK+ won’t modify the image;
- * if the attribute matches with a wildcard, GTK+ will scale or modify the image to
- * match the state and size the user requested.
- *
- * # Key bindings #
- *
- * Key bindings allow the user to specify actions to be
- * taken on particular key presses. The form of a binding
- * set declaration is:
- *
- * |[
- * binding name {
- * bind key {
- * signalname (param, ...)
- * ...
- * }
- * ...
- * }
- * ]|
- *
- * `key` is a string consisting of a series of modifiers followed by
- * the name of a key. The modifiers can be:
- *
- * - `<alt>`
- *
- * - `<ctl>`
- *
- * - `<control>`
- *
- * - `<meta>`
- *
- * - `<hyper>`
- *
- * - `<super>`
- *
- * - `<mod1>`
- *
- * - `<mod2>`
- *
- * - `<mod3>`
- *
- * - `<mod4>`
- *
- * - `<mod5>`
- *
- * - `<release>`
- *
- * - `<shft>`
- *
- * - `<shift>`
- *
- * `<shft>` is an alias for `<shift>`, `<ctl>` is an alias for
- * `<control>`, and `<alt>` is an alias for `<mod1>`.
- *
- * The action that is bound to the key is a sequence of signal names
- * (strings) followed by parameters for each signal. The signals must
- * be action signals. (See g_signal_new()). Each parameter can be a
- * float, integer, string, or unquoted string representing an enumeration
- * value. The types of the parameters specified must match the types of
- * the parameters of the signal.
- *
- * Binding sets are connected to widgets in the same manner as styles,
- * with one difference: Binding sets override other binding sets first
- * by pattern type, then by priority and then by order of specification.
- * The priorities that can be specified and their default values are the
- * same as for styles.
- */
-
-
-enum
-{
- PATH_ELT_PSPEC,
- PATH_ELT_UNRESOLVED,
- PATH_ELT_TYPE
-};
-
-typedef struct
-{
- gint type;
- union
- {
- GType class_type;
- gchar *class_name;
- GPatternSpec *pspec;
- } elt;
-} PathElt;
-
-typedef struct {
- GSList *color_hashes;
-} GtkRcStylePrivate;
-
-#define GTK_RC_STYLE_GET_PRIVATE(obj) ((GtkRcStylePrivate *) gtk_rc_style_get_instance_private ((GtkRcStyle *) (obj)))
-
-static void gtk_rc_style_finalize (GObject *object);
-static void gtk_rc_style_real_merge (GtkRcStyle *dest,
- GtkRcStyle *src);
-static GtkRcStyle* gtk_rc_style_real_create_rc_style (GtkRcStyle *rc_style);
-static GtkStyle* gtk_rc_style_real_create_style (GtkRcStyle *rc_style);
-static gint gtk_rc_properties_cmp (gconstpointer bsearch_node1,
- gconstpointer bsearch_node2);
-
-static void insert_rc_property (GtkRcStyle *style,
- GtkRcProperty *property,
- gboolean replace);
-
-
-static const GScannerConfig gtk_rc_scanner_config =
-{
- (
- " \t\r\n"
- ) /* cset_skip_characters */,
- (
- "_"
- G_CSET_a_2_z
- G_CSET_A_2_Z
- ) /* cset_identifier_first */,
- (
- G_CSET_DIGITS
- "-_"
- G_CSET_a_2_z
- G_CSET_A_2_Z
- ) /* cset_identifier_nth */,
- ( "#\n" ) /* cpair_comment_single */,
-
- TRUE /* case_sensitive */,
-
- TRUE /* skip_comment_multi */,
- TRUE /* skip_comment_single */,
- TRUE /* scan_comment_multi */,
- TRUE /* scan_identifier */,
- FALSE /* scan_identifier_1char */,
- FALSE /* scan_identifier_NULL */,
- TRUE /* scan_symbols */,
- TRUE /* scan_binary */,
- TRUE /* scan_octal */,
- TRUE /* scan_float */,
- TRUE /* scan_hex */,
- TRUE /* scan_hex_dollar */,
- TRUE /* scan_string_sq */,
- TRUE /* scan_string_dq */,
- TRUE /* numbers_2_int */,
- FALSE /* int_2_float */,
- FALSE /* identifier_2_string */,
- TRUE /* char_2_token */,
- TRUE /* symbol_2_token */,
- FALSE /* scope_0_fallback */,
-};
-
-static GHashTable *realized_style_ht = NULL;
-
-static gchar *im_module_file = NULL;
-
-static gchar **gtk_rc_default_files = NULL;
-
-/* RC file handling */
-
-static gchar *
-gtk_rc_make_default_dir (const gchar *type)
-{
- const gchar *var;
- gchar *path;
-
- var = g_getenv ("GTK_EXE_PREFIX");
-
- if (var)
- path = g_build_filename (var, "lib", "gtk-3.0", GTK_BINARY_VERSION, type, NULL);
- else
- path = g_build_filename (_gtk_get_libdir (), "gtk-3.0", GTK_BINARY_VERSION, type, NULL);
-
- return path;
-}
-
-/**
- * gtk_rc_get_im_module_path:
- *
- * Obtains the path in which to look for IM modules. See the documentation
- * of the `GTK_PATH`
- * environment variable for more details about looking up modules. This
- * function is useful solely for utilities supplied with GTK+ and should
- * not be used by applications under normal circumstances.
- *
- * Returns: (type filename): a newly-allocated string containing the
- * path in which to look for IM modules.
- *
- * Deprecated: 3.0: Use #GtkCssProvider instead.
- */
-gchar *
-gtk_rc_get_im_module_path (void)
-{
- gchar **paths = _gtk_get_module_path ("immodules");
- gchar *result = g_strjoinv (G_SEARCHPATH_SEPARATOR_S, paths);
- g_strfreev (paths);
-
- return result;
-}
-
-/**
- * gtk_rc_get_im_module_file:
- *
- * Obtains the path to the IM modules file. See the documentation
- * of the `GTK_IM_MODULE_FILE`
- * environment variable for more details.
- *
- * Returns: (type filename): a newly-allocated string containing the
- * name of the file listing the IM modules available for loading
- *
- * Deprecated: 3.0: Use #GtkCssProvider instead.
- */
-gchar *
-gtk_rc_get_im_module_file (void)
-{
- const gchar *var = g_getenv ("GTK_IM_MODULE_FILE");
- gchar *result = NULL;
-
- if (var)
- result = g_strdup (var);
-
- if (!result)
- {
- if (im_module_file)
- result = g_strdup (im_module_file);
- else
- result = gtk_rc_make_default_dir ("immodules.cache");
- }
-
- return result;
-}
-
-/**
- * gtk_rc_get_theme_dir:
- *
- * Returns the standard directory in which themes should
- * be installed. (GTK+ does not actually use this directory
- * itself.)
- *
- * Returns: The directory (must be freed with g_free()).
- *
- * Deprecated: 3.0: Use #GtkCssProvider instead.
- */
-gchar *
-gtk_rc_get_theme_dir (void)
-{
- const gchar *var;
- gchar *path;
-
- var = g_getenv ("GTK_DATA_PREFIX");
-
- if (var)
- path = g_build_filename (var, "share", "themes", NULL);
- else
- path = g_build_filename (_gtk_get_data_prefix (), "share", "themes", NULL);
-
- return path;
-}
-
-/**
- * gtk_rc_get_module_dir:
- *
- * Returns a directory in which GTK+ looks for theme engines.
- * For full information about the search for theme engines,
- * see the docs for `GTK_PATH` in [Running GTK+ Applications][gtk-running].
- *
- * return value: (type filename): the directory. (Must be freed with g_free())
- *
- * Deprecated: 3.0: Use #GtkCssProvider instead.
- **/
-gchar *
-gtk_rc_get_module_dir (void)
-{
- return gtk_rc_make_default_dir ("engines");
-}
-
-/**
- * gtk_rc_add_default_file:
- * @filename: (type filename): the pathname to the file. If @filename
- * is not absolute, it is searched in the current directory.
- *
- * Adds a file to the list of files to be parsed at the
- * end of gtk_init().
- *
- * Deprecated:3.0: Use #GtkStyleContext with a custom #GtkStyleProvider instead
- **/
-void
-gtk_rc_add_default_file (const gchar *filename)
-{
-}
-
-/**
- * gtk_rc_set_default_files:
- * @filenames: (array zero-terminated=1) (element-type filename): A
- * %NULL-terminated list of filenames.
- *
- * Sets the list of files that GTK+ will read at the
- * end of gtk_init().
- *
- * Deprecated:3.0: Use #GtkStyleContext with a custom #GtkStyleProvider instead
- **/
-void
-gtk_rc_set_default_files (gchar **filenames)
-{
-}
-
-/**
- * gtk_rc_get_default_files:
- *
- * Retrieves the current list of RC files that will be parsed
- * at the end of gtk_init().
- *
- * Returns: (transfer none) (array zero-terminated=1) (element-type filename):
- * A %NULL-terminated array of filenames. This memory is owned
- * by GTK+ and must not be freed by the application. If you want
- * to store this information, you should make a copy.
- *
- * Deprecated:3.0: Use #GtkStyleContext instead
- **/
-gchar **
-gtk_rc_get_default_files (void)
-{
- return gtk_rc_default_files;
-}
-
-/**
- * gtk_rc_parse_string:
- * @rc_string: a string to parse.
- *
- * Parses resource information directly from a string.
- *
- * Deprecated: 3.0: Use #GtkCssProvider instead.
- */
-void
-gtk_rc_parse_string (const gchar *rc_string)
-{
- g_return_if_fail (rc_string != NULL);
-}
-
-/**
- * gtk_rc_parse:
- * @filename: the filename of a file to parse. If @filename is not absolute, it
- * is searched in the current directory.
- *
- * Parses a given resource file.
- *
- * Deprecated: 3.0: Use #GtkCssProvider instead.
- */
-void
-gtk_rc_parse (const gchar *filename)
-{
- g_return_if_fail (filename != NULL);
-}
-
-/* Handling of RC styles */
-
-G_DEFINE_TYPE_WITH_PRIVATE (GtkRcStyle, gtk_rc_style, G_TYPE_OBJECT)
-
-static void
-gtk_rc_style_init (GtkRcStyle *style)
-{
- GtkRcStylePrivate *priv = GTK_RC_STYLE_GET_PRIVATE (style);
- guint i;
-
- style->name = NULL;
- style->font_desc = NULL;
-
- for (i = 0; i < 5; i++)
- {
- static const GdkColor init_color = { 0, 0, 0, 0, };
-
- style->bg_pixmap_name[i] = NULL;
- style->color_flags[i] = 0;
- style->fg[i] = init_color;
- style->bg[i] = init_color;
- style->text[i] = init_color;
- style->base[i] = init_color;
- }
- style->xthickness = -1;
- style->ythickness = -1;
- style->rc_properties = NULL;
-
- style->rc_style_lists = NULL;
- style->icon_factories = NULL;
-
- priv->color_hashes = NULL;
-}
-
-static void
-gtk_rc_style_class_init (GtkRcStyleClass *klass)
-{
- GObjectClass *object_class = G_OBJECT_CLASS (klass);
-
- object_class->finalize = gtk_rc_style_finalize;
-
- klass->parse = NULL;
- klass->create_rc_style = gtk_rc_style_real_create_rc_style;
- klass->merge = gtk_rc_style_real_merge;
- klass->create_style = gtk_rc_style_real_create_style;
-}
-
-static void
-gtk_rc_style_finalize (GObject *object)
-{
- GSList *tmp_list1, *tmp_list2;
- GtkRcStyle *rc_style;
- GtkRcStylePrivate *rc_priv;
- gint i;
-
- rc_style = GTK_RC_STYLE (object);
- rc_priv = GTK_RC_STYLE_GET_PRIVATE (rc_style);
-
- g_free (rc_style->name);
- if (rc_style->font_desc)
- pango_font_description_free (rc_style->font_desc);
-
- for (i = 0; i < 5; i++)
- g_free (rc_style->bg_pixmap_name[i]);
-
- /* Now remove all references to this rc_style from
- * realized_style_ht
- */
- tmp_list1 = rc_style->rc_style_lists;
- while (tmp_list1)
- {
- GSList *rc_styles = tmp_list1->data;
- GtkStyle *style = g_hash_table_lookup (realized_style_ht, rc_styles);
- g_object_unref (style);
-
- /* Remove the list of styles from the other rc_styles
- * in the list
- */
- tmp_list2 = rc_styles;
- while (tmp_list2)
- {
- GtkRcStyle *other_style = tmp_list2->data;
-
- if (other_style != rc_style)
- other_style->rc_style_lists = g_slist_remove_all (other_style->rc_style_lists,
- rc_styles);
- tmp_list2 = tmp_list2->next;
- }
-
- /* And from the hash table itself
- */
- g_hash_table_remove (realized_style_ht, rc_styles);
- g_slist_free (rc_styles);
-
- tmp_list1 = tmp_list1->next;
- }
- g_slist_free (rc_style->rc_style_lists);
-
- if (rc_style->rc_properties)
- {
- for (i = 0; i < rc_style->rc_properties->len; i++)
- {
- GtkRcProperty *node = &g_array_index (rc_style->rc_properties, GtkRcProperty, i);
-
- g_free (node->origin);
- g_value_unset (&node->value);
- }
- g_array_free (rc_style->rc_properties, TRUE);
- rc_style->rc_properties = NULL;
- }
-
- g_slist_free_full (rc_style->icon_factories, g_object_unref);
- g_slist_free_full (rc_priv->color_hashes, (GDestroyNotify)g_hash_table_unref);
-
- G_OBJECT_CLASS (gtk_rc_style_parent_class)->finalize (object);
-}
-
-/**
- * gtk_rc_style_new:
- *
- * Creates a new #GtkRcStyle with no fields set and
- * a reference count of 1.
- *
- * Returns: the newly-created #GtkRcStyle
- *
- * Deprecated: 3.0: Use #GtkCssProvider instead.
- */
-GtkRcStyle *
-gtk_rc_style_new (void)
-{
- GtkRcStyle *style;
-
- style = g_object_new (GTK_TYPE_RC_STYLE, NULL);
-
- return style;
-}
-
-/**
- * gtk_rc_style_copy:
- * @orig: the style to copy
- *
- * Makes a copy of the specified #GtkRcStyle. This function
- * will correctly copy an RC style that is a member of a class
- * derived from #GtkRcStyle.
- *
- * Returns: (transfer full): the resulting #GtkRcStyle
- *
- * Deprecated: 3.0: Use #GtkCssProvider instead.
- **/
-GtkRcStyle *
-gtk_rc_style_copy (GtkRcStyle *orig)
-{
- GtkRcStyle *style;
-
- g_return_val_if_fail (GTK_IS_RC_STYLE (orig), NULL);
-
- style = GTK_RC_STYLE_GET_CLASS (orig)->create_rc_style (orig);
- GTK_RC_STYLE_GET_CLASS (style)->merge (style, orig);
-
- return style;
-}
-
-static GtkRcStyle *
-gtk_rc_style_real_create_rc_style (GtkRcStyle *style)
-{
- return g_object_new (G_OBJECT_TYPE (style), NULL);
-}
-
-static gint
-gtk_rc_properties_cmp (gconstpointer bsearch_node1,
- gconstpointer bsearch_node2)
-{
- const GtkRcProperty *prop1 = bsearch_node1;
- const GtkRcProperty *prop2 = bsearch_node2;
-
- if (prop1->type_name == prop2->type_name)
- return prop1->property_name < prop2->property_name ? -1 : prop1->property_name == prop2->property_name ? 0 : 1;
- else
- return prop1->type_name < prop2->type_name ? -1 : 1;
-}
-
-static void
-insert_rc_property (GtkRcStyle *style,
- GtkRcProperty *property,
- gboolean replace)
-{
- guint i;
- GtkRcProperty *new_property = NULL;
- GtkRcProperty key = { 0, 0, NULL, { 0, }, };
-
- key.type_name = property->type_name;
- key.property_name = property->property_name;
-
- if (!style->rc_properties)
- style->rc_properties = g_array_new (FALSE, FALSE, sizeof (GtkRcProperty));
-
- i = 0;
- while (i < style->rc_properties->len)
- {
- gint cmp = gtk_rc_properties_cmp (&key, &g_array_index (style->rc_properties, GtkRcProperty, i));
-
- if (cmp == 0)
- {
- if (replace)
- {
- new_property = &g_array_index (style->rc_properties, GtkRcProperty, i);
-
- g_free (new_property->origin);
- g_value_unset (&new_property->value);
-
- *new_property = key;
- break;
- }
- else
- return;
- }
- else if (cmp < 0)
- break;
-
- i++;
- }
-
- if (!new_property)
- {
- g_array_insert_val (style->rc_properties, i, key);
- new_property = &g_array_index (style->rc_properties, GtkRcProperty, i);
- }
-
- new_property->origin = g_strdup (property->origin);
- g_value_init (&new_property->value, G_VALUE_TYPE (&property->value));
- g_value_copy (&property->value, &new_property->value);
-}
-
-static void
-gtk_rc_style_real_merge (GtkRcStyle *dest,
- GtkRcStyle *src)
-{
- gint i;
-
- for (i = 0; i < 5; i++)
- {
- if (!dest->bg_pixmap_name[i] && src->bg_pixmap_name[i])
- dest->bg_pixmap_name[i] = g_strdup (src->bg_pixmap_name[i]);
-
- if (!(dest->color_flags[i] & GTK_RC_FG) &&
- src->color_flags[i] & GTK_RC_FG)
- {
- dest->fg[i] = src->fg[i];
- dest->color_flags[i] |= GTK_RC_FG;
- }
- if (!(dest->color_flags[i] & GTK_RC_BG) &&
- src->color_flags[i] & GTK_RC_BG)
- {
- dest->bg[i] = src->bg[i];
- dest->color_flags[i] |= GTK_RC_BG;
- }
- if (!(dest->color_flags[i] & GTK_RC_TEXT) &&
- src->color_flags[i] & GTK_RC_TEXT)
- {
- dest->text[i] = src->text[i];
- dest->color_flags[i] |= GTK_RC_TEXT;
- }
- if (!(dest->color_flags[i] & GTK_RC_BASE) &&
- src->color_flags[i] & GTK_RC_BASE)
- {
- dest->base[i] = src->base[i];
- dest->color_flags[i] |= GTK_RC_BASE;
- }
- }
-
- if (dest->xthickness < 0 && src->xthickness >= 0)
- dest->xthickness = src->xthickness;
- if (dest->ythickness < 0 && src->ythickness >= 0)
- dest->ythickness = src->ythickness;
-
- if (src->font_desc)
- {
- if (!dest->font_desc)
- dest->font_desc = pango_font_description_copy (src->font_desc);
- else
- pango_font_description_merge (dest->font_desc, src->font_desc, FALSE);
- }
-
- if (src->rc_properties)
- {
- for (i = 0; i < src->rc_properties->len; i++)
- insert_rc_property (dest,
- &g_array_index (src->rc_properties, GtkRcProperty, i),
- FALSE);
- }
-}
-
-static GtkStyle *
-gtk_rc_style_real_create_style (GtkRcStyle *rc_style)
-{
- return gtk_style_new ();
-}
-
-/**
- * gtk_rc_reset_styles:
- * @settings: a #GtkSettings
- *
- * This function recomputes the styles for all widgets that use a
- * particular #GtkSettings object. (There is one #GtkSettings object
- * per #GdkScreen, see gtk_settings_get_for_screen()); It is useful
- * when some global parameter has changed that affects the appearance
- * of all widgets, because when a widget gets a new style, it will
- * both redraw and recompute any cached information about its
- * appearance. As an example, it is used when the default font size
- * set by the operating system changes. Note that this function
- * doesn’t affect widgets that have a style set explicitly on them
- * with gtk_widget_set_style().
- *
- * Since: 2.4
- *
- * Deprecated: 3.0: Use #GtkCssProvider instead.
- **/
-void
-gtk_rc_reset_styles (GtkSettings *settings)
-{
- gtk_style_context_reset_widgets (_gtk_settings_get_screen (settings));
-}
-
-/**
- * gtk_rc_reparse_all_for_settings:
- * @settings: a #GtkSettings
- * @force_load: load whether or not anything changed
- *
- * If the modification time on any previously read file
- * for the given #GtkSettings has changed, discard all style information
- * and then reread all previously read RC files.
- *
- * Returns: %TRUE if the files were reread.
- *
- * Deprecated: 3.0: Use #GtkCssProvider instead.
- **/
-gboolean
-gtk_rc_reparse_all_for_settings (GtkSettings *settings,
- gboolean force_load)
-{
- return FALSE;
-}
-
-/**
- * gtk_rc_reparse_all:
- *
- * If the modification time on any previously read file for the
- * default #GtkSettings has changed, discard all style information
- * and then reread all previously read RC files.
- *
- * Returns: %TRUE if the files were reread.
- *
- * Deprecated: 3.0: Use #GtkCssProvider instead.
- **/
-gboolean
-gtk_rc_reparse_all (void)
-{
- return FALSE;
-}
-
-/**
- * gtk_rc_get_style:
- * @widget: a #GtkWidget
- *
- * Finds all matching RC styles for a given widget,
- * composites them together, and then creates a
- * #GtkStyle representing the composite appearance.
- * (GTK+ actually keeps a cache of previously
- * created styles, so a new style may not be
- * created.)
- *
- * Returns: (transfer none): the resulting style. No refcount is added
- * to the returned style, so if you want to save this style around,
- * you should add a reference yourself.
- *
- * Deprecated:3.0: Use #GtkStyleContext instead
- **/
-GtkStyle *
-gtk_rc_get_style (GtkWidget *widget)
-{
- g_return_val_if_fail (GTK_IS_WIDGET (widget), NULL);
-
- gtk_widget_ensure_style (widget);
-
- return gtk_widget_get_style (widget);
-}
-
-/**
- * gtk_rc_get_style_by_paths:
- * @settings: a #GtkSettings object
- * @widget_path: (allow-none): the widget path to use when looking up the
- * style, or %NULL if no matching against the widget path should be done
- * @class_path: (allow-none): the class path to use when looking up the style,
- * or %NULL if no matching against the class path should be done.
- * @type: a type that will be used along with parent types of this type
- * when matching against class styles, or #G_TYPE_NONE
- *
- * Creates up a #GtkStyle from styles defined in a RC file by providing
- * the raw components used in matching. This function may be useful
- * when creating pseudo-widgets that should be themed like widgets but
- * don’t actually have corresponding GTK+ widgets. An example of this
- * would be items inside a GNOME canvas widget.
- *
- * The action of gtk_rc_get_style() is similar to:
- * |[<!-- language="C" -->
- * gtk_widget_path (widget, NULL, &path, NULL);
- * gtk_widget_class_path (widget, NULL, &class_path, NULL);
- * gtk_rc_get_style_by_paths (gtk_widget_get_settings (widget),
- * path, class_path,
- * G_OBJECT_TYPE (widget));
- * ]|
- *
- * Returns: (nullable) (transfer none): A style created by matching
- * with the supplied paths, or %NULL if nothing matching was
- * specified and the default style should be used. The returned
- * value is owned by GTK+ as part of an internal cache, so you
- * must call g_object_ref() on the returned value if you want to
- * keep a reference to it.
- *
- * Deprecated:3.0: Use #GtkStyleContext instead
- **/
-GtkStyle *
-gtk_rc_get_style_by_paths (GtkSettings *settings,
- const char *widget_path,
- const char *class_path,
- GType type)
-{
- GtkWidgetPath *path;
- GtkStyle *style;
-
- path = gtk_widget_path_new ();
-
- /* For compatibility, we return a GtkStyle based on a GtkStyleContext
- * with a GtkWidgetPath appropriate for the supplied information.
- *
- * GtkWidgetPath is composed of a list of GTypes with optional names;
- * In GTK+-2.0, widget_path consisted of the widget names, or
- * the class names for unnamed widgets, while class_path had the
- * class names always. So, use class_path to determine the GTypes
- * and extract widget names from widget_path as applicable.
- */
- if (class_path == NULL)
- {
- gtk_widget_path_append_type (path, type == G_TYPE_NONE ? GTK_TYPE_WIDGET : type);
- }
- else
- {
- const gchar *widget_p, *widget_next;
- const gchar *class_p, *class_next;
-
- widget_next = widget_path;
- class_next = class_path;
-
- while (*class_next)
- {
- GType component_type;
- gchar *component_class;
- gchar *component_name;
- gint pos;
-
- class_p = class_next;
- if (*class_p == '.')
- class_p++;
-
- widget_p = widget_next; /* Might be NULL */
- if (widget_p && *widget_p == '.')
- widget_p++;
-
- class_next = strchr (class_p, '.');
- if (class_next == NULL)
- class_next = class_p + strlen (class_p);
-
- if (widget_p)
- {
- widget_next = strchr (widget_p, '.');
- if (widget_next == NULL)
- widget_next = widget_p + strlen (widget_p);
- }
-
- component_class = g_strndup (class_p, class_next - class_p);
- if (widget_p && *widget_p)
- component_name = g_strndup (widget_p, widget_next - widget_p);
- else
- component_name = NULL;
-
- component_type = g_type_from_name (component_class);
- if (component_type == G_TYPE_INVALID)
- component_type = GTK_TYPE_WIDGET;
-
- pos = gtk_widget_path_append_type (path, component_type);
- if (component_name != NULL && strcmp (component_name, component_name) != 0)
- gtk_widget_path_iter_set_name (path, pos, component_name);
-
- g_free (component_class);
- g_free (component_name);
- }
- }
-
- style = _gtk_style_new_for_path (_gtk_settings_get_screen (settings),
- path);
-
- gtk_widget_path_free (path);
-
- return style;
-}
-
-/**
- * gtk_rc_scanner_new: (skip)
- *
- * Deprecated:3.0: Use #GtkCssProvider instead
- */
-GScanner*
-gtk_rc_scanner_new (void)
-{
- return g_scanner_new (&gtk_rc_scanner_config);
-}
-
-/*********************
- * Parsing functions *
- *********************/
-
-static gboolean
-lookup_color (GtkRcStyle *style,
- const char *color_name,
- GdkColor *color)
-{
- GtkRcStylePrivate *priv = GTK_RC_STYLE_GET_PRIVATE (style);
- GSList *iter;
-
- for (iter = priv->color_hashes; iter != NULL; iter = iter->next)
- {
- GHashTable *hash = iter->data;
- GdkColor *match = g_hash_table_lookup (hash, color_name);
-
- if (match)
- {
- color->red = match->red;
- color->green = match->green;
- color->blue = match->blue;
- return TRUE;
- }
- }
-
- return FALSE;
-}
-
-/**
- * gtk_rc_find_pixmap_in_path:
- * @settings: a #GtkSettings
- * @scanner: Scanner used to get line number information for the
- * warning message, or %NULL
- * @pixmap_file: name of the pixmap file to locate.
- *
- * Looks up a file in pixmap path for the specified #GtkSettings.
- * If the file is not found, it outputs a warning message using
- * g_warning() and returns %NULL.
- *
- * Returns: (type filename): the filename.
- *
- * Deprecated: 3.0: Use #GtkCssProvider instead.
- **/
-gchar*
-gtk_rc_find_pixmap_in_path (GtkSettings *settings,
- GScanner *scanner,
- const gchar *pixmap_file)
-{
- g_warning ("Unable to locate image file in pixmap_path: \"%s\"",
- pixmap_file);
- return NULL;
-}
-
-/**
- * gtk_rc_find_module_in_path:
- * @module_file: name of a theme engine
- *
- * Searches for a theme engine in the GTK+ search path. This function
- * is not useful for applications and should not be used.
- *
- * Returns: (type filename): The filename, if found (must be
- * freed with g_free()), otherwise %NULL.
- *
- * Deprecated: 3.0: Use #GtkCssProvider instead.
- **/
-gchar*
-gtk_rc_find_module_in_path (const gchar *module_file)
-{
- return _gtk_find_module (module_file, "engines");
-}
-
-/**
- * gtk_rc_parse_state:
- * @scanner: a #GScanner (must be initialized for parsing an RC file)
- * @state: (out): A pointer to a #GtkStateType variable in which to
- * store the result.
- *
- * Parses a #GtkStateType variable from the format expected
- * in a RC file.
- *
- * Returns: %G_TOKEN_NONE if parsing succeeded, otherwise the token
- * that was expected but not found.
- *
- * Deprecated: 3.0: Use #GtkCssProvider instead
- */
-guint
-gtk_rc_parse_state (GScanner *scanner,
- GtkStateType *state)
-{
- guint old_scope;
- guint token;
-
- g_return_val_if_fail (scanner != NULL, G_TOKEN_ERROR);
- g_return_val_if_fail (state != NULL, G_TOKEN_ERROR);
-
- /* we don't know where we got called from, so we reset the scope here.
- * if we bail out due to errors, we *don't* reset the scope, so the
- * error messaging code can make sense of our tokens.
- */
- old_scope = g_scanner_set_scope (scanner, 0);
-
- token = g_scanner_get_next_token (scanner);
- if (token != G_TOKEN_LEFT_BRACE)
- return G_TOKEN_LEFT_BRACE;
-
- token = g_scanner_get_next_token (scanner);
- switch (token)
- {
- case GTK_RC_TOKEN_ACTIVE:
- *state = GTK_STATE_ACTIVE;
- break;
- case GTK_RC_TOKEN_INSENSITIVE:
- *state = GTK_STATE_INSENSITIVE;
- break;
- case GTK_RC_TOKEN_NORMAL:
- *state = GTK_STATE_NORMAL;
- break;
- case GTK_RC_TOKEN_PRELIGHT:
- *state = GTK_STATE_PRELIGHT;
- break;
- case GTK_RC_TOKEN_SELECTED:
- *state = GTK_STATE_SELECTED;
- break;
- default:
- return /* G_TOKEN_SYMBOL */ GTK_RC_TOKEN_NORMAL;
- }
-
- token = g_scanner_get_next_token (scanner);
- if (token != G_TOKEN_RIGHT_BRACE)
- return G_TOKEN_RIGHT_BRACE;
-
- g_scanner_set_scope (scanner, old_scope);
-
- return G_TOKEN_NONE;
-}
-
-/**
- * gtk_rc_parse_priority:
- * @scanner: a #GScanner (must be initialized for parsing an RC file)
- * @priority: A pointer to #GtkPathPriorityType variable in which
- * to store the result.
- *
- * Parses a #GtkPathPriorityType variable from the format expected
- * in a RC file.
- *
- * Returns: %G_TOKEN_NONE if parsing succeeded, otherwise the token
- * that was expected but not found.
- *
- * Deprecated:3.0: Use #GtkCssProvider instead
- */
-guint
-gtk_rc_parse_priority (GScanner *scanner,
- GtkPathPriorityType *priority)
-{
- guint old_scope;
- guint token;
-
- g_return_val_if_fail (scanner != NULL, G_TOKEN_ERROR);
- g_return_val_if_fail (priority != NULL, G_TOKEN_ERROR);
-
- /* we don't know where we got called from, so we reset the scope here.
- * if we bail out due to errors, we *don't* reset the scope, so the
- * error messaging code can make sense of our tokens.
- */
- old_scope = g_scanner_set_scope (scanner, 0);
-
- token = g_scanner_get_next_token (scanner);
- if (token != ':')
- return ':';
-
- token = g_scanner_get_next_token (scanner);
- switch (token)
- {
- case GTK_RC_TOKEN_LOWEST:
- *priority = GTK_PATH_PRIO_LOWEST;
- break;
- case GTK_RC_TOKEN_GTK:
- *priority = GTK_PATH_PRIO_GTK;
- break;
- case GTK_RC_TOKEN_APPLICATION:
- *priority = GTK_PATH_PRIO_APPLICATION;
- break;
- case GTK_RC_TOKEN_THEME:
- *priority = GTK_PATH_PRIO_THEME;
- break;
- case GTK_RC_TOKEN_RC:
- *priority = GTK_PATH_PRIO_RC;
- break;
- case GTK_RC_TOKEN_HIGHEST:
- *priority = GTK_PATH_PRIO_HIGHEST;
- break;
- default:
- return /* G_TOKEN_SYMBOL */ GTK_RC_TOKEN_APPLICATION;
- }
-
- g_scanner_set_scope (scanner, old_scope);
-
- return G_TOKEN_NONE;
-}
-
-/**
- * gtk_rc_parse_color:
- * @scanner: a #GScanner
- * @color: (out): a pointer to a #GdkColor in which to store
- * the result
- *
- * Parses a color in the format expected
- * in a RC file.
- *
- * Note that theme engines should use gtk_rc_parse_color_full() in
- * order to support symbolic colors.
- *
- * Returns: %G_TOKEN_NONE if parsing succeeded, otherwise the token
- * that was expected but not found
- *
- * Deprecated:3.0: Use #GtkCssProvider instead
- */
-guint
-gtk_rc_parse_color (GScanner *scanner,
- GdkColor *color)
-{
- return gtk_rc_parse_color_full (scanner, NULL, color);
-}
-
-/**
- * gtk_rc_parse_color_full:
- * @scanner: a #GScanner
- * @style: (allow-none): a #GtkRcStyle, or %NULL
- * @color: (out): a pointer to a #GdkColor in which to store
- * the result
- *
- * Parses a color in the format expected
- * in a RC file. If @style is not %NULL, it will be consulted to resolve
- * references to symbolic colors.
- *
- * Returns: %G_TOKEN_NONE if parsing succeeded, otherwise the token
- * that was expected but not found
- *
- * Since: 2.12
- *
- * Deprecated:3.0: Use #GtkCssProvider instead
- */
-guint
-gtk_rc_parse_color_full (GScanner *scanner,
- GtkRcStyle *style,
- GdkColor *color)
-{
- guint token;
-
- g_return_val_if_fail (scanner != NULL, G_TOKEN_ERROR);
-
- /* we don't need to set our own scope here, because
- * we don't need own symbols
- */
-
- token = g_scanner_get_next_token (scanner);
- switch (token)
- {
- gint token_int;
- GdkColor c1, c2;
- gboolean negate;
- gdouble l;
-
- case G_TOKEN_LEFT_CURLY:
- token = g_scanner_get_next_token (scanner);
- if (token == G_TOKEN_INT)
- token_int = scanner->value.v_int;
- else if (token == G_TOKEN_FLOAT)
- token_int = scanner->value.v_float * 65535.0;
- else
- return G_TOKEN_FLOAT;
- color->red = CLAMP (token_int, 0, 65535);
-
- token = g_scanner_get_next_token (scanner);
- if (token != G_TOKEN_COMMA)
- return G_TOKEN_COMMA;
-
- token = g_scanner_get_next_token (scanner);
- if (token == G_TOKEN_INT)
- token_int = scanner->value.v_int;
- else if (token == G_TOKEN_FLOAT)
- token_int = scanner->value.v_float * 65535.0;
- else
- return G_TOKEN_FLOAT;
- color->green = CLAMP (token_int, 0, 65535);
-
- token = g_scanner_get_next_token (scanner);
- if (token != G_TOKEN_COMMA)
- return G_TOKEN_COMMA;
-
- token = g_scanner_get_next_token (scanner);
- if (token == G_TOKEN_INT)
- token_int = scanner->value.v_int;
- else if (token == G_TOKEN_FLOAT)
- token_int = scanner->value.v_float * 65535.0;
- else
- return G_TOKEN_FLOAT;
- color->blue = CLAMP (token_int, 0, 65535);
-
- token = g_scanner_get_next_token (scanner);
- if (token != G_TOKEN_RIGHT_CURLY)
- return G_TOKEN_RIGHT_CURLY;
- return G_TOKEN_NONE;
-
- case G_TOKEN_STRING:
- if (!gdk_color_parse (scanner->value.v_string, color))
- {
- g_scanner_warn (scanner, "Invalid color constant '%s'",
- scanner->value.v_string);
- return G_TOKEN_STRING;
- }
- return G_TOKEN_NONE;
-
- case '@':
- token = g_scanner_get_next_token (scanner);
- if (token != G_TOKEN_IDENTIFIER)
- return G_TOKEN_IDENTIFIER;
-
- if (!style || !lookup_color (style, scanner->value.v_identifier, color))
- {
- g_scanner_warn (scanner, "Invalid symbolic color '%s'",
- scanner->value.v_identifier);
- return G_TOKEN_IDENTIFIER;
- }
-
- return G_TOKEN_NONE;
-
- case G_TOKEN_IDENTIFIER:
- if (strcmp (scanner->value.v_identifier, "mix") == 0)
- {
- token = g_scanner_get_next_token (scanner);
- if (token != G_TOKEN_LEFT_PAREN)
- return G_TOKEN_LEFT_PAREN;
-
- negate = FALSE;
- if (g_scanner_peek_next_token (scanner) == '-')
- {
- g_scanner_get_next_token (scanner); /* eat sign */
- negate = TRUE;
- }
-
- token = g_scanner_get_next_token (scanner);
- if (token != G_TOKEN_FLOAT)
- return G_TOKEN_FLOAT;
-
- l = negate ? -scanner->value.v_float : scanner->value.v_float;
-
- token = g_scanner_get_next_token (scanner);
- if (token != G_TOKEN_COMMA)
- return G_TOKEN_COMMA;
-
- token = gtk_rc_parse_color_full (scanner, style, &c1);
- if (token != G_TOKEN_NONE)
- return token;
-
- token = g_scanner_get_next_token (scanner);
- if (token != G_TOKEN_COMMA)
- return G_TOKEN_COMMA;
-
- token = gtk_rc_parse_color_full (scanner, style, &c2);
- if (token != G_TOKEN_NONE)
- return token;
-
- token = g_scanner_get_next_token (scanner);
- if (token != G_TOKEN_RIGHT_PAREN)
- return G_TOKEN_RIGHT_PAREN;
-
- color->red = l * c1.red + (1.0 - l) * c2.red;
- color->green = l * c1.green + (1.0 - l) * c2.green;
- color->blue = l * c1.blue + (1.0 - l) * c2.blue;
-
- return G_TOKEN_NONE;
- }
- else if (strcmp (scanner->value.v_identifier, "shade") == 0)
- {
- token = g_scanner_get_next_token (scanner);
- if (token != G_TOKEN_LEFT_PAREN)
- return G_TOKEN_LEFT_PAREN;
-
- negate = FALSE;
- if (g_scanner_peek_next_token (scanner) == '-')
- {
- g_scanner_get_next_token (scanner); /* eat sign */
- negate = TRUE;
- }
-
- token = g_scanner_get_next_token (scanner);
- if (token != G_TOKEN_FLOAT)
- return G_TOKEN_FLOAT;
-
- l = negate ? -scanner->value.v_float : scanner->value.v_float;
-
- token = g_scanner_get_next_token (scanner);
- if (token != G_TOKEN_COMMA)
- return G_TOKEN_COMMA;
-
- token = gtk_rc_parse_color_full (scanner, style, &c1);
- if (token != G_TOKEN_NONE)
- return token;
-
- token = g_scanner_get_next_token (scanner);
- if (token != G_TOKEN_RIGHT_PAREN)
- return G_TOKEN_RIGHT_PAREN;
-
- _gtk_style_shade (&c1, color, l);
-
- return G_TOKEN_NONE;
- }
- else if (strcmp (scanner->value.v_identifier, "lighter") == 0 ||
- strcmp (scanner->value.v_identifier, "darker") == 0)
- {
- if (scanner->value.v_identifier[0] == 'l')
- l = 1.3;
- else
- l = 0.7;
-
- token = g_scanner_get_next_token (scanner);
- if (token != G_TOKEN_LEFT_PAREN)
- return G_TOKEN_LEFT_PAREN;
-
- token = gtk_rc_parse_color_full (scanner, style, &c1);
- if (token != G_TOKEN_NONE)
- return token;
-
- token = g_scanner_get_next_token (scanner);
- if (token != G_TOKEN_RIGHT_PAREN)
- return G_TOKEN_RIGHT_PAREN;
-
- _gtk_style_shade (&c1, color, l);
-
- return G_TOKEN_NONE;
- }
- else
- return G_TOKEN_IDENTIFIER;
-
- default:
- return G_TOKEN_STRING;
- }
-}
-
-typedef struct {
- GtkPathType type;
- GPatternSpec *pspec;
- gpointer user_data;
- guint seq_id;
-} PatternSpec;
-
-static void
-pattern_spec_free (PatternSpec *pspec)
-{
- if (pspec->pspec)
- g_pattern_spec_free (pspec->pspec);
- g_free (pspec);
-}
-
-/**
- * gtk_binding_set_add_path:
- * @binding_set: a #GtkBindingSet to add a path to
- * @path_type: path type the pattern applies to
- * @path_pattern: the actual match pattern
- * @priority: binding priority
- *
- * This function was used internally by the GtkRC parsing mechanism
- * to assign match patterns to #GtkBindingSet structures.
- *
- * In GTK+ 3, these match patterns are unused.
- *
- * Deprecated: 3.0
- */
-void
-gtk_binding_set_add_path (GtkBindingSet *binding_set,
- GtkPathType path_type,
- const gchar *path_pattern,
- GtkPathPriorityType priority)
-{
- PatternSpec *pspec;
- GSList **slist_p, *slist;
- static guint seq_id = 0;
-
- g_return_if_fail (binding_set != NULL);
- g_return_if_fail (path_pattern != NULL);
- g_return_if_fail (priority <= GTK_PATH_PRIO_MASK);
-
- priority &= GTK_PATH_PRIO_MASK;
-
- switch (path_type)
- {
- case GTK_PATH_WIDGET:
- slist_p = &binding_set->widget_path_pspecs;
- break;
- case GTK_PATH_WIDGET_CLASS:
- slist_p = &binding_set->widget_class_pspecs;
- break;
- case GTK_PATH_CLASS:
- slist_p = &binding_set->class_branch_pspecs;
- break;
- default:
- g_assert_not_reached ();
- slist_p = NULL;
- break;
- }
-
- pspec = g_new (PatternSpec, 1);
- pspec->type = path_type;
- if (path_type == GTK_PATH_WIDGET_CLASS)
- pspec->pspec = NULL;
- else
- pspec->pspec = g_pattern_spec_new (path_pattern);
- pspec->seq_id = priority << 28;
- pspec->user_data = binding_set;
-
- slist = *slist_p;
- while (slist)
- {
- PatternSpec *tmp_pspec;
-
- tmp_pspec = slist->data;
- slist = slist->next;
-
- if (g_pattern_spec_equal (tmp_pspec->pspec, pspec->pspec))
- {
- GtkPathPriorityType lprio = tmp_pspec->seq_id >> 28;
-
- pattern_spec_free (pspec);
- pspec = NULL;
- if (lprio < priority)
- {
- tmp_pspec->seq_id &= 0x0fffffff;
- tmp_pspec->seq_id |= priority << 28;
- }
- break;
- }
- }
- if (pspec)
- {
- pspec->seq_id |= seq_id++ & 0x0fffffff;
- *slist_p = g_slist_prepend (*slist_p, pspec);
- }
-}
diff --git a/gtk/deprecated/gtkrc.h b/gtk/deprecated/gtkrc.h
deleted file mode 100644
index 25b23fba85..0000000000
--- a/gtk/deprecated/gtkrc.h
+++ /dev/null
@@ -1,405 +0,0 @@
-/* GTK - The GIMP Toolkit
- * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
- *
- * 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/>.
- */
-
-/*
- * Modified by the GTK+ Team and others 1997-2000. See the AUTHORS
- * file for a list of people on the GTK+ Team. See the ChangeLog
- * files for a list of changes. These files are distributed with
- * GTK+ at ftp://ftp.gtk.org/pub/gtk/.
- */
-
-#ifndef __GTK_RC_H__
-#define __GTK_RC_H__
-
-#if !defined (__GTK_H_INSIDE__) && !defined (GTK_COMPILATION)
-#error "Only <gtk/gtk.h> can be included directly."
-#endif
-
-#include <gtk/gtkwidget.h>
-#include <gtk/gtkbindings.h>
-
-G_BEGIN_DECLS
-
-/* Forward declarations */
-typedef struct _GtkRcContext GtkRcContext;
-typedef struct _GtkRcStyleClass GtkRcStyleClass;
-
-#define GTK_TYPE_RC_STYLE (gtk_rc_style_get_type ())
-#define GTK_RC_STYLE(object) (G_TYPE_CHECK_INSTANCE_CAST ((object), GTK_TYPE_RC_STYLE, GtkRcStyle))
-#define GTK_RC_STYLE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GTK_TYPE_RC_STYLE, GtkRcStyleClass))
-#define GTK_IS_RC_STYLE(object) (G_TYPE_CHECK_INSTANCE_TYPE ((object), GTK_TYPE_RC_STYLE))
-#define GTK_IS_RC_STYLE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GTK_TYPE_RC_STYLE))
-#define GTK_RC_STYLE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GTK_TYPE_RC_STYLE, GtkRcStyleClass))
-
-/**
- * GtkRcFlags:
- * @GTK_RC_FG :Deprecated
- * @GTK_RC_BG: Deprecated
- * @GTK_RC_TEXT: Deprecated
- * @GTK_RC_BASE: Deprecated
- *
- * Deprecated
- */
-typedef enum
-{
- GTK_RC_FG = 1 << 0,
- GTK_RC_BG = 1 << 1,
- GTK_RC_TEXT = 1 << 2,
- GTK_RC_BASE = 1 << 3
-} GtkRcFlags;
-
-/**
- * GtkRcStyle:
- * @name: Name
- * @bg_pixmap_name: Pixmap name
- * @font_desc: A #PangoFontDescription
- * @color_flags: #GtkRcFlags
- * @fg: Foreground colors
- * @bg: Background colors
- * @text: Text colors
- * @base: Base colors
- * @xthickness: X thickness
- * @ythickness: Y thickness
- *
- * The #GtkRcStyle-struct is used to represent a set
- * of information about the appearance of a widget.
- * This can later be composited together with other
- * #GtkRcStyle-struct<!-- -->s to form a #GtkStyle.
- */
-struct _GtkRcStyle
-{
- GObject parent_instance;
-
- /*< public >*/
-
- gchar *name;
- gchar *bg_pixmap_name[5];
- PangoFontDescription *font_desc;
-
- GtkRcFlags color_flags[5];
- GdkColor fg[5];
- GdkColor bg[5];
- GdkColor text[5];
- GdkColor base[5];
-
- gint xthickness;
- gint ythickness;
-
- /*< private >*/
- GArray *rc_properties;
-
- /* list of RC style lists including this RC style */
- GSList *rc_style_lists;
-
- GSList *icon_factories;
-
- guint engine_specified : 1; /* The RC file specified the engine */
-};
-
-/**
- * GtkRcStyleClass:
- * @parent_class: The parent class.
- * @create_rc_style:
- * @parse:
- * @merge:
- * @create_style:
- */
-struct _GtkRcStyleClass
-{
- GObjectClass parent_class;
-
- /*< public >*/
-
- /* Create an empty RC style of the same type as this RC style.
- * The default implementation, which does
- * g_object_new (G_OBJECT_TYPE (style), NULL);
- * should work in most cases.
- */
- GtkRcStyle * (*create_rc_style) (GtkRcStyle *rc_style);
-
- /* Fill in engine specific parts of GtkRcStyle by parsing contents
- * of brackets. Returns G_TOKEN_NONE if successful, otherwise returns
- * the token it expected but didn't get.
- */
- guint (*parse) (GtkRcStyle *rc_style,
- GtkSettings *settings,
- GScanner *scanner);
-
- /* Combine RC style data from src into dest. If overridden, this
- * function should chain to the parent.
- */
- void (*merge) (GtkRcStyle *dest,
- GtkRcStyle *src);
-
- /* Create an empty style suitable to this RC style
- */
- GtkStyle * (*create_style) (GtkRcStyle *rc_style);
-
- /*< private >*/
-
- /* Padding for future expansion */
- void (*_gtk_reserved1) (void);
- void (*_gtk_reserved2) (void);
- void (*_gtk_reserved3) (void);
- void (*_gtk_reserved4) (void);
-};
-
-GSList* _gtk_rc_parse_widget_class_path (const gchar *pattern);
-void _gtk_rc_free_widget_class_path (GSList *list);
-gboolean _gtk_rc_match_widget_class (GSList *list,
- gint length,
- gchar *path,
- gchar *path_reversed);
-
-GDK_DEPRECATED_IN_3_0_FOR(GtkStyleContext)
-void gtk_rc_add_default_file (const gchar *filename);
-GDK_DEPRECATED_IN_3_0_FOR(GtkStyleContext)
-void gtk_rc_set_default_files (gchar **filenames);
-GDK_DEPRECATED_IN_3_0_FOR(GtkStyleContext)
-gchar** gtk_rc_get_default_files (void);
-GDK_DEPRECATED_IN_3_0_FOR(GtkStyleContext)
-GtkStyle* gtk_rc_get_style (GtkWidget *widget);
-GDK_DEPRECATED_IN_3_0_FOR(GtkStyleContext)
-GtkStyle* gtk_rc_get_style_by_paths (GtkSettings *settings,
- const char *widget_path,
- const char *class_path,
- GType type);
-
-GDK_DEPRECATED_IN_3_0_FOR(GtkStyleContext)
-gboolean gtk_rc_reparse_all_for_settings (GtkSettings *settings,
- gboolean force_load);
-GDK_DEPRECATED_IN_3_0_FOR(GtkStyleContext)
-void gtk_rc_reset_styles (GtkSettings *settings);
-
-GDK_DEPRECATED_IN_3_0_FOR(GtkStyleContext)
-gchar* gtk_rc_find_pixmap_in_path (GtkSettings *settings,
- GScanner *scanner,
- const gchar *pixmap_file);
-
-GDK_DEPRECATED_IN_3_0_FOR(GtkStyleContext)
-void gtk_rc_parse (const gchar *filename);
-GDK_DEPRECATED_IN_3_0_FOR(GtkStyleContext)
-void gtk_rc_parse_string (const gchar *rc_string);
-GDK_DEPRECATED_IN_3_0_FOR(GtkStyleContext)
-gboolean gtk_rc_reparse_all (void);
-
-GDK_DEPRECATED_IN_3_0
-GType gtk_rc_style_get_type (void) G_GNUC_CONST;
-GDK_DEPRECATED_IN_3_0_FOR(GtkStyleContext)
-GtkRcStyle* gtk_rc_style_new (void);
-GDK_DEPRECATED_IN_3_0_FOR(GtkStyleContext)
-GtkRcStyle* gtk_rc_style_copy (GtkRcStyle *orig);
-
-GDK_DEPRECATED_IN_3_0_FOR(GtkStyleContext)
-gchar* gtk_rc_find_module_in_path (const gchar *module_file);
-GDK_DEPRECATED_IN_3_0_FOR(GtkStyleContext)
-gchar* gtk_rc_get_theme_dir (void);
-GDK_DEPRECATED_IN_3_0_FOR(GtkStyleContext)
-gchar* gtk_rc_get_module_dir (void);
-GDK_DEPRECATED_IN_3_0_FOR(GtkStyleContext)
-gchar* gtk_rc_get_im_module_path (void);
-GDK_DEPRECATED_IN_3_0_FOR(GtkStyleContext)
-gchar* gtk_rc_get_im_module_file (void);
-
-/* private functions/definitions */
-
-/**
- * GtkRcTokenType:
- * @GTK_RC_TOKEN_INVALID: Deprecated
- * @GTK_RC_TOKEN_INCLUDE: Deprecated
- * @GTK_RC_TOKEN_NORMAL: Deprecated
- * @GTK_RC_TOKEN_ACTIVE: Deprecated
- * @GTK_RC_TOKEN_PRELIGHT: Deprecated
- * @GTK_RC_TOKEN_SELECTED: Deprecated
- * @GTK_RC_TOKEN_INSENSITIVE: Deprecated
- * @GTK_RC_TOKEN_FG: Deprecated
- * @GTK_RC_TOKEN_BG: Deprecated
- * @GTK_RC_TOKEN_TEXT: Deprecated
- * @GTK_RC_TOKEN_BASE: Deprecated
- * @GTK_RC_TOKEN_XTHICKNESS: Deprecated
- * @GTK_RC_TOKEN_YTHICKNESS: Deprecated
- * @GTK_RC_TOKEN_FONT: Deprecated
- * @GTK_RC_TOKEN_FONTSET: Deprecated
- * @GTK_RC_TOKEN_FONT_NAME: Deprecated
- * @GTK_RC_TOKEN_BG_PIXMAP: Deprecated
- * @GTK_RC_TOKEN_PIXMAP_PATH: Deprecated
- * @GTK_RC_TOKEN_STYLE: Deprecated
- * @GTK_RC_TOKEN_BINDING: Deprecated
- * @GTK_RC_TOKEN_BIND: Deprecated
- * @GTK_RC_TOKEN_WIDGET: Deprecated
- * @GTK_RC_TOKEN_WIDGET_CLASS: Deprecated
- * @GTK_RC_TOKEN_CLASS: Deprecated
- * @GTK_RC_TOKEN_LOWEST: Deprecated
- * @GTK_RC_TOKEN_GTK: Deprecated
- * @GTK_RC_TOKEN_APPLICATION: Deprecated
- * @GTK_RC_TOKEN_THEME: Deprecated
- * @GTK_RC_TOKEN_RC: Deprecated
- * @GTK_RC_TOKEN_HIGHEST: Deprecated
- * @GTK_RC_TOKEN_ENGINE: Deprecated
- * @GTK_RC_TOKEN_MODULE_PATH: Deprecated
- * @GTK_RC_TOKEN_IM_MODULE_PATH: Deprecated
- * @GTK_RC_TOKEN_IM_MODULE_FILE: Deprecated
- * @GTK_RC_TOKEN_STOCK: Deprecated
- * @GTK_RC_TOKEN_LTR: Deprecated
- * @GTK_RC_TOKEN_RTL: Deprecated
- * @GTK_RC_TOKEN_COLOR: Deprecated
- * @GTK_RC_TOKEN_UNBIND: Deprecated
- * @GTK_RC_TOKEN_LAST: Deprecated
- *
- * The #GtkRcTokenType enumeration represents the tokens
- * in the RC file. It is exposed so that theme engines
- * can reuse these tokens when parsing the theme-engine
- * specific portions of a RC file.
- *
- * Deprecated: 3.0: Use #GtkCssProvider instead.
- */
-typedef enum {
- GTK_RC_TOKEN_INVALID = G_TOKEN_LAST,
- GTK_RC_TOKEN_INCLUDE,
- GTK_RC_TOKEN_NORMAL,
- GTK_RC_TOKEN_ACTIVE,
- GTK_RC_TOKEN_PRELIGHT,
- GTK_RC_TOKEN_SELECTED,
- GTK_RC_TOKEN_INSENSITIVE,
- GTK_RC_TOKEN_FG,
- GTK_RC_TOKEN_BG,
- GTK_RC_TOKEN_TEXT,
- GTK_RC_TOKEN_BASE,
- GTK_RC_TOKEN_XTHICKNESS,
- GTK_RC_TOKEN_YTHICKNESS,
- GTK_RC_TOKEN_FONT,
- GTK_RC_TOKEN_FONTSET,
- GTK_RC_TOKEN_FONT_NAME,
- GTK_RC_TOKEN_BG_PIXMAP,
- GTK_RC_TOKEN_PIXMAP_PATH,
- GTK_RC_TOKEN_STYLE,
- GTK_RC_TOKEN_BINDING,
- GTK_RC_TOKEN_BIND,
- GTK_RC_TOKEN_WIDGET,
- GTK_RC_TOKEN_WIDGET_CLASS,
- GTK_RC_TOKEN_CLASS,
- GTK_RC_TOKEN_LOWEST,
- GTK_RC_TOKEN_GTK,
- GTK_RC_TOKEN_APPLICATION,
- GTK_RC_TOKEN_THEME,
- GTK_RC_TOKEN_RC,
- GTK_RC_TOKEN_HIGHEST,
- GTK_RC_TOKEN_ENGINE,
- GTK_RC_TOKEN_MODULE_PATH,
- GTK_RC_TOKEN_IM_MODULE_PATH,
- GTK_RC_TOKEN_IM_MODULE_FILE,
- GTK_RC_TOKEN_STOCK,
- GTK_RC_TOKEN_LTR,
- GTK_RC_TOKEN_RTL,
- GTK_RC_TOKEN_COLOR,
- GTK_RC_TOKEN_UNBIND,
- GTK_RC_TOKEN_LAST
-} GtkRcTokenType;
-
-
-/**
- * GtkPathPriorityType:
- * @GTK_PATH_PRIO_LOWEST: Deprecated
- * @GTK_PATH_PRIO_GTK: Deprecated
- * @GTK_PATH_PRIO_APPLICATION: Deprecated
- * @GTK_PATH_PRIO_THEME: Deprecated
- * @GTK_PATH_PRIO_RC: Deprecated
- * @GTK_PATH_PRIO_HIGHEST: Deprecated
- *
- * Priorities for path lookups.
- * See also gtk_binding_set_add_path().
- *
- * Deprecated: 3.0
- */
-typedef enum
-{
- GTK_PATH_PRIO_LOWEST = 0,
- GTK_PATH_PRIO_GTK = 4,
- GTK_PATH_PRIO_APPLICATION = 8,
- GTK_PATH_PRIO_THEME = 10,
- GTK_PATH_PRIO_RC = 12,
- GTK_PATH_PRIO_HIGHEST = 15
-} GtkPathPriorityType;
-#define GTK_PATH_PRIO_MASK 0x0f
-
-/**
- * GtkPathType:
- * @GTK_PATH_WIDGET: Deprecated
- * @GTK_PATH_WIDGET_CLASS: Deprecated
- * @GTK_PATH_CLASS: Deprecated
- *
- * Widget path types.
- * See also gtk_binding_set_add_path().
- *
- * Deprecated: 3.0
- */
-typedef enum
-{
- GTK_PATH_WIDGET,
- GTK_PATH_WIDGET_CLASS,
- GTK_PATH_CLASS
-} GtkPathType;
-
-GDK_DEPRECATED_IN_3_0_FOR(GtkStyleContext)
-GScanner* gtk_rc_scanner_new (void);
-GDK_DEPRECATED_IN_3_0_FOR(GtkStyleContext)
-guint gtk_rc_parse_color (GScanner *scanner,
- GdkColor *color);
-GDK_DEPRECATED_IN_3_0_FOR(GtkStyleContext)
-guint gtk_rc_parse_color_full (GScanner *scanner,
- GtkRcStyle *style,
- GdkColor *color);
-GDK_DEPRECATED_IN_3_0_FOR(GtkStyleContext)
-guint gtk_rc_parse_state (GScanner *scanner,
- GtkStateType *state);
-GDK_DEPRECATED_IN_3_0_FOR(GtkStyleContext)
-guint gtk_rc_parse_priority (GScanner *scanner,
- GtkPathPriorityType *priority);
-
-/* rc properties
- * (structure forward declared in gtkstyle.h)
- */
-/**
- * GtkRcProperty:
- * @type_name: quark-ified type identifier
- * @property_name: quark-ified property identifier like
- * “GtkScrollbar::spacing”
- * @origin: field similar to one found in #GtkSettingsValue
- * @value:field similar to one found in #GtkSettingsValue
- *
- * Deprecated
- */
-struct _GtkRcProperty
-{
- /* quark-ified property identifier like “GtkScrollbar::spacing” */
- GQuark type_name;
- GQuark property_name;
-
- /* fields similar to GtkSettingsValue */
- gchar *origin;
- GValue value;
-};
-
-GDK_DEPRECATED_IN_3_0
-void gtk_binding_set_add_path (GtkBindingSet *binding_set,
- GtkPathType path_type,
- const gchar *path_pattern,
- GtkPathPriorityType priority);
-
-G_END_DECLS
-
-#endif /* __GTK_RC_H__ */
diff --git a/gtk/deprecated/gtkstyle.c b/gtk/deprecated/gtkstyle.c
deleted file mode 100644
index 9477578fef..0000000000
--- a/gtk/deprecated/gtkstyle.c
+++ /dev/null
@@ -1,4769 +0,0 @@
-/* GTK - The GIMP Toolkit
- * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
- *
- * 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/>.
- */
-
-/*
- * Modified by the GTK+ Team and others 1997-2000. See the AUTHORS
- * file for a list of people on the GTK+ Team. See the ChangeLog
- * files for a list of changes. These files are distributed with
- * GTK+ at ftp://ftp.gtk.org/pub/gtk/.
- */
-
-#include "config.h"
-
-#define GDK_DISABLE_DEPRECATION_WARNINGS
-
-#include <math.h>
-#include <stdlib.h>
-#include <string.h>
-#include <gobject/gvaluecollector.h>
-#include "gtkmarshalers.h"
-#include "gtkpango.h"
-#include "gtkrc.h"
-#include "gtkspinbutton.h"
-#include "gtkstyle.h"
-#include "gtkstylecontextprivate.h"
-#include "gtkwidget.h"
-#include "gtkwidgetprivate.h"
-#include "gtkiconfactory.h"
-#include "gtkintl.h"
-#include "gtkdebug.h"
-#include "gtkrender.h"
-#include "gtkborder.h"
-#include "gtkwidgetpath.h"
-
-/**
- * SECTION:gtkstyle
- * @Short_description: Deprecated object that holds style information
- * for widgets
- * @Title: GtkStyle
- *
- * A #GtkStyle object encapsulates the information that provides the look and
- * feel for a widget.
- *
- * > In GTK+ 3.0, GtkStyle has been deprecated and replaced by
- * > #GtkStyleContext.
- *
- * Each #GtkWidget has an associated #GtkStyle object that is used when
- * rendering that widget. Also, a #GtkStyle holds information for the five
- * possible widget states though not every widget supports all five
- * states; see #GtkStateType.
- *
- * Usually the #GtkStyle for a widget is the same as the default style that
- * is set by GTK+ and modified the theme engine.
- *
- * Usually applications should not need to use or modify the #GtkStyle of
- * their widgets.
- */
-
-
-#define LIGHTNESS_MULT 1.3
-#define DARKNESS_MULT 0.7
-
-/* --- typedefs & structures --- */
-typedef struct {
- GType widget_type;
- GParamSpec *pspec;
- GValue value;
-} PropertyValue;
-
-typedef struct {
- GtkStyleContext *context;
- gulong context_changed_id;
-} GtkStylePrivate;
-
-#define GTK_STYLE_GET_PRIVATE(obj) ((GtkStylePrivate *) gtk_style_get_instance_private ((GtkStyle *) (obj)))
-
-enum {
- PROP_0,
- PROP_CONTEXT
-};
-
-/* --- prototypes --- */
-static void gtk_style_finalize (GObject *object);
-static void gtk_style_constructed (GObject *object);
-static void gtk_style_set_property (GObject *object,
- guint prop_id,
- const GValue *value,
- GParamSpec *pspec);
-static void gtk_style_get_property (GObject *object,
- guint prop_id,
- GValue *value,
- GParamSpec *pspec);
-
-static void gtk_style_real_realize (GtkStyle *style);
-static void gtk_style_real_unrealize (GtkStyle *style);
-static void gtk_style_real_copy (GtkStyle *style,
- GtkStyle *src);
-static void gtk_style_real_set_background (GtkStyle *style,
- GdkWindow *window,
- GtkStateType state_type);
-static GtkStyle *gtk_style_real_clone (GtkStyle *style);
-static void gtk_style_real_init_from_rc (GtkStyle *style,
- GtkRcStyle *rc_style);
-static GdkPixbuf *gtk_default_render_icon (GtkStyle *style,
- const GtkIconSource *source,
- GtkTextDirection direction,
- GtkStateType state,
- GtkIconSize size,
- GtkWidget *widget,
- const gchar *detail);
-static void gtk_default_draw_hline (GtkStyle *style,
- cairo_t *cr,
- GtkStateType state_type,
- GtkWidget *widget,
- const gchar *detail,
- gint x1,
- gint x2,
- gint y);
-static void gtk_default_draw_vline (GtkStyle *style,
- cairo_t *cr,
- GtkStateType state_type,
- GtkWidget *widget,
- const gchar *detail,
- gint y1,
- gint y2,
- gint x);
-static void gtk_default_draw_shadow (GtkStyle *style,
- cairo_t *cr,
- GtkStateType state_type,
- GtkShadowType shadow_type,
- GtkWidget *widget,
- const gchar *detail,
- gint x,
- gint y,
- gint width,
- gint height);
-static void gtk_default_draw_arrow (GtkStyle *style,
- cairo_t *cr,
- GtkStateType state_type,
- GtkShadowType shadow_type,
- GtkWidget *widget,
- const gchar *detail,
- GtkArrowType arrow_type,
- gboolean fill,
- gint x,
- gint y,
- gint width,
- gint height);
-static void gtk_default_draw_diamond (GtkStyle *style,
- cairo_t *cr,
- GtkStateType state_type,
- GtkShadowType shadow_type,
- GtkWidget *widget,
- const gchar *detail,
- gint x,
- gint y,
- gint width,
- gint height);
-static void gtk_default_draw_box (GtkStyle *style,
- cairo_t *cr,
- GtkStateType state_type,
- GtkShadowType shadow_type,
- GtkWidget *widget,
- const gchar *detail,
- gint x,
- gint y,
- gint width,
- gint height);
-static void gtk_default_draw_flat_box (GtkStyle *style,
- cairo_t *cr,
- GtkStateType state_type,
- GtkShadowType shadow_type,
- GtkWidget *widget,
- const gchar *detail,
- gint x,
- gint y,
- gint width,
- gint height);
-static void gtk_default_draw_check (GtkStyle *style,
- cairo_t *cr,
- GtkStateType state_type,
- GtkShadowType shadow_type,
- GtkWidget *widget,
- const gchar *detail,
- gint x,
- gint y,
- gint width,
- gint height);
-static void gtk_default_draw_option (GtkStyle *style,
- cairo_t *cr,
- GtkStateType state_type,
- GtkShadowType shadow_type,
- GtkWidget *widget,
- const gchar *detail,
- gint x,
- gint y,
- gint width,
- gint height);
-static void gtk_default_draw_tab (GtkStyle *style,
- cairo_t *cr,
- GtkStateType state_type,
- GtkShadowType shadow_type,
- GtkWidget *widget,
- const gchar *detail,
- gint x,
- gint y,
- gint width,
- gint height);
-static void gtk_default_draw_shadow_gap (GtkStyle *style,
- cairo_t *cr,
- GtkStateType state_type,
- GtkShadowType shadow_type,
- GtkWidget *widget,
- const gchar *detail,
- gint x,
- gint y,
- gint width,
- gint height,
- GtkPositionType gap_side,
- gint gap_x,
- gint gap_width);
-static void gtk_default_draw_box_gap (GtkStyle *style,
- cairo_t *cr,
- GtkStateType state_type,
- GtkShadowType shadow_type,
- GtkWidget *widget,
- const gchar *detail,
- gint x,
- gint y,
- gint width,
- gint height,
- GtkPositionType gap_side,
- gint gap_x,
- gint gap_width);
-static void gtk_default_draw_extension (GtkStyle *style,
- cairo_t *cr,
- GtkStateType state_type,
- GtkShadowType shadow_type,
- GtkWidget *widget,
- const gchar *detail,
- gint x,
- gint y,
- gint width,
- gint height,
- GtkPositionType gap_side);
-static void gtk_default_draw_focus (GtkStyle *style,
- cairo_t *cr,
- GtkStateType state_type,
- GtkWidget *widget,
- const gchar *detail,
- gint x,
- gint y,
- gint width,
- gint height);
-static void gtk_default_draw_slider (GtkStyle *style,
- cairo_t *cr,
- GtkStateType state_type,
- GtkShadowType shadow_type,
- GtkWidget *widget,
- const gchar *detail,
- gint x,
- gint y,
- gint width,
- gint height,
- GtkOrientation orientation);
-static void gtk_default_draw_handle (GtkStyle *style,
- cairo_t *cr,
- GtkStateType state_type,
- GtkShadowType shadow_type,
- GtkWidget *widget,
- const gchar *detail,
- gint x,
- gint y,
- gint width,
- gint height,
- GtkOrientation orientation);
-static void gtk_default_draw_expander (GtkStyle *style,
- cairo_t *cr,
- GtkStateType state_type,
- GtkWidget *widget,
- const gchar *detail,
- gint x,
- gint y,
- GtkExpanderStyle expander_style);
-static void gtk_default_draw_layout (GtkStyle *style,
- cairo_t *cr,
- GtkStateType state_type,
- gboolean use_text,
- GtkWidget *widget,
- const gchar *detail,
- gint x,
- gint y,
- PangoLayout *layout);
-static void gtk_default_draw_resize_grip (GtkStyle *style,
- cairo_t *cr,
- GtkStateType state_type,
- GtkWidget *widget,
- const gchar *detail,
- GdkWindowEdge edge,
- gint x,
- gint y,
- gint width,
- gint height);
-static void gtk_default_draw_spinner (GtkStyle *style,
- cairo_t *cr,
- GtkStateType state_type,
- GtkWidget *widget,
- const gchar *detail,
- guint step,
- gint x,
- gint y,
- gint width,
- gint height);
-
-static void rgb_to_hls (gdouble *r,
- gdouble *g,
- gdouble *b);
-static void hls_to_rgb (gdouble *h,
- gdouble *l,
- gdouble *s);
-
-static void transform_detail_string (const gchar *detail,
- GtkStyleContext *context);
-
-/*
- * Data for default check and radio buttons
- */
-
-static const GtkRequisition default_option_indicator_size = { 7, 13 };
-static const GtkBorder default_option_indicator_spacing = { 7, 5, 2, 2 };
-
-#define GTK_GRAY 0xdcdc, 0xdada, 0xd5d5
-#define GTK_DARK_GRAY 0xc4c4, 0xc2c2, 0xbdbd
-#define GTK_LIGHT_GRAY 0xeeee, 0xebeb, 0xe7e7
-#define GTK_WHITE 0xffff, 0xffff, 0xffff
-#define GTK_BLUE 0x4b4b, 0x6969, 0x8383
-#define GTK_VERY_DARK_GRAY 0x9c9c, 0x9a9a, 0x9494
-#define GTK_BLACK 0x0000, 0x0000, 0x0000
-#define GTK_WEAK_GRAY 0x7530, 0x7530, 0x7530
-
-/* --- variables --- */
-static const GdkColor gtk_default_normal_fg = { 0, GTK_BLACK };
-static const GdkColor gtk_default_active_fg = { 0, GTK_BLACK };
-static const GdkColor gtk_default_prelight_fg = { 0, GTK_BLACK };
-static const GdkColor gtk_default_selected_fg = { 0, GTK_WHITE };
-static const GdkColor gtk_default_insensitive_fg = { 0, GTK_WEAK_GRAY };
-
-static const GdkColor gtk_default_normal_bg = { 0, GTK_GRAY };
-static const GdkColor gtk_default_active_bg = { 0, GTK_DARK_GRAY };
-static const GdkColor gtk_default_prelight_bg = { 0, GTK_LIGHT_GRAY };
-static const GdkColor gtk_default_selected_bg = { 0, GTK_BLUE };
-static const GdkColor gtk_default_insensitive_bg = { 0, GTK_GRAY };
-static const GdkColor gtk_default_selected_base = { 0, GTK_BLUE };
-static const GdkColor gtk_default_active_base = { 0, GTK_VERY_DARK_GRAY };
-
-static GQuark quark_default_style;
-
-/* --- signals --- */
-static guint realize_signal = 0;
-static guint unrealize_signal = 0;
-
-G_DEFINE_TYPE_WITH_PRIVATE (GtkStyle, gtk_style, G_TYPE_OBJECT)
-
-/* --- functions --- */
-
-static void
-gtk_style_init (GtkStyle *style)
-{
- gint i;
-
- style->font_desc = pango_font_description_from_string ("Sans 10");
-
- style->attach_count = 0;
-
- style->black.red = 0;
- style->black.green = 0;
- style->black.blue = 0;
-
- style->white.red = 65535;
- style->white.green = 65535;
- style->white.blue = 65535;
-
- style->fg[GTK_STATE_NORMAL] = gtk_default_normal_fg;
- style->fg[GTK_STATE_ACTIVE] = gtk_default_active_fg;
- style->fg[GTK_STATE_PRELIGHT] = gtk_default_prelight_fg;
- style->fg[GTK_STATE_SELECTED] = gtk_default_selected_fg;
- style->fg[GTK_STATE_INSENSITIVE] = gtk_default_insensitive_fg;
-
- style->bg[GTK_STATE_NORMAL] = gtk_default_normal_bg;
- style->bg[GTK_STATE_ACTIVE] = gtk_default_active_bg;
- style->bg[GTK_STATE_PRELIGHT] = gtk_default_prelight_bg;
- style->bg[GTK_STATE_SELECTED] = gtk_default_selected_bg;
- style->bg[GTK_STATE_INSENSITIVE] = gtk_default_insensitive_bg;
-
- for (i = 0; i < 4; i++)
- {
- style->text[i] = style->fg[i];
- style->base[i] = style->white;
- }
-
- style->base[GTK_STATE_SELECTED] = gtk_default_selected_base;
- style->text[GTK_STATE_SELECTED] = style->white;
- style->base[GTK_STATE_ACTIVE] = gtk_default_active_base;
- style->text[GTK_STATE_ACTIVE] = style->white;
- style->base[GTK_STATE_INSENSITIVE] = gtk_default_prelight_bg;
- style->text[GTK_STATE_INSENSITIVE] = gtk_default_insensitive_fg;
-
- style->rc_style = NULL;
-
- style->xthickness = 2;
- style->ythickness = 2;
-
- style->property_cache = NULL;
-}
-
-static void
-gtk_style_class_init (GtkStyleClass *klass)
-{
- GObjectClass *object_class = G_OBJECT_CLASS (klass);
-
- object_class->finalize = gtk_style_finalize;
- object_class->set_property = gtk_style_set_property;
- object_class->get_property = gtk_style_get_property;
- object_class->constructed = gtk_style_constructed;
-
- klass->clone = gtk_style_real_clone;
- klass->copy = gtk_style_real_copy;
- klass->init_from_rc = gtk_style_real_init_from_rc;
- klass->realize = gtk_style_real_realize;
- klass->unrealize = gtk_style_real_unrealize;
- klass->set_background = gtk_style_real_set_background;
- klass->render_icon = gtk_default_render_icon;
-
- klass->draw_hline = gtk_default_draw_hline;
- klass->draw_vline = gtk_default_draw_vline;
- klass->draw_shadow = gtk_default_draw_shadow;
- klass->draw_arrow = gtk_default_draw_arrow;
- klass->draw_diamond = gtk_default_draw_diamond;
- klass->draw_box = gtk_default_draw_box;
- klass->draw_flat_box = gtk_default_draw_flat_box;
- klass->draw_check = gtk_default_draw_check;
- klass->draw_option = gtk_default_draw_option;
- klass->draw_tab = gtk_default_draw_tab;
- klass->draw_shadow_gap = gtk_default_draw_shadow_gap;
- klass->draw_box_gap = gtk_default_draw_box_gap;
- klass->draw_extension = gtk_default_draw_extension;
- klass->draw_focus = gtk_default_draw_focus;
- klass->draw_slider = gtk_default_draw_slider;
- klass->draw_handle = gtk_default_draw_handle;
- klass->draw_expander = gtk_default_draw_expander;
- klass->draw_layout = gtk_default_draw_layout;
- klass->draw_resize_grip = gtk_default_draw_resize_grip;
- klass->draw_spinner = gtk_default_draw_spinner;
-
- g_object_class_install_property (object_class,
- PROP_CONTEXT,
- g_param_spec_object ("context",
- P_("Style context"),
- P_("GtkStyleContext to get style from"),
- GTK_TYPE_STYLE_CONTEXT,
- G_PARAM_CONSTRUCT_ONLY | G_PARAM_READWRITE));
-
- /**
- * GtkStyle::realize:
- * @style: the object which received the signal
- *
- * Emitted when the style has been initialized for a particular
- * visual. Connecting to this signal is probably seldom
- * useful since most of the time applications and widgets only
- * deal with styles that have been already realized.
- *
- * Since: 2.4
- */
- realize_signal = g_signal_new (I_("realize"),
- G_TYPE_FROM_CLASS (object_class),
- G_SIGNAL_RUN_FIRST,
- G_STRUCT_OFFSET (GtkStyleClass, realize),
- NULL, NULL,
- NULL,
- G_TYPE_NONE, 0);
- /**
- * GtkStyle::unrealize:
- * @style: the object which received the signal
- *
- * Emitted when the aspects of the style specific to a particular visual
- * is being cleaned up. A connection to this signal can be useful
- * if a widget wants to cache objects as object data on #GtkStyle.
- * This signal provides a convenient place to free such cached objects.
- *
- * Since: 2.4
- */
- unrealize_signal = g_signal_new (I_("unrealize"),
- G_TYPE_FROM_CLASS (object_class),
- G_SIGNAL_RUN_FIRST,
- G_STRUCT_OFFSET (GtkStyleClass, unrealize),
- NULL, NULL,
- NULL,
- G_TYPE_NONE, 0);
-}
-
-static void
-gtk_style_finalize (GObject *object)
-{
- GtkStyle *style = GTK_STYLE (object);
- GtkStylePrivate *priv = GTK_STYLE_GET_PRIVATE (style);
- gint i;
-
- g_return_if_fail (style->attach_count == 0);
-
- /* All the styles in the list have the same
- * style->styles pointer. If we delete the
- * *first* style from the list, we need to update
- * the style->styles pointers from all the styles.
- * Otherwise we simply remove the node from
- * the list.
- */
- if (style->styles)
- {
- if (style->styles->data != style)
- style->styles = g_slist_remove (style->styles, style);
- else
- {
- GSList *tmp_list = style->styles->next;
-
- while (tmp_list)
- {
- GTK_STYLE (tmp_list->data)->styles = style->styles->next;
- tmp_list = tmp_list->next;
- }
- g_slist_free_1 (style->styles);
- }
- }
-
- g_slist_free_full (style->icon_factories, g_object_unref);
-
- pango_font_description_free (style->font_desc);
-
- if (style->private_font_desc)
- pango_font_description_free (style->private_font_desc);
-
- if (style->rc_style)
- g_object_unref (style->rc_style);
-
- if (priv->context)
- {
- if (priv->context_changed_id)
- g_signal_handler_disconnect (priv->context, priv->context_changed_id);
-
- g_object_unref (priv->context);
- }
-
- for (i = 0; i < 5; i++)
- {
- if (style->background[i])
- cairo_pattern_destroy (style->background[i]);
- }
-
- G_OBJECT_CLASS (gtk_style_parent_class)->finalize (object);
-}
-
-static void
-gtk_style_set_property (GObject *object,
- guint prop_id,
- const GValue *value,
- GParamSpec *pspec)
-{
- GtkStylePrivate *priv;
-
- priv = GTK_STYLE_GET_PRIVATE (object);
-
- switch (prop_id)
- {
- case PROP_CONTEXT:
- priv->context = g_value_dup_object (value);
- break;
- default:
- G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
- break;
- }
-}
-
-static void
-gtk_style_get_property (GObject *object,
- guint prop_id,
- GValue *value,
- GParamSpec *pspec)
-{
- GtkStylePrivate *priv;
-
- priv = GTK_STYLE_GET_PRIVATE (object);
-
- switch (prop_id)
- {
- case PROP_CONTEXT:
- g_value_set_object (value, priv->context);
- break;
- default:
- G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
- break;
- }
-}
-
-static gboolean
-set_color_from_context (GtkStyle *style,
- GtkStateType state,
- GtkStyleContext *context,
- GtkRcFlags prop)
-{
- GdkRGBA *color = NULL;
- GdkColor *dest = { 0 }; /* Shut up gcc */
- GtkStateFlags flags;
-
- flags = gtk_style_context_get_state (context);
-
- switch (prop)
- {
- case GTK_RC_BG:
- gtk_style_context_get (context, flags,
- "background-color", &color,
- NULL);
- dest = &style->bg[state];
- break;
- case GTK_RC_FG:
- gtk_style_context_get (context, flags,
- "color", &color,
- NULL);
- dest = &style->fg[state];
- break;
- case GTK_RC_TEXT:
- gtk_style_context_get (context, flags,
- "color", &color,
- NULL);
- dest = &style->text[state];
- break;
- case GTK_RC_BASE:
- gtk_style_context_get (context, flags,
- "background-color", &color,
- NULL);
- dest = &style->base[state];
- break;
- }
-
- if (!color)
- return FALSE;
-
- if (!(color->alpha > 0.01))
- {
- gdk_rgba_free (color);
- return FALSE;
- }
-
- dest->pixel = 0;
- dest->red = CLAMP ((guint) (color->red * 65535), 0, 65535);
- dest->green = CLAMP ((guint) (color->green * 65535), 0, 65535);
- dest->blue = CLAMP ((guint) (color->blue * 65535), 0, 65535);
- gdk_rgba_free (color);
-
- return TRUE;
-}
-
-static void
-set_color (GtkStyle *style,
- GtkStyleContext *context,
- GtkStateType state,
- GtkRcFlags prop)
-{
- /* Try to fill in the values from the associated GtkStyleContext.
- * Since fully-transparent black is a very common default (e.g. for
- * background-color properties), and we must store the result in a GdkColor
- * to retain API compatibility, in case the fetched color is fully transparent
- * we give themes a fallback style class they can style, before using the
- * hardcoded default values.
- */
- if (!set_color_from_context (style, state, context, prop))
- {
- gtk_style_context_save (context);
- gtk_style_context_add_class (context, "gtkstyle-fallback");
- set_color_from_context (style, state, context, prop);
- gtk_style_context_restore (context);
- }
-}
-
-static void
-gtk_style_update_from_context (GtkStyle *style)
-{
- GtkStylePrivate *priv;
- GtkStateType state;
- GtkStateFlags flags;
- GtkBorder padding;
- gint i;
-
- priv = GTK_STYLE_GET_PRIVATE (style);
-
- for (state = GTK_STATE_NORMAL; state <= GTK_STATE_INSENSITIVE; state++)
- {
- switch (state)
- {
- case GTK_STATE_ACTIVE:
- flags = GTK_STATE_FLAG_ACTIVE;
- break;
- case GTK_STATE_PRELIGHT:
- flags = GTK_STATE_FLAG_PRELIGHT;
- break;
- case GTK_STATE_SELECTED:
- flags = GTK_STATE_FLAG_SELECTED;
- break;
- case GTK_STATE_INSENSITIVE:
- flags = GTK_STATE_FLAG_INSENSITIVE;
- break;
- default:
- flags = 0;
- }
-
- gtk_style_context_save (priv->context);
- gtk_style_context_set_state (priv->context, flags);
-
- if (gtk_style_context_has_class (priv->context, "entry"))
- {
- gtk_style_context_save (priv->context);
- gtk_style_context_remove_class (priv->context, "entry");
- set_color (style, priv->context, state, GTK_RC_BG);
- set_color (style, priv->context, state, GTK_RC_FG);
- gtk_style_context_restore (priv->context);
-
- set_color (style, priv->context, state, GTK_RC_BASE);
- set_color (style, priv->context, state, GTK_RC_TEXT);
- }
- else
- {
- gtk_style_context_save (priv->context);
- gtk_style_context_add_class (priv->context, "entry");
- set_color (style, priv->context, state, GTK_RC_BASE);
- set_color (style, priv->context, state, GTK_RC_TEXT);
- gtk_style_context_restore (priv->context);
-
- set_color (style, priv->context, state, GTK_RC_BG);
- set_color (style, priv->context, state, GTK_RC_FG);
- }
-
- gtk_style_context_restore (priv->context);
- }
-
- if (style->font_desc)
- pango_font_description_free (style->font_desc);
-
- flags = gtk_style_context_get_state (priv->context);
- gtk_style_context_get (priv->context, flags,
- "font", &style->font_desc,
- NULL);
- gtk_style_context_get_padding (priv->context, flags, &padding);
-
- style->xthickness = padding.left;
- style->ythickness = padding.top;
-
- for (i = 0; i < 5; i++)
- {
- _gtk_style_shade (&style->bg[i], &style->light[i], LIGHTNESS_MULT);
- _gtk_style_shade (&style->bg[i], &style->dark[i], DARKNESS_MULT);
-
- style->mid[i].red = (style->light[i].red + style->dark[i].red) / 2;
- style->mid[i].green = (style->light[i].green + style->dark[i].green) / 2;
- style->mid[i].blue = (style->light[i].blue + style->dark[i].blue) / 2;
-
- style->text_aa[i].red = (style->text[i].red + style->base[i].red) / 2;
- style->text_aa[i].green = (style->text[i].green + style->base[i].green) / 2;
- style->text_aa[i].blue = (style->text[i].blue + style->base[i].blue) / 2;
- }
-
- style->black.red = 0x0000;
- style->black.green = 0x0000;
- style->black.blue = 0x0000;
-
- style->white.red = 0xffff;
- style->white.green = 0xffff;
- style->white.blue = 0xffff;
-
- for (i = 0; i < 5; i++)
- {
- if (style->background[i])
- cairo_pattern_destroy (style->background[i]);
-
- style->background[i] = cairo_pattern_create_rgb (style->bg[i].red / 65535.0,
- style->bg[i].green / 65535.0,
- style->bg[i].blue / 65535.0);
- }
-}
-
-static void
-style_context_changed (GtkStyleContext *context,
- gpointer user_data)
-{
- gtk_style_update_from_context (GTK_STYLE (user_data));
-}
-
-static void
-gtk_style_constructed (GObject *object)
-{
- GtkStylePrivate *priv;
-
- priv = GTK_STYLE_GET_PRIVATE (object);
-
- if (priv->context)
- {
- gtk_style_update_from_context (GTK_STYLE (object));
-
- priv->context_changed_id = g_signal_connect (priv->context, "changed",
- G_CALLBACK (style_context_changed), object);
- }
-}
-
-/**
- * gtk_style_copy:
- * @style: a #GtkStyle
- *
- * Creates a copy of the passed in #GtkStyle object.
- *
- * Returns: (transfer full): a copy of @style
- *
- * Deprecated:3.0: Use #GtkStyleContext instead
- */
-GtkStyle*
-gtk_style_copy (GtkStyle *style)
-{
- GtkStyle *new_style;
-
- g_return_val_if_fail (GTK_IS_STYLE (style), NULL);
-
- new_style = GTK_STYLE_GET_CLASS (style)->clone (style);
- GTK_STYLE_GET_CLASS (style)->copy (new_style, style);
-
- return new_style;
-}
-
-GtkStyle*
-_gtk_style_new_for_path (GdkScreen *screen,
- GtkWidgetPath *path)
-{
- GtkStyleContext *context;
- GtkStyle *style;
-
- context = gtk_style_context_new ();
-
- if (screen)
- gtk_style_context_set_screen (context, screen);
-
- gtk_style_context_set_path (context, path);
-
- style = g_object_new (GTK_TYPE_STYLE,
- "context", context,
- NULL);
-
- g_object_unref (context);
-
- return style;
-}
-
-/**
- * gtk_style_new:
- *
- * Creates a new #GtkStyle.
- *
- * Returns: a new #GtkStyle.
- *
- * Deprecated: 3.0: Use #GtkStyleContext
- */
-GtkStyle*
-gtk_style_new (void)
-{
- GtkWidgetPath *path;
- GtkStyle *style;
-
- path = gtk_widget_path_new ();
- gtk_widget_path_append_type (path, GTK_TYPE_WIDGET);
-
- style = _gtk_style_new_for_path (gdk_screen_get_default (), path);
-
- gtk_widget_path_free (path);
-
- return style;
-}
-
-/**
- * gtk_style_has_context:
- * @style: a #GtkStyle
- *
- * Returns whether @style has an associated #GtkStyleContext.
- *
- * Returns: %TRUE if @style has a #GtkStyleContext
- *
- * Since: 3.0
- */
-gboolean
-gtk_style_has_context (GtkStyle *style)
-{
- GtkStylePrivate *priv;
-
- priv = GTK_STYLE_GET_PRIVATE (style);
-
- return priv->context != NULL;
-}
-
-/**
- * gtk_style_attach: (skip)
- * @style: a #GtkStyle.
- * @window: a #GdkWindow.
- *
- * Attaches a style to a window; this process allocates the
- * colors and creates the GC’s for the style - it specializes
- * it to a particular visual. The process may involve the creation
- * of a new style if the style has already been attached to a
- * window with a different style and visual.
- *
- * Since this function may return a new object, you have to use it
- * in the following way:
- * `style = gtk_style_attach (style, window)`
- *
- * Returns: Either @style, or a newly-created #GtkStyle.
- * If the style is newly created, the style parameter
- * will be unref'ed, and the new style will have
- * a reference count belonging to the caller.
- *
- * Deprecated:3.0: Use gtk_widget_style_attach() instead
- */
-GtkStyle*
-gtk_style_attach (GtkStyle *style,
- GdkWindow *window)
-{
- g_return_val_if_fail (GTK_IS_STYLE (style), NULL);
- g_return_val_if_fail (window != NULL, NULL);
-
- return style;
-}
-
-/**
- * gtk_style_detach:
- * @style: a #GtkStyle
- *
- * Detaches a style from a window. If the style is not attached
- * to any windows anymore, it is unrealized. See gtk_style_attach().
- *
- * Deprecated:3.0: Use #GtkStyleContext instead
- */
-void
-gtk_style_detach (GtkStyle *style)
-{
- g_return_if_fail (GTK_IS_STYLE (style));
-}
-
-/**
- * gtk_style_lookup_icon_set:
- * @style: a #GtkStyle
- * @stock_id: an icon name
- *
- * Looks up @stock_id in the icon factories associated with @style
- * and the default icon factory, returning an icon set if found,
- * otherwise %NULL.
- *
- * Returns: (transfer none): icon set of @stock_id
- *
- * Deprecated:3.0: Use gtk_style_context_lookup_icon_set() instead
- */
-GtkIconSet*
-gtk_style_lookup_icon_set (GtkStyle *style,
- const char *stock_id)
-{
- GtkStylePrivate *priv;
-
- g_return_val_if_fail (GTK_IS_STYLE (style), NULL);
- g_return_val_if_fail (stock_id != NULL, NULL);
-
- priv = GTK_STYLE_GET_PRIVATE (style);
-
- if (priv->context)
- return gtk_style_context_lookup_icon_set (priv->context, stock_id);
-
- return gtk_icon_factory_lookup_default (stock_id);
-}
-
-/**
- * gtk_style_lookup_color:
- * @style: a #GtkStyle
- * @color_name: the name of the logical color to look up
- * @color: (out): the #GdkColor to fill in
- *
- * Looks up @color_name in the style’s logical color mappings,
- * filling in @color and returning %TRUE if found, otherwise
- * returning %FALSE. Do not cache the found mapping, because
- * it depends on the #GtkStyle and might change when a theme
- * switch occurs.
- *
- * Returns: %TRUE if the mapping was found.
- *
- * Since: 2.10
- *
- * Deprecated:3.0: Use gtk_style_context_lookup_color() instead
- **/
-gboolean
-gtk_style_lookup_color (GtkStyle *style,
- const char *color_name,
- GdkColor *color)
-{
- GtkStylePrivate *priv;
- gboolean result;
- GdkRGBA rgba;
-
- g_return_val_if_fail (GTK_IS_STYLE (style), FALSE);
- g_return_val_if_fail (color_name != NULL, FALSE);
- g_return_val_if_fail (color != NULL, FALSE);
-
- priv = GTK_STYLE_GET_PRIVATE (style);
-
- if (!priv->context)
- return FALSE;
-
- result = gtk_style_context_lookup_color (priv->context, color_name, &rgba);
-
- if (color)
- {
- color->red = (guint16) (rgba.red * 65535);
- color->green = (guint16) (rgba.green * 65535);
- color->blue = (guint16) (rgba.blue * 65535);
- color->pixel = 0;
- }
-
- return result;
-}
-
-/**
- * gtk_style_set_background:
- * @style: a #GtkStyle
- * @window: a #GdkWindow
- * @state_type: a state
- *
- * Sets the background of @window to the background color or pixmap
- * specified by @style for the given state.
- *
- * Deprecated:3.0: Use gtk_style_context_set_background() instead
- */
-void
-gtk_style_set_background (GtkStyle *style,
- GdkWindow *window,
- GtkStateType state_type)
-{
- g_return_if_fail (GTK_IS_STYLE (style));
- g_return_if_fail (window != NULL);
-
- GTK_STYLE_GET_CLASS (style)->set_background (style, window, state_type);
-}
-
-/* Default functions */
-static GtkStyle *
-gtk_style_real_clone (GtkStyle *style)
-{
- GtkStylePrivate *priv;
-
- priv = GTK_STYLE_GET_PRIVATE (style);
-
- return g_object_new (G_OBJECT_TYPE (style),
- "context", priv->context,
- NULL);
-}
-
-static void
-gtk_style_real_copy (GtkStyle *style,
- GtkStyle *src)
-{
- gint i;
-
- for (i = 0; i < 5; i++)
- {
- style->fg[i] = src->fg[i];
- style->bg[i] = src->bg[i];
- style->text[i] = src->text[i];
- style->base[i] = src->base[i];
-
- if (style->background[i])
- cairo_pattern_destroy (style->background[i]),
- style->background[i] = src->background[i];
- if (style->background[i])
- cairo_pattern_reference (style->background[i]);
- }
-
- if (style->font_desc)
- pango_font_description_free (style->font_desc);
- if (src->font_desc)
- style->font_desc = pango_font_description_copy (src->font_desc);
- else
- style->font_desc = NULL;
-
- style->xthickness = src->xthickness;
- style->ythickness = src->ythickness;
-
- if (style->rc_style)
- g_object_unref (style->rc_style);
- style->rc_style = src->rc_style;
- if (src->rc_style)
- g_object_ref (src->rc_style);
-
- g_slist_free_full (style->icon_factories, g_object_unref);
- style->icon_factories = g_slist_copy (src->icon_factories);
- g_slist_foreach (style->icon_factories, (GFunc) g_object_ref, NULL);
-}
-
-static void
-gtk_style_real_init_from_rc (GtkStyle *style,
- GtkRcStyle *rc_style)
-{
-}
-
-/**
- * gtk_style_get_style_property:
- * @style: a #GtkStyle
- * @widget_type: the #GType of a descendant of #GtkWidget
- * @property_name: the name of the style property to get
- * @value: (out): a #GValue where the value of the property being
- * queried will be stored
- *
- * Queries the value of a style property corresponding to a
- * widget class is in the given style.
- *
- * Since: 2.16
- */
-void
-gtk_style_get_style_property (GtkStyle *style,
- GType widget_type,
- const gchar *property_name,
- GValue *value)
-{
- GtkStylePrivate *priv;
- GtkWidgetClass *klass;
- GParamSpec *pspec;
- const GValue *peek_value;
-
- klass = g_type_class_ref (widget_type);
- pspec = gtk_widget_class_find_style_property (klass, property_name);
- g_type_class_unref (klass);
-
- if (!pspec)
- {
- g_warning ("%s: widget class `%s' has no property named `%s'",
- G_STRLOC,
- g_type_name (widget_type),
- property_name);
- return;
- }
-
- priv = GTK_STYLE_GET_PRIVATE (style);
- peek_value = _gtk_style_context_peek_style_property (priv->context,
- widget_type,
- pspec);
-
- if (G_VALUE_TYPE (value) == G_PARAM_SPEC_VALUE_TYPE (pspec))
- g_value_copy (peek_value, value);
- else if (g_value_type_transformable (G_PARAM_SPEC_VALUE_TYPE (pspec), G_VALUE_TYPE (value)))
- g_value_transform (peek_value, value);
- else
- g_warning ("can't retrieve style property `%s' of type `%s' as value of type `%s'",
- pspec->name,
- g_type_name (G_PARAM_SPEC_VALUE_TYPE (pspec)),
- G_VALUE_TYPE_NAME (value));
-}
-
-/**
- * gtk_style_get_valist:
- * @style: a #GtkStyle
- * @widget_type: the #GType of a descendant of #GtkWidget
- * @first_property_name: the name of the first style property to get
- * @var_args: a va_list of pairs of property names and
- * locations to return the property values, starting with the
- * location for @first_property_name.
- *
- * Non-vararg variant of gtk_style_get().
- * Used primarily by language bindings.
- *
- * Since: 2.16
- */
-void
-gtk_style_get_valist (GtkStyle *style,
- GType widget_type,
- const gchar *first_property_name,
- va_list var_args)
-{
- GtkStylePrivate *priv;
- const char *property_name;
- GtkWidgetClass *klass;
-
- g_return_if_fail (GTK_IS_STYLE (style));
-
- klass = g_type_class_ref (widget_type);
-
- priv = GTK_STYLE_GET_PRIVATE (style);
- property_name = first_property_name;
- while (property_name)
- {
- GParamSpec *pspec;
- const GValue *peek_value;
- gchar *error;
-
- pspec = gtk_widget_class_find_style_property (klass, property_name);
-
- if (!pspec)
- {
- g_warning ("%s: widget class `%s' has no property named `%s'",
- G_STRLOC,
- g_type_name (widget_type),
- property_name);
- break;
- }
-
- peek_value = _gtk_style_context_peek_style_property (priv->context, widget_type,
- pspec);
- G_VALUE_LCOPY (peek_value, var_args, 0, &error);
- if (error)
- {
- g_warning ("%s: %s", G_STRLOC, error);
- g_free (error);
- break;
- }
-
- property_name = va_arg (var_args, gchar*);
- }
-
- g_type_class_unref (klass);
-}
-
-/**
- * gtk_style_get:
- * @style: a #GtkStyle
- * @widget_type: the #GType of a descendant of #GtkWidget
- * @first_property_name: the name of the first style property to get
- * @...: pairs of property names and locations to
- * return the property values, starting with the location for
- * @first_property_name, terminated by %NULL.
- *
- * Gets the values of a multiple style properties for @widget_type
- * from @style.
- *
- * Since: 2.16
- */
-void
-gtk_style_get (GtkStyle *style,
- GType widget_type,
- const gchar *first_property_name,
- ...)
-{
- va_list var_args;
-
- va_start (var_args, first_property_name);
- gtk_style_get_valist (style, widget_type, first_property_name, var_args);
- va_end (var_args);
-}
-
-static void
-gtk_style_real_realize (GtkStyle *style)
-{
-}
-
-static void
-gtk_style_real_unrealize (GtkStyle *style)
-{
-}
-
-static void
-gtk_style_real_set_background (GtkStyle *style,
- GdkWindow *window,
- GtkStateType state_type)
-{
- gdk_window_set_background_pattern (window, style->background[state_type]);
-}
-
-/**
- * gtk_style_render_icon:
- * @style: a #GtkStyle
- * @source: the #GtkIconSource specifying the icon to render
- * @direction: a text direction
- * @state: a state
- * @size: (type int): the size to render the icon at (#GtkIconSize). A size of
- * `(GtkIconSize)-1` means render at the size of the source and
- * don’t scale.
- * @widget: (allow-none): the widget
- * @detail: (allow-none): a style detail
- *
- * Renders the icon specified by @source at the given @size
- * according to the given parameters and returns the result in a
- * pixbuf.
- *
- * Returns: (transfer full): a newly-created #GdkPixbuf
- * containing the rendered icon
- *
- * Deprecated:3.0: Use gtk_render_icon_pixbuf() instead
- */
-GdkPixbuf *
-gtk_style_render_icon (GtkStyle *style,
- const GtkIconSource *source,
- GtkTextDirection direction,
- GtkStateType state,
- GtkIconSize size,
- GtkWidget *widget,
- const gchar *detail)
-{
- GdkPixbuf *pixbuf;
-
- g_return_val_if_fail (GTK_IS_STYLE (style), NULL);
- g_return_val_if_fail (GTK_STYLE_GET_CLASS (style)->render_icon != NULL, NULL);
-
- pixbuf = GTK_STYLE_GET_CLASS (style)->render_icon (style, source, direction, state,
- size, widget, detail);
-
- g_return_val_if_fail (pixbuf != NULL, NULL);
-
- return pixbuf;
-}
-
-/* Default functions */
-
-/**
- * gtk_style_apply_default_background:
- * @style:
- * @cr:
- * @window:
- * @state_type:
- * @x:
- * @y:
- * @width:
- * @height:
- *
- * Deprecated:3.0: Use #GtkStyleContext instead
- */
-void
-gtk_style_apply_default_background (GtkStyle *style,
- cairo_t *cr,
- GdkWindow *window,
- GtkStateType state_type,
- gint x,
- gint y,
- gint width,
- gint height)
-{
- cairo_save (cr);
-
- if (style->background[state_type] == NULL)
- {
- GdkWindow *parent = gdk_window_get_parent (window);
- int x_offset, y_offset;
-
- if (parent)
- {
- gdk_window_get_position (window, &x_offset, &y_offset);
- cairo_translate (cr, -x_offset, -y_offset);
- gtk_style_apply_default_background (style, cr,
- parent, state_type,
- x + x_offset, y + y_offset,
- width, height);
- goto out;
- }
- else
- gdk_cairo_set_source_color (cr, &style->bg[state_type]);
- }
- else
- cairo_set_source (cr, style->background[state_type]);
-
- cairo_rectangle (cr, x, y, width, height);
- cairo_fill (cr);
-
-out:
- cairo_restore (cr);
-}
-
-static GdkPixbuf *
-gtk_default_render_icon (GtkStyle *style,
- const GtkIconSource *source,
- GtkTextDirection direction,
- GtkStateType state,
- GtkIconSize size,
- GtkWidget *widget,
- const gchar *detail)
-{
- GtkStyleContext *context;
- GtkStylePrivate *priv;
- GtkStateFlags flags = 0;
- GdkPixbuf *pixbuf;
-
- if (widget)
- context = gtk_widget_get_style_context (widget);
- else
- {
- priv = GTK_STYLE_GET_PRIVATE (style);
- context = priv->context;
- }
-
- if (!context)
- return NULL;
-
- gtk_style_context_save (context);
-
- if (detail)
- transform_detail_string (detail, context);
-
- switch (state)
- {
- case GTK_STATE_PRELIGHT:
- flags |= GTK_STATE_FLAG_PRELIGHT;
- break;
- case GTK_STATE_INSENSITIVE:
- flags |= GTK_STATE_FLAG_INSENSITIVE;
- break;
- default:
- break;
- }
-
- gtk_style_context_set_state (context, flags);
-
- pixbuf = gtk_render_icon_pixbuf (context, source, size);
-
- gtk_style_context_restore (context);
-
- return pixbuf;
-}
-
-static void
-_cairo_draw_line (cairo_t *cr,
- GdkColor *color,
- gint x1,
- gint y1,
- gint x2,
- gint y2)
-{
- cairo_save (cr);
-
- gdk_cairo_set_source_color (cr, color);
- cairo_set_line_cap (cr, CAIRO_LINE_CAP_SQUARE);
-
- cairo_move_to (cr, x1 + 0.5, y1 + 0.5);
- cairo_line_to (cr, x2 + 0.5, y2 + 0.5);
- cairo_stroke (cr);
-
- cairo_restore (cr);
-}
-
-static void
-transform_detail_string (const gchar *detail,
- GtkStyleContext *context)
-{
- if (!detail)
- return;
-
- if (strcmp (detail, "arrow") == 0)
- gtk_style_context_add_class (context, "arrow");
- else if (strcmp (detail, "button") == 0)
- gtk_style_context_add_class (context, "button");
- else if (strcmp (detail, "buttondefault") == 0)
- {
- gtk_style_context_add_class (context, "button");
- gtk_style_context_add_class (context, "default");
- }
- else if (strcmp (detail, "calendar") == 0)
- gtk_style_context_add_class (context, "calendar");
- else if (strcmp (detail, "cellcheck") == 0)
- {
- gtk_style_context_add_class (context, "cell");
- gtk_style_context_add_class (context, "check");
- }
- else if (strcmp (detail, "cellradio") == 0)
- {
- gtk_style_context_add_class (context, "cell");
- gtk_style_context_add_class (context, "radio");
- }
- else if (strcmp (detail, "checkbutton") == 0)
- gtk_style_context_add_class (context, "check");
- else if (strcmp (detail, "check") == 0)
- {
- gtk_style_context_add_class (context, "check");
- gtk_style_context_add_class (context, "menu");
- }
- else if (strcmp (detail, "radiobutton") == 0)
- {
- gtk_style_context_add_class (context, "radio");
- }
- else if (strcmp (detail, "option") == 0)
- {
- gtk_style_context_add_class (context, "radio");
- gtk_style_context_add_class (context, "menu");
- }
- else if (strcmp (detail, "entry") == 0 ||
- strcmp (detail, "entry_bg") == 0)
- gtk_style_context_add_class (context, "entry");
- else if (strcmp (detail, "expander") == 0)
- gtk_style_context_add_class (context, "expander");
- else if (strcmp (detail, "tooltip") == 0)
- gtk_style_context_add_class (context, "tooltip");
- else if (strcmp (detail, "frame") == 0)
- gtk_style_context_add_class (context, "frame");
- else if (strcmp (detail, "scrolled_window") == 0)
- gtk_style_context_add_class (context, "scrolled-window");
- else if (strcmp (detail, "viewport") == 0 ||
- strcmp (detail, "viewportbin") == 0)
- gtk_style_context_add_class (context, "viewport");
- else if (strncmp (detail, "trough", 6) == 0)
- gtk_style_context_add_class (context, "trough");
- else if (strcmp (detail, "spinbutton") == 0)
- gtk_style_context_add_class (context, "spinbutton");
- else if (strcmp (detail, "spinbutton_up") == 0)
- {
- gtk_style_context_add_class (context, "spinbutton");
- gtk_style_context_add_class (context, "button");
- gtk_style_context_set_junction_sides (context, GTK_JUNCTION_BOTTOM);
- }
- else if (strcmp (detail, "spinbutton_down") == 0)
- {
- gtk_style_context_add_class (context, "spinbutton");
- gtk_style_context_add_class (context, "button");
- gtk_style_context_set_junction_sides (context, GTK_JUNCTION_TOP);
- }
- else if ((detail[0] == 'h' || detail[0] == 'v') &&
- strncmp (&detail[1], "scrollbar_", 10) == 0)
- {
- gtk_style_context_add_class (context, "button");
- gtk_style_context_add_class (context, "scrollbar");
- }
- else if (strcmp (detail, "slider") == 0)
- {
- gtk_style_context_add_class (context, "slider");
- gtk_style_context_add_class (context, "scrollbar");
- }
- else if (strcmp (detail, "vscale") == 0 ||
- strcmp (detail, "hscale") == 0)
- {
- gtk_style_context_add_class (context, "slider");
- gtk_style_context_add_class (context, "scale");
- }
- else if (strcmp (detail, "menuitem") == 0)
- {
- gtk_style_context_add_class (context, "menuitem");
- gtk_style_context_add_class (context, "menu");
- }
- else if (strcmp (detail, "menu") == 0)
- {
- gtk_style_context_add_class (context, "popup");
- gtk_style_context_add_class (context, "menu");
- }
- else if (strcmp (detail, "accellabel") == 0)
- gtk_style_context_add_class (context, "accelerator");
- else if (strcmp (detail, "menubar") == 0)
- gtk_style_context_add_class (context, "menubar");
- else if (strcmp (detail, "base") == 0)
- gtk_style_context_add_class (context, "background");
- else if (strcmp (detail, "bar") == 0 ||
- strcmp (detail, "progressbar") == 0)
- gtk_style_context_add_class (context, "progressbar");
- else if (strcmp (detail, "toolbar") == 0)
- gtk_style_context_add_class (context, "toolbar");
- else if (strcmp (detail, "handlebox_bin") == 0)
- gtk_style_context_add_class (context, "dock");
- else if (strcmp (detail, "notebook") == 0)
- gtk_style_context_add_class (context, "notebook");
- else if (strcmp (detail, "tab") == 0)
- {
- gtk_style_context_add_class (context, "notebook");
- gtk_style_context_add_region (context, GTK_STYLE_REGION_TAB, 0);
- }
- else if (g_str_has_prefix (detail, "cell"))
- {
- GtkRegionFlags row, col;
- gboolean ruled = FALSE;
- GStrv tokens;
- guint i;
-
- tokens = g_strsplit (detail, "_", -1);
- row = col = 0;
- i = 0;
-
- while (tokens[i])
- {
- if (strcmp (tokens[i], "even") == 0)
- row |= GTK_REGION_EVEN;
- else if (strcmp (tokens[i], "odd") == 0)
- row |= GTK_REGION_ODD;
- else if (strcmp (tokens[i], "start") == 0)
- col |= GTK_REGION_FIRST;
- else if (strcmp (tokens[i], "end") == 0)
- col |= GTK_REGION_LAST;
- else if (strcmp (tokens[i], "ruled") == 0)
- ruled = TRUE;
- else if (strcmp (tokens[i], "sorted") == 0)
- col |= GTK_REGION_SORTED;
-
- i++;
- }
-
- if (!ruled)
- row &= ~(GTK_REGION_EVEN | GTK_REGION_ODD);
-
- gtk_style_context_add_class (context, "cell");
- gtk_style_context_add_region (context, "row", row);
- gtk_style_context_add_region (context, "column", col);
-
- g_strfreev (tokens);
- }
-}
-
-static void
-gtk_default_draw_hline (GtkStyle *style,
- cairo_t *cr,
- GtkStateType state_type,
- GtkWidget *widget,
- const gchar *detail,
- gint x1,
- gint x2,
- gint y)
-{
- GtkStyleContext *context;
- GtkStylePrivate *priv;
-
- if (widget)
- context = gtk_widget_get_style_context (widget);
- else
- {
- priv = GTK_STYLE_GET_PRIVATE (style);
- context = priv->context;
- }
-
- gtk_style_context_save (context);
-
- if (detail)
- transform_detail_string (detail, context);
-
- cairo_save (cr);
-
- gtk_render_line (context, cr,
- x1, y, x2, y);
-
- cairo_restore (cr);
-
- gtk_style_context_restore (context);
-}
-
-
-static void
-gtk_default_draw_vline (GtkStyle *style,
- cairo_t *cr,
- GtkStateType state_type,
- GtkWidget *widget,
- const gchar *detail,
- gint y1,
- gint y2,
- gint x)
-{
- GtkStyleContext *context;
- GtkStylePrivate *priv;
-
- if (widget)
- context = gtk_widget_get_style_context (widget);
- else
- {
- priv = GTK_STYLE_GET_PRIVATE (style);
- context = priv->context;
- }
-
- gtk_style_context_save (context);
-
- if (detail)
- transform_detail_string (detail, context);
-
- cairo_save (cr);
-
- gtk_render_line (context, cr,
- x, y1, x, y2);
-
- cairo_restore (cr);
- gtk_style_context_restore (context);
-}
-
-static void
-gtk_default_draw_shadow (GtkStyle *style,
- cairo_t *cr,
- GtkStateType state_type,
- GtkShadowType shadow_type,
- GtkWidget *widget,
- const gchar *detail,
- gint x,
- gint y,
- gint width,
- gint height)
-{
- GtkStyleContext *context;
- GtkStylePrivate *priv;
-
- if (shadow_type == GTK_SHADOW_NONE)
- return;
-
- if (widget)
- context = gtk_widget_get_style_context (widget);
- else
- {
- priv = GTK_STYLE_GET_PRIVATE (style);
- context = priv->context;
- }
-
- gtk_style_context_save (context);
-
- if (detail)
- transform_detail_string (detail, context);
-
- cairo_save (cr);
-
- gtk_render_frame (context, cr,
- (gdouble) x,
- (gdouble) y,
- (gdouble) width,
- (gdouble) height);
-
- cairo_restore (cr);
- gtk_style_context_restore (context);
-}
-
-static void
-draw_arrow (cairo_t *cr,
- GdkColor *color,
- GtkArrowType arrow_type,
- gint x,
- gint y,
- gint width,
- gint height)
-{
- gdk_cairo_set_source_color (cr, color);
- cairo_save (cr);
-
- if (arrow_type == GTK_ARROW_DOWN)
- {
- cairo_move_to (cr, x, y);
- cairo_line_to (cr, x + width, y);
- cairo_line_to (cr, x + width / 2., y + height);
- }
- else if (arrow_type == GTK_ARROW_UP)
- {
- cairo_move_to (cr, x, y + height);
- cairo_line_to (cr, x + width / 2., y);
- cairo_line_to (cr, x + width, y + height);
- }
- else if (arrow_type == GTK_ARROW_LEFT)
- {
- cairo_move_to (cr, x + width, y);
- cairo_line_to (cr, x + width, y + height);
- cairo_line_to (cr, x, y + height / 2.);
- }
- else if (arrow_type == GTK_ARROW_RIGHT)
- {
- cairo_move_to (cr, x, y);
- cairo_line_to (cr, x + width, y + height / 2.);
- cairo_line_to (cr, x, y + height);
- }
-
- cairo_close_path (cr);
- cairo_fill (cr);
-
- cairo_restore (cr);
-}
-
-static void
-gtk_default_draw_arrow (GtkStyle *style,
- cairo_t *cr,
- GtkStateType state,
- GtkShadowType shadow,
- GtkWidget *widget,
- const gchar *detail,
- GtkArrowType arrow_type,
- gboolean fill,
- gint x,
- gint y,
- gint width,
- gint height)
-{
- GtkStyleContext *context;
- GtkStylePrivate *priv;
- GtkStateFlags flags = 0;
- gdouble angle, size;
-
- if (arrow_type == GTK_ARROW_NONE)
- return;
-
- if (widget)
- context = gtk_widget_get_style_context (widget);
- else
- {
- priv = GTK_STYLE_GET_PRIVATE (style);
- context = priv->context;
- }
-
- gtk_style_context_save (context);
-
- if (detail)
- transform_detail_string (detail, context);
-
- switch (arrow_type)
- {
- case GTK_ARROW_UP:
- angle = 0;
- size = width;
- break;
- case GTK_ARROW_RIGHT:
- angle = G_PI / 2;
- size = height;
- break;
- case GTK_ARROW_DOWN:
- angle = G_PI;
- size = width;
- break;
- case GTK_ARROW_LEFT:
- angle = 3 * (G_PI / 2);
- size = height;
- break;
- default:
- g_assert_not_reached ();
- }
-
- switch (state)
- {
- case GTK_STATE_PRELIGHT:
- flags |= GTK_STATE_FLAG_PRELIGHT;
- break;
- case GTK_STATE_SELECTED:
- flags |= GTK_STATE_FLAG_SELECTED;
- break;
- case GTK_STATE_INSENSITIVE:
- flags |= GTK_STATE_FLAG_INSENSITIVE;
- break;
- case GTK_STATE_ACTIVE:
- flags |= GTK_STATE_FLAG_ACTIVE;
- break;
- default:
- break;
- }
-
- gtk_style_context_set_state (context, flags);
-
- cairo_save (cr);
-
- gtk_render_arrow (context,
- cr, angle,
- (gdouble) x,
- (gdouble) y,
- size);
-
- cairo_restore (cr);
- gtk_style_context_restore (context);
-}
-
-static void
-gtk_default_draw_diamond (GtkStyle *style,
- cairo_t *cr,
- GtkStateType state_type,
- GtkShadowType shadow_type,
- GtkWidget *widget,
- const gchar *detail,
- gint x,
- gint y,
- gint width,
- gint height)
-{
- gint half_width;
- gint half_height;
- GdkColor *outer_nw = NULL;
- GdkColor *outer_ne = NULL;
- GdkColor *outer_sw = NULL;
- GdkColor *outer_se = NULL;
- GdkColor *middle_nw = NULL;
- GdkColor *middle_ne = NULL;
- GdkColor *middle_sw = NULL;
- GdkColor *middle_se = NULL;
- GdkColor *inner_nw = NULL;
- GdkColor *inner_ne = NULL;
- GdkColor *inner_sw = NULL;
- GdkColor *inner_se = NULL;
-
- half_width = width / 2;
- half_height = height / 2;
-
- switch (shadow_type)
- {
- case GTK_SHADOW_IN:
- inner_sw = inner_se = &style->bg[state_type];
- middle_sw = middle_se = &style->light[state_type];
- outer_sw = outer_se = &style->light[state_type];
- inner_nw = inner_ne = &style->black;
- middle_nw = middle_ne = &style->dark[state_type];
- outer_nw = outer_ne = &style->dark[state_type];
- break;
-
- case GTK_SHADOW_OUT:
- inner_sw = inner_se = &style->dark[state_type];
- middle_sw = middle_se = &style->dark[state_type];
- outer_sw = outer_se = &style->black;
- inner_nw = inner_ne = &style->bg[state_type];
- middle_nw = middle_ne = &style->light[state_type];
- outer_nw = outer_ne = &style->light[state_type];
- break;
-
- case GTK_SHADOW_ETCHED_IN:
- inner_sw = inner_se = &style->bg[state_type];
- middle_sw = middle_se = &style->dark[state_type];
- outer_sw = outer_se = &style->light[state_type];
- inner_nw = inner_ne = &style->bg[state_type];
- middle_nw = middle_ne = &style->light[state_type];
- outer_nw = outer_ne = &style->dark[state_type];
- break;
-
- case GTK_SHADOW_ETCHED_OUT:
- inner_sw = inner_se = &style->bg[state_type];
- middle_sw = middle_se = &style->light[state_type];
- outer_sw = outer_se = &style->dark[state_type];
- inner_nw = inner_ne = &style->bg[state_type];
- middle_nw = middle_ne = &style->dark[state_type];
- outer_nw = outer_ne = &style->light[state_type];
- break;
-
- default:
-
- break;
- }
-
- if (inner_sw)
- {
- _cairo_draw_line (cr, inner_sw,
- x + 2, y + half_height,
- x + half_width, y + height - 2);
- _cairo_draw_line (cr, inner_se,
- x + half_width, y + height - 2,
- x + width - 2, y + half_height);
- _cairo_draw_line (cr, middle_sw,
- x + 1, y + half_height,
- x + half_width, y + height - 1);
- _cairo_draw_line (cr, middle_se,
- x + half_width, y + height - 1,
- x + width - 1, y + half_height);
- _cairo_draw_line (cr, outer_sw,
- x, y + half_height,
- x + half_width, y + height);
- _cairo_draw_line (cr, outer_se,
- x + half_width, y + height,
- x + width, y + half_height);
-
- _cairo_draw_line (cr, inner_nw,
- x + 2, y + half_height,
- x + half_width, y + 2);
- _cairo_draw_line (cr, inner_ne,
- x + half_width, y + 2,
- x + width - 2, y + half_height);
- _cairo_draw_line (cr, middle_nw,
- x + 1, y + half_height,
- x + half_width, y + 1);
- _cairo_draw_line (cr, middle_ne,
- x + half_width, y + 1,
- x + width - 1, y + half_height);
- _cairo_draw_line (cr, outer_nw,
- x, y + half_height,
- x + half_width, y);
- _cairo_draw_line (cr, outer_ne,
- x + half_width, y,
- x + width, y + half_height);
- }
-}
-
-static void
-option_menu_get_props (GtkWidget *widget,
- GtkRequisition *indicator_size,
- GtkBorder *indicator_spacing)
-{
- GtkRequisition *tmp_size = NULL;
- GtkBorder *tmp_spacing = NULL;
-
- if (tmp_size)
- {
- *indicator_size = *tmp_size;
- gtk_requisition_free (tmp_size);
- }
- else
- *indicator_size = default_option_indicator_size;
-
- if (tmp_spacing)
- {
- *indicator_spacing = *tmp_spacing;
- gtk_border_free (tmp_spacing);
- }
- else
- *indicator_spacing = default_option_indicator_spacing;
-}
-
-static void
-gtk_default_draw_box (GtkStyle *style,
- cairo_t *cr,
- GtkStateType state_type,
- GtkShadowType shadow_type,
- GtkWidget *widget,
- const gchar *detail,
- gint x,
- gint y,
- gint width,
- gint height)
-{
- GtkStyleContext *context;
- GtkStylePrivate *priv;
- GtkStateFlags flags = 0;
-
- if (widget)
- context = gtk_widget_get_style_context (widget);
- else
- {
- priv = GTK_STYLE_GET_PRIVATE (style);
- context = priv->context;
- }
-
- gtk_style_context_save (context);
-
- if (detail)
- transform_detail_string (detail, context);
-
- switch (state_type)
- {
- case GTK_STATE_ACTIVE:
- flags |= GTK_STATE_FLAG_ACTIVE;
- break;
- case GTK_STATE_PRELIGHT:
- flags |= GTK_STATE_FLAG_PRELIGHT;
- break;
- case GTK_STATE_SELECTED:
- flags |= GTK_STATE_FLAG_SELECTED;
- break;
- case GTK_STATE_INSENSITIVE:
- flags |= GTK_STATE_FLAG_INSENSITIVE;
- break;
- default:
- break;
- }
-
- if (shadow_type == GTK_SHADOW_IN)
- flags |= GTK_STATE_FLAG_ACTIVE;
-
- gtk_style_context_set_state (context, flags);
-
- cairo_save (cr);
-
- gtk_render_background (context, cr, x, y, width, height);
-
- if (shadow_type != GTK_SHADOW_NONE)
- gtk_render_frame (context, cr, x, y, width, height);
-
- cairo_restore (cr);
- gtk_style_context_restore (context);
-}
-
-static void
-gtk_default_draw_flat_box (GtkStyle *style,
- cairo_t *cr,
- GtkStateType state_type,
- GtkShadowType shadow_type,
- GtkWidget *widget,
- const gchar *detail,
- gint x,
- gint y,
- gint width,
- gint height)
-{
- GtkStyleContext *context;
- GtkStylePrivate *priv;
- GtkStateFlags flags = 0;
-
- if (widget)
- context = gtk_widget_get_style_context (widget);
- else
- {
- priv = GTK_STYLE_GET_PRIVATE (style);
- context = priv->context;
- }
-
- gtk_style_context_save (context);
-
- if (detail)
- transform_detail_string (detail, context);
-
- switch (state_type)
- {
- case GTK_STATE_PRELIGHT:
- flags |= GTK_STATE_FLAG_PRELIGHT;
- break;
- case GTK_STATE_SELECTED:
- flags |= GTK_STATE_FLAG_SELECTED;
- break;
- case GTK_STATE_INSENSITIVE:
- flags |= GTK_STATE_FLAG_INSENSITIVE;
- break;
- case GTK_STATE_ACTIVE:
- flags |= GTK_STATE_FLAG_ACTIVE;
- break;
- case GTK_STATE_FOCUSED:
- flags |= GTK_STATE_FLAG_FOCUSED;
- break;
- default:
- break;
- }
-
- gtk_style_context_set_state (context, flags);
-
- cairo_save (cr);
-
- gtk_render_background (context, cr,
- (gdouble) x,
- (gdouble) y,
- (gdouble) width,
- (gdouble) height);
-
- cairo_restore (cr);
- gtk_style_context_restore (context);
-}
-
-static void
-gtk_default_draw_check (GtkStyle *style,
- cairo_t *cr,
- GtkStateType state_type,
- GtkShadowType shadow_type,
- GtkWidget *widget,
- const gchar *detail,
- gint x,
- gint y,
- gint width,
- gint height)
-{
- GtkStyleContext *context;
- GtkStylePrivate *priv;
- GtkStateFlags flags = 0;
-
- if (widget)
- context = gtk_widget_get_style_context (widget);
- else
- {
- priv = GTK_STYLE_GET_PRIVATE (style);
- context = priv->context;
- }
-
- gtk_style_context_save (context);
-
- if (detail)
- transform_detail_string (detail, context);
-
- switch (state_type)
- {
- case GTK_STATE_PRELIGHT:
- flags |= GTK_STATE_FLAG_PRELIGHT;
- break;
- case GTK_STATE_SELECTED:
- flags |= GTK_STATE_FLAG_SELECTED;
- break;
- case GTK_STATE_INSENSITIVE:
- flags |= GTK_STATE_FLAG_INSENSITIVE;
- break;
- default:
- break;
- }
-
- if (shadow_type == GTK_SHADOW_IN)
- flags |= GTK_STATE_FLAG_ACTIVE;
- else if (shadow_type == GTK_SHADOW_ETCHED_IN)
- flags |= GTK_STATE_FLAG_INCONSISTENT;
-
- gtk_style_context_set_state (context, flags);
-
- cairo_save (cr);
-
- gtk_render_check (context,
- cr, x, y,
- width, height);
-
- cairo_restore (cr);
- gtk_style_context_restore (context);
-}
-
-static void
-gtk_default_draw_option (GtkStyle *style,
- cairo_t *cr,
- GtkStateType state_type,
- GtkShadowType shadow_type,
- GtkWidget *widget,
- const gchar *detail,
- gint x,
- gint y,
- gint width,
- gint height)
-{
- GtkStyleContext *context;
- GtkStylePrivate *priv;
- GtkStateFlags flags = 0;
-
- if (widget)
- context = gtk_widget_get_style_context (widget);
- else
- {
- priv = GTK_STYLE_GET_PRIVATE (style);
- context = priv->context;
- }
-
- gtk_style_context_save (context);
-
- if (detail)
- transform_detail_string (detail, context);
-
- switch (state_type)
- {
- case GTK_STATE_PRELIGHT:
- flags |= GTK_STATE_FLAG_PRELIGHT;
- break;
- case GTK_STATE_SELECTED:
- flags |= GTK_STATE_FLAG_SELECTED;
- break;
- case GTK_STATE_INSENSITIVE:
- flags |= GTK_STATE_FLAG_INSENSITIVE;
- break;
- default:
- break;
- }
-
- if (shadow_type == GTK_SHADOW_IN)
- flags |= GTK_STATE_FLAG_ACTIVE;
- else if (shadow_type == GTK_SHADOW_ETCHED_IN)
- flags |= GTK_STATE_FLAG_INCONSISTENT;
-
- gtk_style_context_set_state (context, flags);
-
- cairo_save (cr);
- gtk_render_option (context, cr,
- (gdouble) x,
- (gdouble) y,
- (gdouble) width,
- (gdouble) height);
-
- cairo_restore (cr);
- gtk_style_context_restore (context);
-}
-
-static void
-gtk_default_draw_tab (GtkStyle *style,
- cairo_t *cr,
- GtkStateType state_type,
- GtkShadowType shadow_type,
- GtkWidget *widget,
- const gchar *detail,
- gint x,
- gint y,
- gint width,
- gint height)
-{
-#define ARROW_SPACE 4
-
- GtkRequisition indicator_size;
- GtkBorder indicator_spacing;
- gint arrow_height;
-
- option_menu_get_props (widget, &indicator_size, &indicator_spacing);
-
- indicator_size.width += (indicator_size.width % 2) - 1;
- arrow_height = indicator_size.width / 2 + 1;
-
- x += (width - indicator_size.width) / 2;
- y += (height - (2 * arrow_height + ARROW_SPACE)) / 2;
-
- if (state_type == GTK_STATE_INSENSITIVE)
- {
- draw_arrow (cr, &style->white,
- GTK_ARROW_UP, x + 1, y + 1,
- indicator_size.width, arrow_height);
-
- draw_arrow (cr, &style->white,
- GTK_ARROW_DOWN, x + 1, y + arrow_height + ARROW_SPACE + 1,
- indicator_size.width, arrow_height);
- }
-
- draw_arrow (cr, &style->fg[state_type],
- GTK_ARROW_UP, x, y,
- indicator_size.width, arrow_height);
-
-
- draw_arrow (cr, &style->fg[state_type],
- GTK_ARROW_DOWN, x, y + arrow_height + ARROW_SPACE,
- indicator_size.width, arrow_height);
-}
-
-static void
-gtk_default_draw_shadow_gap (GtkStyle *style,
- cairo_t *cr,
- GtkStateType state_type,
- GtkShadowType shadow_type,
- GtkWidget *widget,
- const gchar *detail,
- gint x,
- gint y,
- gint width,
- gint height,
- GtkPositionType gap_side,
- gint gap_x,
- gint gap_width)
-{
- GtkStyleContext *context;
- GtkStylePrivate *priv;
- GtkStateFlags flags = 0;
-
- if (shadow_type == GTK_SHADOW_NONE)
- return;
-
- if (widget)
- context = gtk_widget_get_style_context (widget);
- else
- {
- priv = GTK_STYLE_GET_PRIVATE (style);
- context = priv->context;
- }
-
- gtk_style_context_save (context);
-
- if (detail)
- transform_detail_string (detail, context);
-
- switch (state_type)
- {
- case GTK_STATE_ACTIVE:
- flags |= GTK_STATE_FLAG_ACTIVE;
- break;
- case GTK_STATE_PRELIGHT:
- flags |= GTK_STATE_FLAG_PRELIGHT;
- break;
- case GTK_STATE_SELECTED:
- flags |= GTK_STATE_FLAG_SELECTED;
- break;
- case GTK_STATE_INSENSITIVE:
- flags |= GTK_STATE_FLAG_INSENSITIVE;
- break;
- default:
- break;
- }
-
- gtk_style_context_set_state (context, flags);
-
- cairo_save (cr);
- gtk_render_frame_gap (context, cr,
- (gdouble) x,
- (gdouble) y,
- (gdouble) width,
- (gdouble) height,
- gap_side,
- (gdouble) gap_x,
- (gdouble) gap_x + gap_width);
-
- cairo_restore (cr);
- gtk_style_context_restore (context);
-}
-
-static void
-gtk_default_draw_box_gap (GtkStyle *style,
- cairo_t *cr,
- GtkStateType state_type,
- GtkShadowType shadow_type,
- GtkWidget *widget,
- const gchar *detail,
- gint x,
- gint y,
- gint width,
- gint height,
- GtkPositionType gap_side,
- gint gap_x,
- gint gap_width)
-{
- GtkStyleContext *context;
- GtkStylePrivate *priv;
- GtkStateFlags flags = 0;
-
- if (widget)
- context = gtk_widget_get_style_context (widget);
- else
- {
- priv = GTK_STYLE_GET_PRIVATE (style);
- context = priv->context;
- }
-
- gtk_style_context_save (context);
-
- if (detail)
- transform_detail_string (detail, context);
-
- switch (state_type)
- {
- case GTK_STATE_ACTIVE:
- flags |= GTK_STATE_FLAG_ACTIVE;
- break;
- case GTK_STATE_PRELIGHT:
- flags |= GTK_STATE_FLAG_PRELIGHT;
- break;
- case GTK_STATE_SELECTED:
- flags |= GTK_STATE_FLAG_SELECTED;
- break;
- case GTK_STATE_INSENSITIVE:
- flags |= GTK_STATE_FLAG_INSENSITIVE;
- break;
- default:
- break;
- }
-
- gtk_style_context_set_state (context, flags);
-
- cairo_save (cr);
- gtk_render_background (context, cr,
- (gdouble) x,
- (gdouble) y,
- (gdouble) width,
- (gdouble) height);
-
-
- if (shadow_type != GTK_SHADOW_NONE)
- gtk_render_frame_gap (context, cr,
- (gdouble) x,
- (gdouble) y,
- (gdouble) width,
- (gdouble) height,
- gap_side,
- (gdouble) gap_x,
- (gdouble) gap_x + gap_width);
-
- cairo_restore (cr);
- gtk_style_context_restore (context);
-}
-
-static void
-gtk_default_draw_extension (GtkStyle *style,
- cairo_t *cr,
- GtkStateType state_type,
- GtkShadowType shadow_type,
- GtkWidget *widget,
- const gchar *detail,
- gint x,
- gint y,
- gint width,
- gint height,
- GtkPositionType gap_side)
-{
- GtkStyleContext *context;
- GtkStylePrivate *priv;
- GtkStateFlags flags = 0;
-
- if (widget)
- context = gtk_widget_get_style_context (widget);
- else
- {
- priv = GTK_STYLE_GET_PRIVATE (style);
- context = priv->context;
- }
-
- gtk_style_context_save (context);
-
- if (detail)
- transform_detail_string (detail, context);
-
- switch (state_type)
- {
- case GTK_STATE_ACTIVE:
- flags |= GTK_STATE_FLAG_ACTIVE;
- break;
- case GTK_STATE_PRELIGHT:
- flags |= GTK_STATE_FLAG_PRELIGHT;
- break;
- case GTK_STATE_SELECTED:
- flags |= GTK_STATE_FLAG_SELECTED;
- break;
- case GTK_STATE_INSENSITIVE:
- flags |= GTK_STATE_FLAG_INSENSITIVE;
- break;
- default:
- break;
- }
-
- gtk_style_context_set_state (context, flags);
-
- cairo_save (cr);
-
- gtk_render_extension (context, cr,
- (gdouble) x,
- (gdouble) y,
- (gdouble) width,
- (gdouble) height,
- gap_side);
-
- cairo_restore (cr);
- gtk_style_context_restore (context);
-}
-
-static void
-gtk_default_draw_focus (GtkStyle *style,
- cairo_t *cr,
- GtkStateType state_type,
- GtkWidget *widget,
- const gchar *detail,
- gint x,
- gint y,
- gint width,
- gint height)
-{
- GtkStyleContext *context;
- GtkStylePrivate *priv;
-
- if (widget)
- context = gtk_widget_get_style_context (widget);
- else
- {
- priv = GTK_STYLE_GET_PRIVATE (style);
- context = priv->context;
- }
-
- gtk_style_context_save (context);
-
- if (detail)
- transform_detail_string (detail, context);
-
- cairo_save (cr);
-
- gtk_render_focus (context, cr,
- (gdouble) x,
- (gdouble) y,
- (gdouble) width,
- (gdouble) height);
-
- cairo_restore (cr);
- gtk_style_context_restore (context);
-}
-
-static void
-gtk_default_draw_slider (GtkStyle *style,
- cairo_t *cr,
- GtkStateType state_type,
- GtkShadowType shadow_type,
- GtkWidget *widget,
- const gchar *detail,
- gint x,
- gint y,
- gint width,
- gint height,
- GtkOrientation orientation)
-{
- GtkStyleContext *context;
- GtkStylePrivate *priv;
- GtkStateFlags flags = 0;
-
- if (widget)
- context = gtk_widget_get_style_context (widget);
- else
- {
- priv = GTK_STYLE_GET_PRIVATE (style);
- context = priv->context;
- }
-
- gtk_style_context_save (context);
-
- if (detail)
- transform_detail_string (detail, context);
-
- switch (state_type)
- {
- case GTK_STATE_PRELIGHT:
- flags |= GTK_STATE_FLAG_PRELIGHT;
- break;
- case GTK_STATE_SELECTED:
- flags |= GTK_STATE_FLAG_SELECTED;
- break;
- case GTK_STATE_INSENSITIVE:
- flags |= GTK_STATE_FLAG_INSENSITIVE;
- break;
- default:
- break;
- }
-
- gtk_style_context_set_state (context, flags);
-
- cairo_save (cr);
-
- gtk_render_slider (context, cr, x, y, width, height, orientation);
-
- cairo_restore (cr);
- gtk_style_context_restore (context);
-}
-
-static void
-gtk_default_draw_handle (GtkStyle *style,
- cairo_t *cr,
- GtkStateType state_type,
- GtkShadowType shadow_type,
- GtkWidget *widget,
- const gchar *detail,
- gint x,
- gint y,
- gint width,
- gint height,
- GtkOrientation orientation)
-{
- GtkStyleContext *context;
- GtkStylePrivate *priv;
- GtkStateFlags flags = 0;
-
- if (widget)
- context = gtk_widget_get_style_context (widget);
- else
- {
- priv = GTK_STYLE_GET_PRIVATE (style);
- context = priv->context;
- }
-
- gtk_style_context_save (context);
-
- if (detail)
- transform_detail_string (detail, context);
-
- switch (state_type)
- {
- case GTK_STATE_PRELIGHT:
- flags |= GTK_STATE_FLAG_PRELIGHT;
- break;
- case GTK_STATE_SELECTED:
- flags |= GTK_STATE_FLAG_SELECTED;
- break;
- case GTK_STATE_INSENSITIVE:
- flags |= GTK_STATE_FLAG_INSENSITIVE;
- break;
- default:
- break;
- }
-
- gtk_style_context_set_state (context, flags);
-
- cairo_save (cr);
-
- gtk_render_handle (context, cr,
- (gdouble) x,
- (gdouble) y,
- (gdouble) width,
- (gdouble) height);
-
- cairo_restore (cr);
- gtk_style_context_restore (context);
-}
-
-static void
-gtk_default_draw_expander (GtkStyle *style,
- cairo_t *cr,
- GtkStateType state_type,
- GtkWidget *widget,
- const gchar *detail,
- gint x,
- gint y,
- GtkExpanderStyle expander_style)
-{
- GtkStyleContext *context;
- GtkStylePrivate *priv;
- GtkStateFlags flags = 0;
- gint size;
-
- if (widget)
- context = gtk_widget_get_style_context (widget);
- else
- {
- priv = GTK_STYLE_GET_PRIVATE (style);
- context = priv->context;
- }
-
- gtk_style_context_save (context);
-
- if (detail)
- transform_detail_string (detail, context);
-
- gtk_style_context_add_class (context, "expander");
-
- switch (state_type)
- {
- case GTK_STATE_PRELIGHT:
- flags |= GTK_STATE_FLAG_PRELIGHT;
- break;
- case GTK_STATE_SELECTED:
- flags |= GTK_STATE_FLAG_SELECTED;
- break;
- case GTK_STATE_INSENSITIVE:
- flags |= GTK_STATE_FLAG_INSENSITIVE;
- break;
- default:
- break;
- }
-
- if (widget &&
- gtk_widget_class_find_style_property (GTK_WIDGET_GET_CLASS (widget),
- "expander-size"))
- gtk_widget_style_get (widget, "expander-size", &size, NULL);
- else
- size = 12;
-
- if (expander_style == GTK_EXPANDER_EXPANDED)
- flags |= GTK_STATE_FLAG_ACTIVE;
-
- gtk_style_context_set_state (context, flags);
-
- cairo_save (cr);
-
- gtk_render_expander (context, cr,
- (gdouble) x - (size / 2),
- (gdouble) y - (size / 2),
- (gdouble) size,
- (gdouble) size);
-
- cairo_restore (cr);
- gtk_style_context_restore (context);
-}
-
-static void
-gtk_default_draw_layout (GtkStyle *style,
- cairo_t *cr,
- GtkStateType state_type,
- gboolean use_text,
- GtkWidget *widget,
- const gchar *detail,
- gint x,
- gint y,
- PangoLayout *layout)
-{
- GtkStyleContext *context;
- GtkStylePrivate *priv;
- GtkStateFlags flags = 0;
-
- if (widget)
- context = gtk_widget_get_style_context (widget);
- else
- {
- priv = GTK_STYLE_GET_PRIVATE (style);
- context = priv->context;
- }
-
- gtk_style_context_save (context);
-
- if (detail)
- transform_detail_string (detail, context);
-
- switch (state_type)
- {
- case GTK_STATE_PRELIGHT:
- flags |= GTK_STATE_FLAG_PRELIGHT;
- break;
- case GTK_STATE_SELECTED:
- flags |= GTK_STATE_FLAG_SELECTED;
- break;
- case GTK_STATE_INSENSITIVE:
- flags |= GTK_STATE_FLAG_INSENSITIVE;
- break;
- default:
- break;
- }
-
- gtk_style_context_set_state (context, flags);
-
- cairo_save (cr);
-
- gtk_render_layout (context, cr,
- (gdouble) x,
- (gdouble) y,
- layout);
-
- cairo_restore (cr);
- gtk_style_context_restore (context);
-}
-
-static void
-gtk_default_draw_resize_grip (GtkStyle *style,
- cairo_t *cr,
- GtkStateType state_type,
- GtkWidget *widget,
- const gchar *detail,
- GdkWindowEdge edge,
- gint x,
- gint y,
- gint width,
- gint height)
-{
- GtkStyleContext *context;
- GtkStylePrivate *priv;
- GtkStateFlags flags = 0;
- GtkJunctionSides sides = 0;
-
- if (widget)
- context = gtk_widget_get_style_context (widget);
- else
- {
- priv = GTK_STYLE_GET_PRIVATE (style);
- context = priv->context;
- }
-
- gtk_style_context_save (context);
-
- if (detail)
- transform_detail_string (detail, context);
-
- gtk_style_context_add_class (context, "grip");
-
- switch (state_type)
- {
- case GTK_STATE_PRELIGHT:
- flags |= GTK_STATE_FLAG_PRELIGHT;
- break;
- case GTK_STATE_SELECTED:
- flags |= GTK_STATE_FLAG_SELECTED;
- break;
- case GTK_STATE_INSENSITIVE:
- flags |= GTK_STATE_FLAG_INSENSITIVE;
- break;
- default:
- break;
- }
-
- gtk_style_context_set_state (context, flags);
-
- switch (edge)
- {
- case GDK_WINDOW_EDGE_NORTH_WEST:
- sides = GTK_JUNCTION_CORNER_TOPLEFT;
- break;
- case GDK_WINDOW_EDGE_NORTH:
- sides = GTK_JUNCTION_TOP;
- break;
- case GDK_WINDOW_EDGE_NORTH_EAST:
- sides = GTK_JUNCTION_CORNER_TOPRIGHT;
- break;
- case GDK_WINDOW_EDGE_WEST:
- sides = GTK_JUNCTION_LEFT;
- break;
- case GDK_WINDOW_EDGE_EAST:
- sides = GTK_JUNCTION_RIGHT;
- break;
- case GDK_WINDOW_EDGE_SOUTH_WEST:
- sides = GTK_JUNCTION_CORNER_BOTTOMLEFT;
- break;
- case GDK_WINDOW_EDGE_SOUTH:
- sides = GTK_JUNCTION_BOTTOM;
- break;
- case GDK_WINDOW_EDGE_SOUTH_EAST:
- sides = GTK_JUNCTION_CORNER_BOTTOMRIGHT;
- break;
- }
-
- gtk_style_context_set_junction_sides (context, sides);
-
- cairo_save (cr);
-
- gtk_render_handle (context, cr,
- (gdouble) x,
- (gdouble) y,
- (gdouble) width,
- (gdouble) height);
-
- cairo_restore (cr);
- gtk_style_context_restore (context);
-}
-
-static void
-gtk_default_draw_spinner (GtkStyle *style,
- cairo_t *cr,
- GtkStateType state_type,
- GtkWidget *widget,
- const gchar *detail,
- guint step,
- gint x,
- gint y,
- gint width,
- gint height)
-{
- GdkColor *color;
- guint num_steps;
- gdouble dx, dy;
- gdouble radius;
- gdouble half;
- gint i;
- guint real_step;
-
- num_steps = 12;
- real_step = step % num_steps;
-
- /* set a clip region for the expose event */
- cairo_rectangle (cr, x, y, width, height);
- cairo_clip (cr);
-
- cairo_translate (cr, x, y);
-
- /* draw clip region */
- cairo_set_operator (cr, CAIRO_OPERATOR_OVER);
-
- color = &style->fg[state_type];
- dx = width / 2;
- dy = height / 2;
- radius = MIN (width / 2, height / 2);
- half = num_steps / 2;
-
- for (i = 0; i < num_steps; i++)
- {
- gint inset = 0.7 * radius;
-
- /* transparency is a function of time and intial value */
- gdouble t = (gdouble) ((i + num_steps - real_step)
- % num_steps) / num_steps;
-
- cairo_save (cr);
-
- cairo_set_source_rgba (cr,
- color->red / 65535.,
- color->green / 65535.,
- color->blue / 65535.,
- t);
-
- cairo_set_line_width (cr, 2.0);
- cairo_move_to (cr,
- dx + (radius - inset) * cos (i * G_PI / half),
- dy + (radius - inset) * sin (i * G_PI / half));
- cairo_line_to (cr,
- dx + radius * cos (i * G_PI / half),
- dy + radius * sin (i * G_PI / half));
- cairo_stroke (cr);
-
- cairo_restore (cr);
- }
-}
-
-void
-_gtk_style_shade (const GdkColor *a,
- GdkColor *b,
- gdouble k)
-{
- gdouble red;
- gdouble green;
- gdouble blue;
-
- red = (gdouble) a->red / 65535.0;
- green = (gdouble) a->green / 65535.0;
- blue = (gdouble) a->blue / 65535.0;
-
- rgb_to_hls (&red, &green, &blue);
-
- green *= k;
- if (green > 1.0)
- green = 1.0;
- else if (green < 0.0)
- green = 0.0;
-
- blue *= k;
- if (blue > 1.0)
- blue = 1.0;
- else if (blue < 0.0)
- blue = 0.0;
-
- hls_to_rgb (&red, &green, &blue);
-
- b->red = red * 65535.0;
- b->green = green * 65535.0;
- b->blue = blue * 65535.0;
-}
-
-static void
-rgb_to_hls (gdouble *r,
- gdouble *g,
- gdouble *b)
-{
- gdouble min;
- gdouble max;
- gdouble red;
- gdouble green;
- gdouble blue;
- gdouble h, l, s;
- gdouble delta;
-
- red = *r;
- green = *g;
- blue = *b;
-
- if (red > green)
- {
- if (red > blue)
- max = red;
- else
- max = blue;
-
- if (green < blue)
- min = green;
- else
- min = blue;
- }
- else
- {
- if (green > blue)
- max = green;
- else
- max = blue;
-
- if (red < blue)
- min = red;
- else
- min = blue;
- }
-
- l = (max + min) / 2;
- s = 0;
- h = 0;
-
- if (max != min)
- {
- if (l <= 0.5)
- s = (max - min) / (max + min);
- else
- s = (max - min) / (2 - max - min);
-
- delta = max -min;
- if (red == max)
- h = (green - blue) / delta;
- else if (green == max)
- h = 2 + (blue - red) / delta;
- else if (blue == max)
- h = 4 + (red - green) / delta;
-
- h *= 60;
- if (h < 0.0)
- h += 360;
- }
-
- *r = h;
- *g = l;
- *b = s;
-}
-
-static void
-hls_to_rgb (gdouble *h,
- gdouble *l,
- gdouble *s)
-{
- gdouble hue;
- gdouble lightness;
- gdouble saturation;
- gdouble m1, m2;
- gdouble r, g, b;
-
- lightness = *l;
- saturation = *s;
-
- if (lightness <= 0.5)
- m2 = lightness * (1 + saturation);
- else
- m2 = lightness + saturation - lightness * saturation;
- m1 = 2 * lightness - m2;
-
- if (saturation == 0)
- {
- *h = lightness;
- *l = lightness;
- *s = lightness;
- }
- else
- {
- hue = *h + 120;
- while (hue > 360)
- hue -= 360;
- while (hue < 0)
- hue += 360;
-
- if (hue < 60)
- r = m1 + (m2 - m1) * hue / 60;
- else if (hue < 180)
- r = m2;
- else if (hue < 240)
- r = m1 + (m2 - m1) * (240 - hue) / 60;
- else
- r = m1;
-
- hue = *h;
- while (hue > 360)
- hue -= 360;
- while (hue < 0)
- hue += 360;
-
- if (hue < 60)
- g = m1 + (m2 - m1) * hue / 60;
- else if (hue < 180)
- g = m2;
- else if (hue < 240)
- g = m1 + (m2 - m1) * (240 - hue) / 60;
- else
- g = m1;
-
- hue = *h - 120;
- while (hue > 360)
- hue -= 360;
- while (hue < 0)
- hue += 360;
-
- if (hue < 60)
- b = m1 + (m2 - m1) * hue / 60;
- else if (hue < 180)
- b = m2;
- else if (hue < 240)
- b = m1 + (m2 - m1) * (240 - hue) / 60;
- else
- b = m1;
-
- *h = r;
- *l = g;
- *s = b;
- }
-}
-
-
-/**
- * gtk_paint_hline:
- * @style: a #GtkStyle
- * @cr: a #caio_t
- * @state_type: a state
- * @widget: (allow-none): the widget
- * @detail: (allow-none): a style detail
- * @x1: the starting x coordinate
- * @x2: the ending x coordinate
- * @y: the y coordinate
- *
- * Draws a horizontal line from (@x1, @y) to (@x2, @y) in @cr
- * using the given style and state.
- *
- * Deprecated:3.0: Use gtk_render_line() instead
- **/
-void
-gtk_paint_hline (GtkStyle *style,
- cairo_t *cr,
- GtkStateType state_type,
- GtkWidget *widget,
- const gchar *detail,
- gint x1,
- gint x2,
- gint y)
-{
- g_return_if_fail (GTK_IS_STYLE (style));
- g_return_if_fail (cr != NULL);
- g_return_if_fail (GTK_STYLE_GET_CLASS (style)->draw_hline != NULL);
-
- cairo_save (cr);
-
- GTK_STYLE_GET_CLASS (style)->draw_hline (style, cr, state_type,
- widget, detail,
- x1, x2, y);
-
- cairo_restore (cr);
-}
-
-/**
- * gtk_paint_vline:
- * @style: a #GtkStyle
- * @cr: a #cairo_t
- * @state_type: a state
- * @widget: (allow-none): the widget
- * @detail: (allow-none): a style detail
- * @y1_: the starting y coordinate
- * @y2_: the ending y coordinate
- * @x: the x coordinate
- *
- * Draws a vertical line from (@x, @y1_) to (@x, @y2_) in @cr
- * using the given style and state.
- *
- * Deprecated:3.0: Use gtk_render_line() instead
- */
-void
-gtk_paint_vline (GtkStyle *style,
- cairo_t *cr,
- GtkStateType state_type,
- GtkWidget *widget,
- const gchar *detail,
- gint y1_,
- gint y2_,
- gint x)
-{
- g_return_if_fail (GTK_IS_STYLE (style));
- g_return_if_fail (cr != NULL);
- g_return_if_fail (GTK_STYLE_GET_CLASS (style)->draw_vline != NULL);
-
- cairo_save (cr);
-
- GTK_STYLE_GET_CLASS (style)->draw_vline (style, cr, state_type,
- widget, detail,
- y1_, y2_, x);
-
- cairo_restore (cr);
-}
-
-/**
- * gtk_paint_shadow:
- * @style: a #GtkStyle
- * @cr: a #cairo_t
- * @state_type: a state
- * @shadow_type: type of shadow to draw
- * @widget: (allow-none): the widget
- * @detail: (allow-none): a style detail
- * @x: x origin of the rectangle
- * @y: y origin of the rectangle
- * @width: width of the rectangle
- * @height: width of the rectangle
- *
- * Draws a shadow around the given rectangle in @cr
- * using the given style and state and shadow type.
- *
- * Deprecated:3.0: Use gtk_render_frame() instead
- */
-void
-gtk_paint_shadow (GtkStyle *style,
- cairo_t *cr,
- GtkStateType state_type,
- GtkShadowType shadow_type,
- GtkWidget *widget,
- const gchar *detail,
- gint x,
- gint y,
- gint width,
- gint height)
-{
- g_return_if_fail (GTK_IS_STYLE (style));
- g_return_if_fail (GTK_STYLE_GET_CLASS (style)->draw_shadow != NULL);
- g_return_if_fail (cr != NULL);
- g_return_if_fail (width >= 0);
- g_return_if_fail (height >= 0);
-
- cairo_save (cr);
-
- GTK_STYLE_GET_CLASS (style)->draw_shadow (style, cr, state_type, shadow_type,
- widget, detail,
- x, y, width, height);
-
- cairo_restore (cr);
-}
-
-/**
- * gtk_paint_arrow:
- * @style: a #GtkStyle
- * @cr: a #cairo_t
- * @state_type: a state
- * @shadow_type: the type of shadow to draw
- * @widget: (allow-none): the widget
- * @detail: (allow-none): a style detail
- * @arrow_type: the type of arrow to draw
- * @fill: %TRUE if the arrow tip should be filled
- * @x: x origin of the rectangle to draw the arrow in
- * @y: y origin of the rectangle to draw the arrow in
- * @width: width of the rectangle to draw the arrow in
- * @height: height of the rectangle to draw the arrow in
- *
- * Draws an arrow in the given rectangle on @cr using the given
- * parameters. @arrow_type determines the direction of the arrow.
- *
- * Deprecated:3.0: Use gtk_render_arrow() instead
- */
-void
-gtk_paint_arrow (GtkStyle *style,
- cairo_t *cr,
- GtkStateType state_type,
- GtkShadowType shadow_type,
- GtkWidget *widget,
- const gchar *detail,
- GtkArrowType arrow_type,
- gboolean fill,
- gint x,
- gint y,
- gint width,
- gint height)
-{
- g_return_if_fail (GTK_IS_STYLE (style));
- g_return_if_fail (GTK_STYLE_GET_CLASS (style)->draw_arrow != NULL);
- g_return_if_fail (cr != NULL);
- g_return_if_fail (width >= 0);
- g_return_if_fail (height >= 0);
-
- cairo_save (cr);
-
- GTK_STYLE_GET_CLASS (style)->draw_arrow (style, cr, state_type, shadow_type,
- widget, detail,
- arrow_type, fill, x, y, width, height);
-
- cairo_restore (cr);
-}
-
-/**
- * gtk_paint_diamond:
- * @style: a #GtkStyle
- * @cr: a #cairo_t
- * @state_type: a state
- * @shadow_type: the type of shadow to draw
- * @widget: (allow-none): the widget
- * @detail: (allow-none): a style detail
- * @x: x origin of the rectangle to draw the diamond in
- * @y: y origin of the rectangle to draw the diamond in
- * @width: width of the rectangle to draw the diamond in
- * @height: height of the rectangle to draw the diamond in
- *
- * Draws a diamond in the given rectangle on @window using the given
- * parameters.
- *
- * Deprecated:3.0: Use cairo instead
- */
-void
-gtk_paint_diamond (GtkStyle *style,
- cairo_t *cr,
- GtkStateType state_type,
- GtkShadowType shadow_type,
- GtkWidget *widget,
- const gchar *detail,
- gint x,
- gint y,
- gint width,
- gint height)
-{
- g_return_if_fail (GTK_IS_STYLE (style));
- g_return_if_fail (GTK_STYLE_GET_CLASS (style)->draw_diamond != NULL);
- g_return_if_fail (cr != NULL);
- g_return_if_fail (width >= 0);
- g_return_if_fail (height >= 0);
-
- cairo_save (cr);
-
- GTK_STYLE_GET_CLASS (style)->draw_diamond (style, cr, state_type, shadow_type,
- widget, detail,
- x, y, width, height);
-
- cairo_restore (cr);
-}
-
-/**
- * gtk_paint_box:
- * @style: a #GtkStyle
- * @cr: a #cairo_t
- * @state_type: a state
- * @shadow_type: the type of shadow to draw
- * @widget: (allow-none): the widget
- * @detail: (allow-none): a style detail
- * @x: x origin of the box
- * @y: y origin of the box
- * @width: the width of the box
- * @height: the height of the box
- *
- * Draws a box on @cr with the given parameters.
- *
- * Deprecated:3.0: Use gtk_render_frame() and gtk_render_background() instead
- */
-void
-gtk_paint_box (GtkStyle *style,
- cairo_t *cr,
- GtkStateType state_type,
- GtkShadowType shadow_type,
- GtkWidget *widget,
- const gchar *detail,
- gint x,
- gint y,
- gint width,
- gint height)
-{
- g_return_if_fail (GTK_IS_STYLE (style));
- g_return_if_fail (GTK_STYLE_GET_CLASS (style)->draw_box != NULL);
- g_return_if_fail (cr != NULL);
-
- cairo_save (cr);
-
- GTK_STYLE_GET_CLASS (style)->draw_box (style, cr, state_type, shadow_type,
- widget, detail,
- x, y, width, height);
-
- cairo_restore (cr);
-}
-
-/**
- * gtk_paint_flat_box:
- * @style: a #GtkStyle
- * @cr: a #cairo_t
- * @state_type: a state
- * @shadow_type: the type of shadow to draw
- * @widget: (allow-none): the widget
- * @detail: (allow-none): a style detail
- * @x: x origin of the box
- * @y: y origin of the box
- * @width: the width of the box
- * @height: the height of the box
- *
- * Draws a flat box on @cr with the given parameters.
- *
- * Deprecated:3.0: Use gtk_render_frame() and gtk_render_background() instead
- */
-void
-gtk_paint_flat_box (GtkStyle *style,
- cairo_t *cr,
- GtkStateType state_type,
- GtkShadowType shadow_type,
- GtkWidget *widget,
- const gchar *detail,
- gint x,
- gint y,
- gint width,
- gint height)
-{
- g_return_if_fail (GTK_IS_STYLE (style));
- g_return_if_fail (GTK_STYLE_GET_CLASS (style)->draw_flat_box != NULL);
- g_return_if_fail (cr != NULL);
- g_return_if_fail (width >= 0);
- g_return_if_fail (height >= 0);
-
- cairo_save (cr);
-
- GTK_STYLE_GET_CLASS (style)->draw_flat_box (style, cr, state_type, shadow_type,
- widget, detail,
- x, y, width, height);
-
- cairo_restore (cr);
-}
-
-/**
- * gtk_paint_check:
- * @style: a #GtkStyle
- * @cr: a #cairo_t
- * @state_type: a state
- * @shadow_type: the type of shadow to draw
- * @widget: (allow-none): the widget
- * @detail: (allow-none): a style detail
- * @x: x origin of the rectangle to draw the check in
- * @y: y origin of the rectangle to draw the check in
- * @width: the width of the rectangle to draw the check in
- * @height: the height of the rectangle to draw the check in
- *
- * Draws a check button indicator in the given rectangle on @cr with
- * the given parameters.
- *
- * Deprecated:3.0: Use gtk_render_check() instead
- */
-void
-gtk_paint_check (GtkStyle *style,
- cairo_t *cr,
- GtkStateType state_type,
- GtkShadowType shadow_type,
- GtkWidget *widget,
- const gchar *detail,
- gint x,
- gint y,
- gint width,
- gint height)
-{
- g_return_if_fail (GTK_IS_STYLE (style));
- g_return_if_fail (GTK_STYLE_GET_CLASS (style)->draw_check != NULL);
- g_return_if_fail (cr != NULL);
-
- cairo_save (cr);
-
- GTK_STYLE_GET_CLASS (style)->draw_check (style, cr, state_type, shadow_type,
- widget, detail,
- x, y, width, height);
-
- cairo_restore (cr);
-}
-
-/**
- * gtk_paint_option:
- * @style: a #GtkStyle
- * @cr: a #cairo_t
- * @state_type: a state
- * @shadow_type: the type of shadow to draw
- * @widget: (allow-none): the widget
- * @detail: (allow-none): a style detail
- * @x: x origin of the rectangle to draw the option in
- * @y: y origin of the rectangle to draw the option in
- * @width: the width of the rectangle to draw the option in
- * @height: the height of the rectangle to draw the option in
- *
- * Draws a radio button indicator in the given rectangle on @cr with
- * the given parameters.
- *
- * Deprecated:3.0: Use gtk_render_option() instead
- */
-void
-gtk_paint_option (GtkStyle *style,
- cairo_t *cr,
- GtkStateType state_type,
- GtkShadowType shadow_type,
- GtkWidget *widget,
- const gchar *detail,
- gint x,
- gint y,
- gint width,
- gint height)
-{
- g_return_if_fail (GTK_IS_STYLE (style));
- g_return_if_fail (GTK_STYLE_GET_CLASS (style)->draw_option != NULL);
- g_return_if_fail (cr != NULL);
-
- cairo_save (cr);
-
- GTK_STYLE_GET_CLASS (style)->draw_option (style, cr, state_type, shadow_type,
- widget, detail,
- x, y, width, height);
-
- cairo_restore (cr);
-}
-
-/**
- * gtk_paint_tab:
- * @style: a #GtkStyle
- * @cr: a #cairo_t
- * @state_type: a state
- * @shadow_type: the type of shadow to draw
- * @widget: (allow-none): the widget
- * @detail: (allow-none): a style detail
- * @x: x origin of the rectangle to draw the tab in
- * @y: y origin of the rectangle to draw the tab in
- * @width: the width of the rectangle to draw the tab in
- * @height: the height of the rectangle to draw the tab in
- *
- * Draws an option menu tab (i.e. the up and down pointing arrows)
- * in the given rectangle on @cr using the given parameters.
- *
- * Deprecated:3.0: Use cairo instead
- */
-void
-gtk_paint_tab (GtkStyle *style,
- cairo_t *cr,
- GtkStateType state_type,
- GtkShadowType shadow_type,
- GtkWidget *widget,
- const gchar *detail,
- gint x,
- gint y,
- gint width,
- gint height)
-{
- g_return_if_fail (GTK_IS_STYLE (style));
- g_return_if_fail (GTK_STYLE_GET_CLASS (style)->draw_tab != NULL);
- g_return_if_fail (cr != NULL);
-
- cairo_save (cr);
-
- GTK_STYLE_GET_CLASS (style)->draw_tab (style, cr, state_type, shadow_type,
- widget, detail,
- x, y, width, height);
-
- cairo_restore (cr);
-}
-
-/**
- * gtk_paint_shadow_gap:
- * @style: a #GtkStyle
- * @cr: a #cairo_t
- * @state_type: a state
- * @shadow_type: type of shadow to draw
- * @widget: (allow-none): the widget
- * @detail: (allow-none): a style detail
- * @x: x origin of the rectangle
- * @y: y origin of the rectangle
- * @width: width of the rectangle
- * @height: width of the rectangle
- * @gap_side: side in which to leave the gap
- * @gap_x: starting position of the gap
- * @gap_width: width of the gap
- *
- * Draws a shadow around the given rectangle in @cr
- * using the given style and state and shadow type, leaving a
- * gap in one side.
- *
- * Deprecated:3.0: Use gtk_render_frame_gap() instead
- */
-void
-gtk_paint_shadow_gap (GtkStyle *style,
- cairo_t *cr,
- GtkStateType state_type,
- GtkShadowType shadow_type,
- GtkWidget *widget,
- const gchar *detail,
- gint x,
- gint y,
- gint width,
- gint height,
- GtkPositionType gap_side,
- gint gap_x,
- gint gap_width)
-{
- g_return_if_fail (GTK_IS_STYLE (style));
- g_return_if_fail (GTK_STYLE_GET_CLASS (style)->draw_shadow_gap != NULL);
- g_return_if_fail (cr != NULL);
- g_return_if_fail (width >= 0);
- g_return_if_fail (height >= 0);
-
- cairo_save (cr);
-
- GTK_STYLE_GET_CLASS (style)->draw_shadow_gap (style, cr, state_type, shadow_type,
- widget, detail,
- x, y, width, height, gap_side, gap_x, gap_width);
-
- cairo_restore (cr);
-}
-
-/**
- * gtk_paint_box_gap:
- * @style: a #GtkStyle
- * @cr: a #cairo_t
- * @state_type: a state
- * @shadow_type: type of shadow to draw
- * @widget: (allow-none): the widget
- * @detail: (allow-none): a style detail
- * @x: x origin of the rectangle
- * @y: y origin of the rectangle
- * @width: width of the rectangle
- * @height: width of the rectangle
- * @gap_side: side in which to leave the gap
- * @gap_x: starting position of the gap
- * @gap_width: width of the gap
- *
- * Draws a box in @cr using the given style and state and shadow type,
- * leaving a gap in one side.
- *
- * Deprecated:3.0: Use gtk_render_frame_gap() instead
- */
-void
-gtk_paint_box_gap (GtkStyle *style,
- cairo_t *cr,
- GtkStateType state_type,
- GtkShadowType shadow_type,
- GtkWidget *widget,
- const gchar *detail,
- gint x,
- gint y,
- gint width,
- gint height,
- GtkPositionType gap_side,
- gint gap_x,
- gint gap_width)
-{
- g_return_if_fail (GTK_IS_STYLE (style));
- g_return_if_fail (GTK_STYLE_GET_CLASS (style)->draw_box_gap != NULL);
- g_return_if_fail (cr != NULL);
- g_return_if_fail (width >= 0);
- g_return_if_fail (height >= 0);
-
- cairo_save (cr);
-
- GTK_STYLE_GET_CLASS (style)->draw_box_gap (style, cr, state_type, shadow_type,
- widget, detail,
- x, y, width, height, gap_side, gap_x, gap_width);
-
- cairo_restore (cr);
-}
-
-/**
- * gtk_paint_extension:
- * @style: a #GtkStyle
- * @cr: a #cairo_t
- * @state_type: a state
- * @shadow_type: type of shadow to draw
- * @widget: (allow-none): the widget
- * @detail: (allow-none): a style detail
- * @x: x origin of the extension
- * @y: y origin of the extension
- * @width: width of the extension
- * @height: width of the extension
- * @gap_side: the side on to which the extension is attached
- *
- * Draws an extension, i.e. a notebook tab.
- *
- * Deprecated:3.0: Use gtk_render_extension() instead
- **/
-void
-gtk_paint_extension (GtkStyle *style,
- cairo_t *cr,
- GtkStateType state_type,
- GtkShadowType shadow_type,
- GtkWidget *widget,
- const gchar *detail,
- gint x,
- gint y,
- gint width,
- gint height,
- GtkPositionType gap_side)
-{
- g_return_if_fail (GTK_IS_STYLE (style));
- g_return_if_fail (GTK_STYLE_GET_CLASS (style)->draw_extension != NULL);
- g_return_if_fail (cr != NULL);
- g_return_if_fail (width >= 0);
- g_return_if_fail (height >= 0);
-
- cairo_save (cr);
-
- GTK_STYLE_GET_CLASS (style)->draw_extension (style, cr, state_type, shadow_type,
- widget, detail,
- x, y, width, height, gap_side);
-
- cairo_restore (cr);
-}
-
-/**
- * gtk_paint_focus:
- * @style: a #GtkStyle
- * @cr: a #cairo_t
- * @state_type: a state
- * @widget: (allow-none): the widget
- * @detail: (allow-none): a style detail
- * @x: the x origin of the rectangle around which to draw a focus indicator
- * @y: the y origin of the rectangle around which to draw a focus indicator
- * @width: the width of the rectangle around which to draw a focus indicator
- * @height: the height of the rectangle around which to draw a focus indicator
- *
- * Draws a focus indicator around the given rectangle on @cr using the
- * given style.
- *
- * Deprecated:3.0: Use gtk_render_focus() instead
- */
-void
-gtk_paint_focus (GtkStyle *style,
- cairo_t *cr,
- GtkStateType state_type,
- GtkWidget *widget,
- const gchar *detail,
- gint x,
- gint y,
- gint width,
- gint height)
-{
- g_return_if_fail (GTK_IS_STYLE (style));
- g_return_if_fail (GTK_STYLE_GET_CLASS (style)->draw_focus != NULL);
- g_return_if_fail (cr != NULL);
- g_return_if_fail (width >= 0);
- g_return_if_fail (height >= 0);
-
- cairo_save (cr);
-
- GTK_STYLE_GET_CLASS (style)->draw_focus (style, cr, state_type,
- widget, detail,
- x, y, width, height);
-
- cairo_restore (cr);
-}
-
-/**
- * gtk_paint_slider:
- * @style: a #GtkStyle
- * @cr: a #cairo_t
- * @state_type: a state
- * @shadow_type: a shadow
- * @widget: (allow-none): the widget
- * @detail: (allow-none): a style detail
- * @x: the x origin of the rectangle in which to draw a slider
- * @y: the y origin of the rectangle in which to draw a slider
- * @width: the width of the rectangle in which to draw a slider
- * @height: the height of the rectangle in which to draw a slider
- * @orientation: the orientation to be used
- *
- * Draws a slider in the given rectangle on @cr using the
- * given style and orientation.
- *
- * Deprecated:3.0: Use gtk_render_slider() instead
- **/
-void
-gtk_paint_slider (GtkStyle *style,
- cairo_t *cr,
- GtkStateType state_type,
- GtkShadowType shadow_type,
- GtkWidget *widget,
- const gchar *detail,
- gint x,
- gint y,
- gint width,
- gint height,
- GtkOrientation orientation)
-{
- g_return_if_fail (GTK_IS_STYLE (style));
- g_return_if_fail (GTK_STYLE_GET_CLASS (style)->draw_slider != NULL);
- g_return_if_fail (cr != NULL);
- g_return_if_fail (width >= 0);
- g_return_if_fail (height >= 0);
-
- cairo_save (cr);
-
- GTK_STYLE_GET_CLASS (style)->draw_slider (style, cr, state_type, shadow_type,
- widget, detail,
- x, y, width, height, orientation);
-
- cairo_restore (cr);
-}
-
-/**
- * gtk_paint_handle:
- * @style: a #GtkStyle
- * @cr: a #cairo_t
- * @state_type: a state
- * @shadow_type: type of shadow to draw
- * @widget: (allow-none): the widget
- * @detail: (allow-none): a style detail
- * @x: x origin of the handle
- * @y: y origin of the handle
- * @width: with of the handle
- * @height: height of the handle
- * @orientation: the orientation of the handle
- *
- * Draws a handle as used in #GtkHandleBox and #GtkPaned.
- *
- * Deprecated:3.0: Use gtk_render_handle() instead
- **/
-void
-gtk_paint_handle (GtkStyle *style,
- cairo_t *cr,
- GtkStateType state_type,
- GtkShadowType shadow_type,
- GtkWidget *widget,
- const gchar *detail,
- gint x,
- gint y,
- gint width,
- gint height,
- GtkOrientation orientation)
-{
- g_return_if_fail (GTK_IS_STYLE (style));
- g_return_if_fail (GTK_STYLE_GET_CLASS (style)->draw_handle != NULL);
- g_return_if_fail (cr != NULL);
- g_return_if_fail (width >= 0);
- g_return_if_fail (height >= 0);
-
- cairo_save (cr);
-
- GTK_STYLE_GET_CLASS (style)->draw_handle (style, cr, state_type, shadow_type,
- widget, detail,
- x, y, width, height, orientation);
-
- cairo_restore (cr);
-}
-
-/**
- * gtk_paint_expander:
- * @style: a #GtkStyle
- * @cr: a #cairo_t
- * @state_type: a state
- * @widget: (allow-none): the widget
- * @detail: (allow-none): a style detail
- * @x: the x position to draw the expander at
- * @y: the y position to draw the expander at
- * @expander_style: the style to draw the expander in; determines
- * whether the expander is collapsed, expanded, or in an
- * intermediate state.
- *
- * Draws an expander as used in #GtkTreeView. @x and @y specify the
- * center the expander. The size of the expander is determined by the
- * “expander-size” style property of @widget. (If widget is not
- * specified or doesn’t have an “expander-size” property, an
- * unspecified default size will be used, since the caller doesn't
- * have sufficient information to position the expander, this is
- * likely not useful.) The expander is expander_size pixels tall
- * in the collapsed position and expander_size pixels wide in the
- * expanded position.
- *
- * Deprecated:3.0: Use gtk_render_expander() instead
- **/
-void
-gtk_paint_expander (GtkStyle *style,
- cairo_t *cr,
- GtkStateType state_type,
- GtkWidget *widget,
- const gchar *detail,
- gint x,
- gint y,
- GtkExpanderStyle expander_style)
-{
- g_return_if_fail (GTK_IS_STYLE (style));
- g_return_if_fail (GTK_STYLE_GET_CLASS (style)->draw_expander != NULL);
- g_return_if_fail (cr != NULL);
-
- cairo_save (cr);
-
- GTK_STYLE_GET_CLASS (style)->draw_expander (style, cr, state_type,
- widget, detail,
- x, y, expander_style);
-
- cairo_restore (cr);
-}
-
-/**
- * gtk_paint_layout:
- * @style: a #GtkStyle
- * @cr: a #cairo_t
- * @state_type: a state
- * @use_text: whether to use the text or foreground
- * graphics context of @style
- * @widget: (allow-none): the widget
- * @detail: (allow-none): a style detail
- * @x: x origin
- * @y: y origin
- * @layout: the layout to draw
- *
- * Draws a layout on @cr using the given parameters.
- *
- * Deprecated:3.0: Use gtk_render_layout() instead
- **/
-void
-gtk_paint_layout (GtkStyle *style,
- cairo_t *cr,
- GtkStateType state_type,
- gboolean use_text,
- GtkWidget *widget,
- const gchar *detail,
- gint x,
- gint y,
- PangoLayout *layout)
-{
- g_return_if_fail (GTK_IS_STYLE (style));
- g_return_if_fail (GTK_STYLE_GET_CLASS (style)->draw_layout != NULL);
- g_return_if_fail (cr != NULL);
-
- cairo_save (cr);
-
- GTK_STYLE_GET_CLASS (style)->draw_layout (style, cr, state_type, use_text,
- widget, detail,
- x, y, layout);
-
- cairo_restore (cr);
-}
-
-/**
- * gtk_paint_resize_grip:
- * @style: a #GtkStyle
- * @cr: a #cairo_t
- * @state_type: a state
- * @widget: (allow-none): the widget
- * @detail: (allow-none): a style detail
- * @edge: the edge in which to draw the resize grip
- * @x: the x origin of the rectangle in which to draw the resize grip
- * @y: the y origin of the rectangle in which to draw the resize grip
- * @width: the width of the rectangle in which to draw the resize grip
- * @height: the height of the rectangle in which to draw the resize grip
- *
- * Draws a resize grip in the given rectangle on @cr using the given
- * parameters.
- *
- * Deprecated:3.0: Use gtk_render_handle() instead
- */
-void
-gtk_paint_resize_grip (GtkStyle *style,
- cairo_t *cr,
- GtkStateType state_type,
- GtkWidget *widget,
- const gchar *detail,
- GdkWindowEdge edge,
- gint x,
- gint y,
- gint width,
- gint height)
-{
- g_return_if_fail (GTK_IS_STYLE (style));
- g_return_if_fail (GTK_STYLE_GET_CLASS (style)->draw_resize_grip != NULL);
- g_return_if_fail (cr != NULL);
-
- cairo_save (cr);
-
- GTK_STYLE_GET_CLASS (style)->draw_resize_grip (style, cr, state_type,
- widget, detail,
- edge, x, y, width, height);
- cairo_restore (cr);
-}
-
-/**
- * gtk_paint_spinner:
- * @style: a #GtkStyle
- * @cr: a #cairo_t
- * @state_type: a state
- * @widget: (allow-none): the widget (may be %NULL)
- * @detail: (allow-none): a style detail (may be %NULL)
- * @step: the nth step
- * @x: the x origin of the rectangle in which to draw the spinner
- * @y: the y origin of the rectangle in which to draw the spinner
- * @width: the width of the rectangle in which to draw the spinner
- * @height: the height of the rectangle in which to draw the spinner
- *
- * Draws a spinner on @window using the given parameters.
- *
- * Deprecated:3.0: Use gtk_render_activity() instead
- */
-void
-gtk_paint_spinner (GtkStyle *style,
- cairo_t *cr,
- GtkStateType state_type,
- GtkWidget *widget,
- const gchar *detail,
- guint step,
- gint x,
- gint y,
- gint width,
- gint height)
-{
- g_return_if_fail (GTK_IS_STYLE (style));
- g_return_if_fail (cr != NULL);
- g_return_if_fail (GTK_STYLE_GET_CLASS (style)->draw_spinner != NULL);
-
- cairo_save (cr);
-
- GTK_STYLE_GET_CLASS (style)->draw_spinner (style, cr, state_type,
- widget, detail,
- step, x, y, width, height);
-
- cairo_restore (cr);
-}
-
-static GtkStyle *
-gtk_widget_get_default_style_for_screen (GdkScreen *screen)
-{
- GtkStyle *default_style;
-
- if G_UNLIKELY (quark_default_style == 0)
- quark_default_style = g_quark_from_static_string ("gtk-legacy-default-style");
-
- default_style = g_object_get_qdata (G_OBJECT (screen), quark_default_style);
- if (default_style == NULL)
- {
- default_style = gtk_style_new ();
- g_object_set_qdata_full (G_OBJECT (screen),
- quark_default_style,
- default_style,
- g_object_unref);
- }
-
- return default_style;
-}
-
-/**
- * gtk_widget_get_default_style:
- *
- * Returns the default style used by all widgets initially.
- *
- * Returns: (transfer none): the default style. This #GtkStyle
- * object is owned by GTK+ and should not be modified or freed.
- *
- * Deprecated:3.0: Use #GtkStyleContext instead, and
- * gtk_css_provider_get_default() to obtain a #GtkStyleProvider
- * with the default widget style information.
- */
-GtkStyle *
-gtk_widget_get_default_style (void)
-{
- static GtkStyle *default_style = NULL;
- GtkStyle *style = NULL;
- GdkScreen *screen = gdk_screen_get_default ();
-
- if (screen)
- style = gtk_widget_get_default_style_for_screen (screen);
- else
- {
- if (default_style == NULL)
- default_style = gtk_style_new ();
- style = default_style;
- }
-
- return style;
-}
-
-/**
- * gtk_widget_style_attach:
- * @widget: a #GtkWidget
- *
- * This function attaches the widget’s #GtkStyle to the widget's
- * #GdkWindow. It is a replacement for
- *
- * |[
- * widget->style = gtk_style_attach (widget->style, widget->window);
- * ]|
- *
- * and should only ever be called in a derived widget’s “realize”
- * implementation which does not chain up to its parent class'
- * “realize” implementation, because one of the parent classes
- * (finally #GtkWidget) would attach the style itself.
- *
- * Since: 2.20
- *
- * Deprecated: 3.0: This step is unnecessary with #GtkStyleContext.
- **/
-void
-gtk_widget_style_attach (GtkWidget *widget)
-{
- g_return_if_fail (GTK_IS_WIDGET (widget));
- g_return_if_fail (gtk_widget_get_realized (widget));
-}
-
-/**
- * gtk_widget_has_rc_style:
- * @widget: a #GtkWidget
- *
- * Determines if the widget style has been looked up through the rc mechanism.
- *
- * Returns: %TRUE if the widget has been looked up through the rc
- * mechanism, %FALSE otherwise.
- *
- * Since: 2.20
- *
- * Deprecated:3.0: Use #GtkStyleContext instead
- **/
-gboolean
-gtk_widget_has_rc_style (GtkWidget *widget)
-{
- g_return_val_if_fail (GTK_IS_WIDGET (widget), FALSE);
-
- return FALSE;
-}
-
-/**
- * gtk_widget_set_style:
- * @widget: a #GtkWidget
- * @style: (allow-none): a #GtkStyle, or %NULL to remove the effect
- * of a previous call to gtk_widget_set_style() and go back to
- * the default style
- *
- * Used to set the #GtkStyle for a widget (@widget->style). Since
- * GTK 3, this function does nothing, the passed in style is ignored.
- *
- * Deprecated:3.0: Use #GtkStyleContext instead
- */
-void
-gtk_widget_set_style (GtkWidget *widget,
- GtkStyle *style)
-{
- g_return_if_fail (GTK_IS_WIDGET (widget));
-}
-
-/**
- * gtk_widget_ensure_style:
- * @widget: a #GtkWidget
- *
- * Ensures that @widget has a style (@widget->style).
- *
- * Not a very useful function; most of the time, if you
- * want the style, the widget is realized, and realized
- * widgets are guaranteed to have a style already.
- *
- * Deprecated:3.0: Use #GtkStyleContext instead
- */
-void
-gtk_widget_ensure_style (GtkWidget *widget)
-{
- GtkStyle *style;
- g_return_if_fail (GTK_IS_WIDGET (widget));
-
- style = _gtk_widget_get_style (widget);
- if (style == gtk_widget_get_default_style ())
- {
- g_object_unref (style);
- _gtk_widget_set_style (widget, NULL);
- }
-}
-
-/**
- * gtk_widget_get_style:
- * @widget: a #GtkWidget
- *
- * Simply an accessor function that returns @widget->style.
- *
- * Returns: (transfer none): the widget’s #GtkStyle
- *
- * Deprecated:3.0: Use #GtkStyleContext instead
- */
-GtkStyle*
-gtk_widget_get_style (GtkWidget *widget)
-{
- GtkStyle *style;
- g_return_val_if_fail (GTK_IS_WIDGET (widget), NULL);
-
- style = _gtk_widget_get_style (widget);
-
- if (style == NULL)
- {
- style = g_object_new (GTK_TYPE_STYLE,
- "context", gtk_widget_get_style_context (widget),
- NULL);
- _gtk_widget_set_style (widget, style);
- }
-
- return style;
-}
-
-/**
- * gtk_widget_modify_style:
- * @widget: a #GtkWidget
- * @style: the #GtkRcStyle-struct holding the style modifications
- *
- * Modifies style values on the widget.
- *
- * Modifications made using this technique take precedence over
- * style values set via an RC file, however, they will be overridden
- * if a style is explicitly set on the widget using gtk_widget_set_style().
- * The #GtkRcStyle-struct is designed so each field can either be
- * set or unset, so it is possible, using this function, to modify some
- * style values and leave the others unchanged.
- *
- * Note that modifications made with this function are not cumulative
- * with previous calls to gtk_widget_modify_style() or with such
- * functions as gtk_widget_modify_fg(). If you wish to retain
- * previous values, you must first call gtk_widget_get_modifier_style(),
- * make your modifications to the returned style, then call
- * gtk_widget_modify_style() with that style. On the other hand,
- * if you first call gtk_widget_modify_style(), subsequent calls
- * to such functions gtk_widget_modify_fg() will have a cumulative
- * effect with the initial modifications.
- *
- * Deprecated:3.0: Use #GtkStyleContext with a custom #GtkStyleProvider instead
- */
-void
-gtk_widget_modify_style (GtkWidget *widget,
- GtkRcStyle *style)
-{
- g_return_if_fail (GTK_IS_WIDGET (widget));
- g_return_if_fail (GTK_IS_RC_STYLE (style));
-
- g_object_set_data_full (G_OBJECT (widget),
- "gtk-rc-style",
- gtk_rc_style_copy (style),
- (GDestroyNotify) g_object_unref);
-}
-
-/**
- * gtk_widget_get_modifier_style:
- * @widget: a #GtkWidget
- *
- * Returns the current modifier style for the widget. (As set by
- * gtk_widget_modify_style().) If no style has previously set, a new
- * #GtkRcStyle will be created with all values unset, and set as the
- * modifier style for the widget. If you make changes to this rc
- * style, you must call gtk_widget_modify_style(), passing in the
- * returned rc style, to make sure that your changes take effect.
- *
- * Caution: passing the style back to gtk_widget_modify_style() will
- * normally end up destroying it, because gtk_widget_modify_style() copies
- * the passed-in style and sets the copy as the new modifier style,
- * thus dropping any reference to the old modifier style. Add a reference
- * to the modifier style if you want to keep it alive.
- *
- * Returns: (transfer none): the modifier style for the widget.
- * This rc style is owned by the widget. If you want to keep a
- * pointer to value this around, you must add a refcount using
- * g_object_ref().
- *
- * Deprecated:3.0: Use #GtkStyleContext with a custom #GtkStyleProvider instead
- */
-GtkRcStyle *
-gtk_widget_get_modifier_style (GtkWidget *widget)
-{
- GtkRcStyle *rc_style;
-
- g_return_val_if_fail (GTK_IS_WIDGET (widget), NULL);
-
- rc_style = g_object_get_data (G_OBJECT (widget), "gtk-rc-style");
-
- if (!rc_style)
- {
- rc_style = gtk_rc_style_new ();
- g_object_set_data_full (G_OBJECT (widget),
- "gtk-rc-style",
- rc_style,
- (GDestroyNotify) g_object_unref);
- }
-
- return rc_style;
-}
-
-static void
-gtk_widget_modify_color_component (GtkWidget *widget,
- GtkRcFlags component,
- GtkStateType state,
- const GdkColor *color)
-{
- GtkRcStyle *rc_style = gtk_widget_get_modifier_style (widget);
-
- if (color)
- {
- switch (component)
- {
- case GTK_RC_FG:
- rc_style->fg[state] = *color;
- break;
- case GTK_RC_BG:
- rc_style->bg[state] = *color;
- break;
- case GTK_RC_TEXT:
- rc_style->text[state] = *color;
- break;
- case GTK_RC_BASE:
- rc_style->base[state] = *color;
- break;
- default:
- g_assert_not_reached();
- }
-
- rc_style->color_flags[state] |= component;
- }
- else
- rc_style->color_flags[state] &= ~component;
-
- gtk_widget_modify_style (widget, rc_style);
-}
-
-/**
- * gtk_widget_modify_fg:
- * @widget: a #GtkWidget
- * @state: the state for which to set the foreground color
- * @color: (allow-none): the color to assign (does not need to be allocated),
- * or %NULL to undo the effect of previous calls to
- * of gtk_widget_modify_fg().
- *
- * Sets the foreground color for a widget in a particular state.
- *
- * All other style values are left untouched.
- * See also gtk_widget_modify_style().
- *
- * Deprecated:3.0: Use gtk_widget_override_color() instead
- */
-void
-gtk_widget_modify_fg (GtkWidget *widget,
- GtkStateType state,
- const GdkColor *color)
-{
- GtkStateFlags flags;
- GdkRGBA rgba;
-
- g_return_if_fail (GTK_IS_WIDGET (widget));
- g_return_if_fail (state >= GTK_STATE_NORMAL && state <= GTK_STATE_INSENSITIVE);
-
- switch (state)
- {
- case GTK_STATE_ACTIVE:
- flags = GTK_STATE_FLAG_ACTIVE;
- break;
- case GTK_STATE_PRELIGHT:
- flags = GTK_STATE_FLAG_PRELIGHT;
- break;
- case GTK_STATE_SELECTED:
- flags = GTK_STATE_FLAG_SELECTED;
- break;
- case GTK_STATE_INSENSITIVE:
- flags = GTK_STATE_FLAG_INSENSITIVE;
- break;
- case GTK_STATE_NORMAL:
- default:
- flags = 0;
- }
-
- if (color)
- {
- rgba.red = color->red / 65535.;
- rgba.green = color->green / 65535.;
- rgba.blue = color->blue / 65535.;
- rgba.alpha = 1;
-
- gtk_widget_override_color (widget, flags, &rgba);
- }
- else
- gtk_widget_override_color (widget, flags, NULL);
-}
-
-/**
- * gtk_widget_modify_bg:
- * @widget: a #GtkWidget
- * @state: the state for which to set the background color
- * @color: (allow-none): the color to assign (does not need
- * to be allocated), or %NULL to undo the effect of previous
- * calls to of gtk_widget_modify_bg().
- *
- * Sets the background color for a widget in a particular state.
- *
- * All other style values are left untouched.
- * See also gtk_widget_modify_style().
- *
- * > Note that “no window” widgets (which have the %GTK_NO_WINDOW
- * > flag set) draw on their parent container’s window and thus may
- * > not draw any background themselves. This is the case for e.g.
- * > #GtkLabel.
- * >
- * > To modify the background of such widgets, you have to set the
- * > background color on their parent; if you want to set the background
- * > of a rectangular area around a label, try placing the label in
- * > a #GtkEventBox widget and setting the background color on that.
- *
- * Deprecated:3.0: Use gtk_widget_override_background_color() instead
- */
-void
-gtk_widget_modify_bg (GtkWidget *widget,
- GtkStateType state,
- const GdkColor *color)
-{
- GtkStateFlags flags;
- GdkRGBA rgba;
-
- g_return_if_fail (GTK_IS_WIDGET (widget));
- g_return_if_fail (state >= GTK_STATE_NORMAL && state <= GTK_STATE_INSENSITIVE);
-
- switch (state)
- {
- case GTK_STATE_ACTIVE:
- flags = GTK_STATE_FLAG_ACTIVE;
- break;
- case GTK_STATE_PRELIGHT:
- flags = GTK_STATE_FLAG_PRELIGHT;
- break;
- case GTK_STATE_SELECTED:
- flags = GTK_STATE_FLAG_SELECTED;
- break;
- case GTK_STATE_INSENSITIVE:
- flags = GTK_STATE_FLAG_INSENSITIVE;
- break;
- case GTK_STATE_NORMAL:
- default:
- flags = 0;
- }
-
- if (color)
- {
- rgba.red = color->red / 65535.;
- rgba.green = color->green / 65535.;
- rgba.blue = color->blue / 65535.;
- rgba.alpha = 1;
-
- gtk_widget_override_background_color (widget, flags, &rgba);
- }
- else
- gtk_widget_override_background_color (widget, flags, NULL);
-}
-
-/**
- * gtk_widget_modify_text:
- * @widget: a #GtkWidget
- * @state: the state for which to set the text color
- * @color: (allow-none): the color to assign (does not need to
- * be allocated), or %NULL to undo the effect of previous
- * calls to of gtk_widget_modify_text().
- *
- * Sets the text color for a widget in a particular state.
- *
- * All other style values are left untouched.
- * The text color is the foreground color used along with the
- * base color (see gtk_widget_modify_base()) for widgets such
- * as #GtkEntry and #GtkTextView.
- * See also gtk_widget_modify_style().
- *
- * Deprecated:3.0: Use gtk_widget_override_color() instead
- */
-void
-gtk_widget_modify_text (GtkWidget *widget,
- GtkStateType state,
- const GdkColor *color)
-{
- g_return_if_fail (GTK_IS_WIDGET (widget));
- g_return_if_fail (state >= GTK_STATE_NORMAL && state <= GTK_STATE_INSENSITIVE);
-
- gtk_widget_modify_color_component (widget, GTK_RC_TEXT, state, color);
-}
-
-/**
- * gtk_widget_modify_base:
- * @widget: a #GtkWidget
- * @state: the state for which to set the base color
- * @color: (allow-none): the color to assign (does not need to
- * be allocated), or %NULL to undo the effect of previous
- * calls to of gtk_widget_modify_base().
- *
- * Sets the base color for a widget in a particular state.
- * All other style values are left untouched. The base color
- * is the background color used along with the text color
- * (see gtk_widget_modify_text()) for widgets such as #GtkEntry
- * and #GtkTextView. See also gtk_widget_modify_style().
- *
- * > Note that “no window” widgets (which have the %GTK_NO_WINDOW
- * > flag set) draw on their parent container’s window and thus may
- * > not draw any background themselves. This is the case for e.g.
- * > #GtkLabel.
- * >
- * > To modify the background of such widgets, you have to set the
- * > base color on their parent; if you want to set the background
- * > of a rectangular area around a label, try placing the label in
- * > a #GtkEventBox widget and setting the base color on that.
- *
- * Deprecated:3.0: Use gtk_widget_override_background_color() instead
- */
-void
-gtk_widget_modify_base (GtkWidget *widget,
- GtkStateType state,
- const GdkColor *color)
-{
- g_return_if_fail (GTK_IS_WIDGET (widget));
- g_return_if_fail (state >= GTK_STATE_NORMAL && state <= GTK_STATE_INSENSITIVE);
-
- gtk_widget_modify_color_component (widget, GTK_RC_BASE, state, color);
-}
-
-/**
- * gtk_widget_modify_cursor:
- * @widget: a #GtkWidget
- * @primary: (nullable): the color to use for primary cursor (does not
- * need to be allocated), or %NULL to undo the effect of previous
- * calls to of gtk_widget_modify_cursor().
- * @secondary: (nullable): the color to use for secondary cursor (does
- * not need to be allocated), or %NULL to undo the effect of
- * previous calls to of gtk_widget_modify_cursor().
- *
- * Sets the cursor color to use in a widget, overriding the #GtkWidget
- * cursor-color and secondary-cursor-color
- * style properties.
- *
- * All other style values are left untouched.
- * See also gtk_widget_modify_style().
- *
- * Since: 2.12
- *
- * Deprecated: 3.0: Use gtk_widget_override_cursor() instead.
- */
-void
-gtk_widget_modify_cursor (GtkWidget *widget,
- const GdkColor *primary,
- const GdkColor *secondary)
-{
- GdkRGBA primary_rgba, secondary_rgba;
-
- g_return_if_fail (GTK_IS_WIDGET (widget));
-
- primary_rgba.red = primary->red / 65535.;
- primary_rgba.green = primary->green / 65535.;
- primary_rgba.blue = primary->blue / 65535.;
- primary_rgba.alpha = 1;
-
- secondary_rgba.red = secondary->red / 65535.;
- secondary_rgba.green = secondary->green / 65535.;
- secondary_rgba.blue = secondary->blue / 65535.;
- secondary_rgba.alpha = 1;
-
- gtk_widget_override_cursor (widget, &primary_rgba, &secondary_rgba);
-}
-
-/**
- * gtk_widget_modify_font:
- * @widget: a #GtkWidget
- * @font_desc: (allow-none): the font description to use, or %NULL
- * to undo the effect of previous calls to gtk_widget_modify_font()
- *
- * Sets the font to use for a widget.
- *
- * All other style values are left untouched.
- * See also gtk_widget_modify_style().
- *
- * Deprecated:3.0: Use gtk_widget_override_font() instead
- */
-void
-gtk_widget_modify_font (GtkWidget *widget,
- PangoFontDescription *font_desc)
-{
- g_return_if_fail (GTK_IS_WIDGET (widget));
-
- gtk_widget_override_font (widget, font_desc);
-}
-
-/**
- * gtk_widget_reset_rc_styles:
- * @widget: a #GtkWidget.
- *
- * Reset the styles of @widget and all descendents, so when
- * they are looked up again, they get the correct values
- * for the currently loaded RC file settings.
- *
- * This function is not useful for applications.
- *
- * Deprecated:3.0: Use #GtkStyleContext instead, and gtk_widget_reset_style()
- */
-void
-gtk_widget_reset_rc_styles (GtkWidget *widget)
-{
- g_return_if_fail (GTK_IS_WIDGET (widget));
-
- gtk_widget_reset_style (widget);
-}
-
-/**
- * gtk_widget_path:
- * @widget: a #GtkWidget
- * @path_length: (out) (allow-none): location to store length of the path,
- * or %NULL
- * @path: (out) (allow-none): location to store allocated path string,
- * or %NULL
- * @path_reversed: (out) (allow-none): location to store allocated reverse
- * path string, or %NULL
- *
- * Obtains the full path to @widget. The path is simply the name of a
- * widget and all its parents in the container hierarchy, separated by
- * periods. The name of a widget comes from
- * gtk_widget_get_name(). Paths are used to apply styles to a widget
- * in gtkrc configuration files. Widget names are the type of the
- * widget by default (e.g. “GtkButton”) or can be set to an
- * application-specific value with gtk_widget_set_name(). By setting
- * the name of a widget, you allow users or theme authors to apply
- * styles to that specific widget in their gtkrc
- * file. @path_reversed_p fills in the path in reverse order,
- * i.e. starting with @widget’s name instead of starting with the name
- * of @widget’s outermost ancestor.
- *
- * Deprecated:3.0: Use gtk_widget_get_path() instead
- **/
-void
-gtk_widget_path (GtkWidget *widget,
- guint *path_length,
- gchar **path,
- gchar **path_reversed)
-{
- static gchar *rev_path = NULL;
- static guint tmp_path_len = 0;
- guint len;
-
-#define INIT_PATH_SIZE (512)
-
- g_return_if_fail (GTK_IS_WIDGET (widget));
-
- len = 0;
- do
- {
- const gchar *string;
- const gchar *s;
- gchar *d;
- guint l;
-
- string = gtk_widget_get_name (widget);
- l = strlen (string);
- while (tmp_path_len <= len + l + 1)
- {
- tmp_path_len += INIT_PATH_SIZE;
- rev_path = g_realloc (rev_path, tmp_path_len);
- }
- s = string + l - 1;
- d = rev_path + len;
- while (s >= string)
- *(d++) = *(s--);
- len += l;
-
- widget = gtk_widget_get_parent (widget);
-
- if (widget)
- rev_path[len++] = '.';
- else
- rev_path[len++] = 0;
- }
- while (widget);
-
- if (path_length)
- *path_length = len - 1;
- if (path_reversed)
- *path_reversed = g_strdup (rev_path);
- if (path)
- {
- *path = g_strdup (rev_path);
- g_strreverse (*path);
- }
-}
-
-/**
- * gtk_widget_class_path:
- * @widget: a #GtkWidget
- * @path_length: (out) (optional): location to store the length of the
- * class path, or %NULL
- * @path: (out) (optional): location to store the class path as an
- * allocated string, or %NULL
- * @path_reversed: (out) (optional): location to store the reverse
- * class path as an allocated string, or %NULL
- *
- * Same as gtk_widget_path(), but always uses the name of a widget’s type,
- * never uses a custom name set with gtk_widget_set_name().
- *
- * Deprecated:3.0: Use gtk_widget_get_path() instead
- **/
-void
-gtk_widget_class_path (GtkWidget *widget,
- guint *path_length,
- gchar **path,
- gchar **path_reversed)
-{
- static gchar *rev_path = NULL;
- static guint tmp_path_len = 0;
- guint len;
-
- g_return_if_fail (GTK_IS_WIDGET (widget));
-
- len = 0;
- do
- {
- const gchar *string;
- const gchar *s;
- gchar *d;
- guint l;
-
- string = g_type_name (G_OBJECT_TYPE (widget));
- l = strlen (string);
- while (tmp_path_len <= len + l + 1)
- {
- tmp_path_len += INIT_PATH_SIZE;
- rev_path = g_realloc (rev_path, tmp_path_len);
- }
- s = string + l - 1;
- d = rev_path + len;
- while (s >= string)
- *(d++) = *(s--);
- len += l;
-
- widget = gtk_widget_get_parent (widget);
-
- if (widget)
- rev_path[len++] = '.';
- else
- rev_path[len++] = 0;
- }
- while (widget);
-
- if (path_length)
- *path_length = len - 1;
- if (path_reversed)
- *path_reversed = g_strdup (rev_path);
- if (path)
- {
- *path = g_strdup (rev_path);
- g_strreverse (*path);
- }
-}
-
-/**
- * gtk_widget_render_icon:
- * @widget: a #GtkWidget
- * @stock_id: a stock ID
- * @size: (type int): a stock size (#GtkIconSize). A size of `(GtkIconSize)-1`
- * means render at the size of the source and don’t scale (if there are
- * multiple source sizes, GTK+ picks one of the available sizes).
- * @detail: (allow-none): render detail to pass to theme engine
- *
- * A convenience function that uses the theme settings for @widget
- * to look up @stock_id and render it to a pixbuf. @stock_id should
- * be a stock icon ID such as #GTK_STOCK_OPEN or #GTK_STOCK_OK. @size
- * should be a size such as #GTK_ICON_SIZE_MENU. @detail should be a
- * string that identifies the widget or code doing the rendering, so
- * that theme engines can special-case rendering for that widget or
- * code.
- *
- * The pixels in the returned #GdkPixbuf are shared with the rest of
- * the application and should not be modified. The pixbuf should be
- * freed after use with g_object_unref().
- *
- * Returns: (nullable) (transfer full): a new pixbuf, or %NULL if the
- * stock ID wasn’t known
- *
- * Deprecated: 3.0: Use gtk_widget_render_icon_pixbuf() instead.
- **/
-GdkPixbuf*
-gtk_widget_render_icon (GtkWidget *widget,
- const gchar *stock_id,
- GtkIconSize size,
- const gchar *detail)
-{
- gtk_widget_ensure_style (widget);
-
- return gtk_widget_render_icon_pixbuf (widget, stock_id, size);
-}
diff --git a/gtk/deprecated/gtkstyle.h b/gtk/deprecated/gtkstyle.h
deleted file mode 100644
index 55b693430e..0000000000
--- a/gtk/deprecated/gtkstyle.h
+++ /dev/null
@@ -1,793 +0,0 @@
-/* GTK - The GIMP Toolkit
- * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
- *
- * 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/>.
- */
-
-/*
- * Modified by the GTK+ Team and others 1997-2000. See the AUTHORS
- * file for a list of people on the GTK+ Team. See the ChangeLog
- * files for a list of changes. These files are distributed with
- * GTK+ at ftp://ftp.gtk.org/pub/gtk/.
- */
-
-#ifndef __GTK_STYLE_H__
-#define __GTK_STYLE_H__
-
-
-#if !defined (__GTK_H_INSIDE__) && !defined (GTK_COMPILATION)
-#error "Only <gtk/gtk.h> can be included directly."
-#endif
-
-#include <gdk/gdk.h>
-#include <gtk/gtkenums.h>
-#include <gtk/gtktypes.h>
-
-
-G_BEGIN_DECLS
-
-#define GTK_TYPE_STYLE (gtk_style_get_type ())
-#define GTK_STYLE(object) (G_TYPE_CHECK_INSTANCE_CAST ((object), GTK_TYPE_STYLE, GtkStyle))
-#define GTK_STYLE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GTK_TYPE_STYLE, GtkStyleClass))
-#define GTK_IS_STYLE(object) (G_TYPE_CHECK_INSTANCE_TYPE ((object), GTK_TYPE_STYLE))
-#define GTK_IS_STYLE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GTK_TYPE_STYLE))
-#define GTK_STYLE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GTK_TYPE_STYLE, GtkStyleClass))
-
-/* Some forward declarations needed to rationalize the header
- * files.
- */
-typedef struct _GtkStyleClass GtkStyleClass;
-typedef struct _GtkThemeEngine GtkThemeEngine;
-typedef struct _GtkRcProperty GtkRcProperty;
-
-/**
- * GtkExpanderStyle:
- * @GTK_EXPANDER_COLLAPSED: The style used for a collapsed subtree.
- * @GTK_EXPANDER_SEMI_COLLAPSED: Intermediate style used during animation.
- * @GTK_EXPANDER_SEMI_EXPANDED: Intermediate style used during animation.
- * @GTK_EXPANDER_EXPANDED: The style used for an expanded subtree.
- *
- * Used to specify the style of the expanders drawn by a #GtkTreeView.
- */
-typedef enum
-{
- GTK_EXPANDER_COLLAPSED,
- GTK_EXPANDER_SEMI_COLLAPSED,
- GTK_EXPANDER_SEMI_EXPANDED,
- GTK_EXPANDER_EXPANDED
-} GtkExpanderStyle;
-
-/**
- * GTK_STYLE_ATTACHED:
- * @style: a #GtkStyle.
- *
- * Returns: whether the style is attached to a window.
- */
-#define GTK_STYLE_ATTACHED(style) (GTK_STYLE (style)->attach_count > 0)
-
-/**
- * GtkStyle:
- * @fg: Set of foreground #GdkColor
- * @bg: Set of background #GdkColor
- * @light: Set of light #GdkColor
- * @dark: Set of dark #GdkColor
- * @mid: Set of mid #GdkColor
- * @text: Set of text #GdkColor
- * @base: Set of base #GdkColor
- * @text_aa: Color halfway between text/base
- * @black: #GdkColor to use for black
- * @white: #GdkColor to use for white
- * @font_desc: #PangoFontDescription
- * @xthickness: Thickness in X direction
- * @ythickness: Thickness in Y direction
- * @background: Set of background #cairo_pattern_t
- */
-struct _GtkStyle
-{
- /*< private >*/
- GObject parent_instance;
-
- /*< public >*/
-
- GdkColor fg[5];
- GdkColor bg[5];
- GdkColor light[5];
- GdkColor dark[5];
- GdkColor mid[5];
- GdkColor text[5];
- GdkColor base[5];
- GdkColor text_aa[5]; /* Halfway between text/base */
-
- GdkColor black;
- GdkColor white;
- PangoFontDescription *font_desc;
-
- gint xthickness;
- gint ythickness;
-
- cairo_pattern_t *background[5];
-
- /*< private >*/
-
- gint attach_count;
-
- GdkVisual *visual;
- PangoFontDescription *private_font_desc; /* Font description for style->private_font or %NULL */
-
- /* the RcStyle from which this style was created */
- GtkRcStyle *rc_style;
-
- GSList *styles; /* of type GtkStyle* */
- GArray *property_cache;
- GSList *icon_factories; /* of type GtkIconFactory* */
-};
-
-/**
- * GtkStyleClass:
- * @parent_class: The parent class.
- * @realize:
- * @unrealize:
- * @copy:
- * @clone:
- * @init_from_rc:
- * @set_background:
- * @render_icon:
- * @draw_hline:
- * @draw_vline:
- * @draw_shadow:
- * @draw_arrow:
- * @draw_diamond:
- * @draw_box:
- * @draw_flat_box:
- * @draw_check:
- * @draw_option:
- * @draw_tab:
- * @draw_shadow_gap:
- * @draw_box_gap:
- * @draw_extension:
- * @draw_focus:
- * @draw_slider:
- * @draw_handle:
- * @draw_expander:
- * @draw_layout:
- * @draw_resize_grip:
- * @draw_spinner:
- */
-struct _GtkStyleClass
-{
- GObjectClass parent_class;
-
- /*< public >*/
-
- /* Initialize for a particular visual. style->visual
- * will have been set at this point. Will typically chain
- * to parent.
- */
- void (*realize) (GtkStyle *style);
-
- /* Clean up for a particular visual. Will typically chain
- * to parent.
- */
- void (*unrealize) (GtkStyle *style);
-
- /* Make style an exact duplicate of src.
- */
- void (*copy) (GtkStyle *style,
- GtkStyle *src);
-
- /* Create an empty style of the same type as this style.
- * The default implementation, which does
- * g_object_new (G_OBJECT_TYPE (style), NULL);
- * should work in most cases.
- */
- GtkStyle *(*clone) (GtkStyle *style);
-
- /* Initialize the GtkStyle with the values in the GtkRcStyle.
- * should chain to the parent implementation.
- */
- void (*init_from_rc) (GtkStyle *style,
- GtkRcStyle *rc_style);
-
- void (*set_background) (GtkStyle *style,
- GdkWindow *window,
- GtkStateType state_type);
-
-
- GdkPixbuf * (* render_icon) (GtkStyle *style,
- const GtkIconSource *source,
- GtkTextDirection direction,
- GtkStateType state,
- GtkIconSize size,
- GtkWidget *widget,
- const gchar *detail);
-
- /* Drawing functions
- */
-
- void (*draw_hline) (GtkStyle *style,
- cairo_t *cr,
- GtkStateType state_type,
- GtkWidget *widget,
- const gchar *detail,
- gint x1,
- gint x2,
- gint y);
- void (*draw_vline) (GtkStyle *style,
- cairo_t *cr,
- GtkStateType state_type,
- GtkWidget *widget,
- const gchar *detail,
- gint y1_,
- gint y2_,
- gint x);
- void (*draw_shadow) (GtkStyle *style,
- cairo_t *cr,
- GtkStateType state_type,
- GtkShadowType shadow_type,
- GtkWidget *widget,
- const gchar *detail,
- gint x,
- gint y,
- gint width,
- gint height);
- void (*draw_arrow) (GtkStyle *style,
- cairo_t *cr,
- GtkStateType state_type,
- GtkShadowType shadow_type,
- GtkWidget *widget,
- const gchar *detail,
- GtkArrowType arrow_type,
- gboolean fill,
- gint x,
- gint y,
- gint width,
- gint height);
- void (*draw_diamond) (GtkStyle *style,
- cairo_t *cr,
- GtkStateType state_type,
- GtkShadowType shadow_type,
- GtkWidget *widget,
- const gchar *detail,
- gint x,
- gint y,
- gint width,
- gint height);
- void (*draw_box) (GtkStyle *style,
- cairo_t *cr,
- GtkStateType state_type,
- GtkShadowType shadow_type,
- GtkWidget *widget,
- const gchar *detail,
- gint x,
- gint y,
- gint width,
- gint height);
- void (*draw_flat_box) (GtkStyle *style,
- cairo_t *cr,
- GtkStateType state_type,
- GtkShadowType shadow_type,
- GtkWidget *widget,
- const gchar *detail,
- gint x,
- gint y,
- gint width,
- gint height);
- void (*draw_check) (GtkStyle *style,
- cairo_t *cr,
- GtkStateType state_type,
- GtkShadowType shadow_type,
- GtkWidget *widget,
- const gchar *detail,
- gint x,
- gint y,
- gint width,
- gint height);
- void (*draw_option) (GtkStyle *style,
- cairo_t *cr,
- GtkStateType state_type,
- GtkShadowType shadow_type,
- GtkWidget *widget,
- const gchar *detail,
- gint x,
- gint y,
- gint width,
- gint height);
- void (*draw_tab) (GtkStyle *style,
- cairo_t *cr,
- GtkStateType state_type,
- GtkShadowType shadow_type,
- GtkWidget *widget,
- const gchar *detail,
- gint x,
- gint y,
- gint width,
- gint height);
- void (*draw_shadow_gap) (GtkStyle *style,
- cairo_t *cr,
- GtkStateType state_type,
- GtkShadowType shadow_type,
- GtkWidget *widget,
- const gchar *detail,
- gint x,
- gint y,
- gint width,
- gint height,
- GtkPositionType gap_side,
- gint gap_x,
- gint gap_width);
- void (*draw_box_gap) (GtkStyle *style,
- cairo_t *cr,
- GtkStateType state_type,
- GtkShadowType shadow_type,
- GtkWidget *widget,
- const gchar *detail,
- gint x,
- gint y,
- gint width,
- gint height,
- GtkPositionType gap_side,
- gint gap_x,
- gint gap_width);
- void (*draw_extension) (GtkStyle *style,
- cairo_t *cr,
- GtkStateType state_type,
- GtkShadowType shadow_type,
- GtkWidget *widget,
- const gchar *detail,
- gint x,
- gint y,
- gint width,
- gint height,
- GtkPositionType gap_side);
- void (*draw_focus) (GtkStyle *style,
- cairo_t *cr,
- GtkStateType state_type,
- GtkWidget *widget,
- const gchar *detail,
- gint x,
- gint y,
- gint width,
- gint height);
- void (*draw_slider) (GtkStyle *style,
- cairo_t *cr,
- GtkStateType state_type,
- GtkShadowType shadow_type,
- GtkWidget *widget,
- const gchar *detail,
- gint x,
- gint y,
- gint width,
- gint height,
- GtkOrientation orientation);
- void (*draw_handle) (GtkStyle *style,
- cairo_t *cr,
- GtkStateType state_type,
- GtkShadowType shadow_type,
- GtkWidget *widget,
- const gchar *detail,
- gint x,
- gint y,
- gint width,
- gint height,
- GtkOrientation orientation);
-
- void (*draw_expander) (GtkStyle *style,
- cairo_t *cr,
- GtkStateType state_type,
- GtkWidget *widget,
- const gchar *detail,
- gint x,
- gint y,
- GtkExpanderStyle expander_style);
- void (*draw_layout) (GtkStyle *style,
- cairo_t *cr,
- GtkStateType state_type,
- gboolean use_text,
- GtkWidget *widget,
- const gchar *detail,
- gint x,
- gint y,
- PangoLayout *layout);
- void (*draw_resize_grip) (GtkStyle *style,
- cairo_t *cr,
- GtkStateType state_type,
- GtkWidget *widget,
- const gchar *detail,
- GdkWindowEdge edge,
- gint x,
- gint y,
- gint width,
- gint height);
- void (*draw_spinner) (GtkStyle *style,
- cairo_t *cr,
- GtkStateType state_type,
- GtkWidget *widget,
- const gchar *detail,
- guint step,
- gint x,
- gint y,
- gint width,
- gint height);
-
- /*< private >*/
-
- /* Padding for future expansion */
- void (*_gtk_reserved1) (void);
- void (*_gtk_reserved2) (void);
- void (*_gtk_reserved3) (void);
- void (*_gtk_reserved4) (void);
- void (*_gtk_reserved5) (void);
- void (*_gtk_reserved6) (void);
- void (*_gtk_reserved7) (void);
- void (*_gtk_reserved8) (void);
- void (*_gtk_reserved9) (void);
- void (*_gtk_reserved10) (void);
- void (*_gtk_reserved11) (void);
-};
-
-GDK_DEPRECATED_IN_3_0
-GType gtk_style_get_type (void) G_GNUC_CONST;
-GDK_DEPRECATED_IN_3_0_FOR(GtkStyleContext)
-GtkStyle* gtk_style_new (void);
-GDK_DEPRECATED_IN_3_0_FOR(GtkStyleContext)
-GtkStyle* gtk_style_copy (GtkStyle *style);
-GDK_DEPRECATED_IN_3_0_FOR(GtkStyleContext)
-GtkStyle* gtk_style_attach (GtkStyle *style,
- GdkWindow *window);
-GDK_DEPRECATED_IN_3_0_FOR(GtkStyleContext)
-void gtk_style_detach (GtkStyle *style);
-GDK_DEPRECATED_IN_3_0_FOR(GtkStyleContext)
-void gtk_style_set_background (GtkStyle *style,
- GdkWindow *window,
- GtkStateType state_type);
-GDK_DEPRECATED_IN_3_0_FOR(GtkStyleContext and gtk_render_background)
-void gtk_style_apply_default_background (GtkStyle *style,
- cairo_t *cr,
- GdkWindow *window,
- GtkStateType state_type,
- gint x,
- gint y,
- gint width,
- gint height);
-
-GDK_DEPRECATED_IN_3_0_FOR(GtkStyleContext and a style class)
-GtkIconSet* gtk_style_lookup_icon_set (GtkStyle *style,
- const gchar *stock_id);
-GDK_DEPRECATED_IN_3_0_FOR(GtkStyleContext and a style class)
-gboolean gtk_style_lookup_color (GtkStyle *style,
- const gchar *color_name,
- GdkColor *color);
-
-GDK_DEPRECATED_IN_3_0_FOR(GtkStyleContext and gtk_render_icon)
-GdkPixbuf* gtk_style_render_icon (GtkStyle *style,
- const GtkIconSource *source,
- GtkTextDirection direction,
- GtkStateType state,
- GtkIconSize size,
- GtkWidget *widget,
- const gchar *detail);
-
-GDK_DEPRECATED_IN_3_0_FOR(GtkStyleContext and gtk_render_line)
-void gtk_paint_hline (GtkStyle *style,
- cairo_t *cr,
- GtkStateType state_type,
- GtkWidget *widget,
- const gchar *detail,
- gint x1,
- gint x2,
- gint y);
-GDK_DEPRECATED_IN_3_0_FOR(GtkStyleContext and gtk_render_line)
-void gtk_paint_vline (GtkStyle *style,
- cairo_t *cr,
- GtkStateType state_type,
- GtkWidget *widget,
- const gchar *detail,
- gint y1_,
- gint y2_,
- gint x);
-GDK_DEPRECATED_IN_3_0_FOR(GtkStyleContext and gtk_render_background)
-void gtk_paint_shadow (GtkStyle *style,
- cairo_t *cr,
- GtkStateType state_type,
- GtkShadowType shadow_type,
- GtkWidget *widget,
- const gchar *detail,
- gint x,
- gint y,
- gint width,
- gint height);
-GDK_DEPRECATED_IN_3_0_FOR(GtkStyleContext and gtk_render_arrow)
-void gtk_paint_arrow (GtkStyle *style,
- cairo_t *cr,
- GtkStateType state_type,
- GtkShadowType shadow_type,
- GtkWidget *widget,
- const gchar *detail,
- GtkArrowType arrow_type,
- gboolean fill,
- gint x,
- gint y,
- gint width,
- gint height);
-GDK_DEPRECATED_IN_3_0_FOR(GtkStyleContext and gtk_render_icon)
-void gtk_paint_diamond (GtkStyle *style,
- cairo_t *cr,
- GtkStateType state_type,
- GtkShadowType shadow_type,
- GtkWidget *widget,
- const gchar *detail,
- gint x,
- gint y,
- gint width,
- gint height);
-GDK_DEPRECATED_IN_3_0_FOR(GtkStyleContext and gtk_render_frame)
-void gtk_paint_box (GtkStyle *style,
- cairo_t *cr,
- GtkStateType state_type,
- GtkShadowType shadow_type,
- GtkWidget *widget,
- const gchar *detail,
- gint x,
- gint y,
- gint width,
- gint height);
-GDK_DEPRECATED_IN_3_0_FOR(GtkStyleContext and gtk_render_background)
-void gtk_paint_flat_box (GtkStyle *style,
- cairo_t *cr,
- GtkStateType state_type,
- GtkShadowType shadow_type,
- GtkWidget *widget,
- const gchar *detail,
- gint x,
- gint y,
- gint width,
- gint height);
-GDK_DEPRECATED_IN_3_0_FOR(GtkStyleContext and gtk_render_check)
-void gtk_paint_check (GtkStyle *style,
- cairo_t *cr,
- GtkStateType state_type,
- GtkShadowType shadow_type,
- GtkWidget *widget,
- const gchar *detail,
- gint x,
- gint y,
- gint width,
- gint height);
-GDK_DEPRECATED_IN_3_0_FOR(GtkStyleContext and gtk_render_option)
-void gtk_paint_option (GtkStyle *style,
- cairo_t *cr,
- GtkStateType state_type,
- GtkShadowType shadow_type,
- GtkWidget *widget,
- const gchar *detail,
- gint x,
- gint y,
- gint width,
- gint height);
-GDK_DEPRECATED_IN_3_0_FOR(GtkStyleContext and gtk_render_background)
-void gtk_paint_tab (GtkStyle *style,
- cairo_t *cr,
- GtkStateType state_type,
- GtkShadowType shadow_type,
- GtkWidget *widget,
- const gchar *detail,
- gint x,
- gint y,
- gint width,
- gint height);
-GDK_DEPRECATED_IN_3_0_FOR(GtkStyleContext)
-void gtk_paint_shadow_gap (GtkStyle *style,
- cairo_t *cr,
- GtkStateType state_type,
- GtkShadowType shadow_type,
- GtkWidget *widget,
- const gchar *detail,
- gint x,
- gint y,
- gint width,
- gint height,
- GtkPositionType gap_side,
- gint gap_x,
- gint gap_width);
-GDK_DEPRECATED_IN_3_0_FOR(GtkStyleContext)
-void gtk_paint_box_gap (GtkStyle *style,
- cairo_t *cr,
- GtkStateType state_type,
- GtkShadowType shadow_type,
- GtkWidget *widget,
- const gchar *detail,
- gint x,
- gint y,
- gint width,
- gint height,
- GtkPositionType gap_side,
- gint gap_x,
- gint gap_width);
-GDK_DEPRECATED_IN_3_0_FOR(GtkStyleContext and gtk_render_extension)
-void gtk_paint_extension (GtkStyle *style,
- cairo_t *cr,
- GtkStateType state_type,
- GtkShadowType shadow_type,
- GtkWidget *widget,
- const gchar *detail,
- gint x,
- gint y,
- gint width,
- gint height,
- GtkPositionType gap_side);
-GDK_DEPRECATED_IN_3_0_FOR(GtkStyleContext and gtk_render_focus)
-void gtk_paint_focus (GtkStyle *style,
- cairo_t *cr,
- GtkStateType state_type,
- GtkWidget *widget,
- const gchar *detail,
- gint x,
- gint y,
- gint width,
- gint height);
-GDK_DEPRECATED_IN_3_0_FOR(GtkStyleContext and gtk_render_focus)
-void gtk_paint_slider (GtkStyle *style,
- cairo_t *cr,
- GtkStateType state_type,
- GtkShadowType shadow_type,
- GtkWidget *widget,
- const gchar *detail,
- gint x,
- gint y,
- gint width,
- gint height,
- GtkOrientation orientation);
-GDK_DEPRECATED_IN_3_0_FOR(GtkStyleContext and gtk_render_handle)
-void gtk_paint_handle (GtkStyle *style,
- cairo_t *cr,
- GtkStateType state_type,
- GtkShadowType shadow_type,
- GtkWidget *widget,
- const gchar *detail,
- gint x,
- gint y,
- gint width,
- gint height,
- GtkOrientation orientation);
-GDK_DEPRECATED_IN_3_0_FOR(GtkStyleContext and gtk_render_expander)
-void gtk_paint_expander (GtkStyle *style,
- cairo_t *cr,
- GtkStateType state_type,
- GtkWidget *widget,
- const gchar *detail,
- gint x,
- gint y,
- GtkExpanderStyle expander_style);
-GDK_DEPRECATED_IN_3_0_FOR(GtkStyleContext and gtk_render_layout)
-void gtk_paint_layout (GtkStyle *style,
- cairo_t *cr,
- GtkStateType state_type,
- gboolean use_text,
- GtkWidget *widget,
- const gchar *detail,
- gint x,
- gint y,
- PangoLayout *layout);
-GDK_DEPRECATED_IN_3_0_FOR(GtkStyleContext and gtk_render_handle)
-void gtk_paint_resize_grip (GtkStyle *style,
- cairo_t *cr,
- GtkStateType state_type,
- GtkWidget *widget,
- const gchar *detail,
- GdkWindowEdge edge,
- gint x,
- gint y,
- gint width,
- gint height);
-GDK_DEPRECATED_IN_3_0_FOR(GtkStyleContext and gtk_render_icon)
-void gtk_paint_spinner (GtkStyle *style,
- cairo_t *cr,
- GtkStateType state_type,
- GtkWidget *widget,
- const gchar *detail,
- guint step,
- gint x,
- gint y,
- gint width,
- gint height);
-
-GDK_DEPRECATED_IN_3_0_FOR(GtkStyleContext and gtk_style_context_get_property)
-void gtk_style_get_style_property (GtkStyle *style,
- GType widget_type,
- const gchar *property_name,
- GValue *value);
-GDK_DEPRECATED_IN_3_0_FOR(GtkStyleContext and gtk_style_context_get_property)
-void gtk_style_get_valist (GtkStyle *style,
- GType widget_type,
- const gchar *first_property_name,
- va_list var_args);
-GDK_DEPRECATED_IN_3_0_FOR(GtkStyleContext and gtk_style_context_get_property)
-void gtk_style_get (GtkStyle *style,
- GType widget_type,
- const gchar *first_property_name,
- ...) G_GNUC_NULL_TERMINATED;
-
-
-/* --- private API --- */
-GtkStyle* _gtk_style_new_for_path (GdkScreen *screen,
- GtkWidgetPath *path);
-void _gtk_style_shade (const GdkColor *a,
- GdkColor *b,
- gdouble k);
-
-GDK_DEPRECATED_IN_3_0_FOR(GtkStyleContext)
-gboolean gtk_style_has_context (GtkStyle *style);
-
-GDK_DEPRECATED_IN_3_0
-void gtk_widget_style_attach (GtkWidget *widget);
-GDK_DEPRECATED_IN_3_0_FOR(GtkStyleContext)
-gboolean gtk_widget_has_rc_style (GtkWidget *widget);
-GDK_DEPRECATED_IN_3_0
-void gtk_widget_set_style (GtkWidget *widget,
- GtkStyle *style);
-GDK_DEPRECATED_IN_3_0
-void gtk_widget_ensure_style (GtkWidget *widget);
-GDK_DEPRECATED_IN_3_0_FOR(gtk_widget_get_style_context)
-GtkStyle * gtk_widget_get_style (GtkWidget *widget);
-GDK_DEPRECATED_IN_3_0_FOR(GtkStyleContext)
-void gtk_widget_modify_style (GtkWidget *widget,
- GtkRcStyle *style);
-GDK_DEPRECATED_IN_3_0_FOR(GtkStyleContext)
-GtkRcStyle *gtk_widget_get_modifier_style (GtkWidget *widget);
-GDK_DEPRECATED_IN_3_0_FOR(gtk_widget_override_color)
-void gtk_widget_modify_fg (GtkWidget *widget,
- GtkStateType state,
- const GdkColor *color);
-GDK_DEPRECATED_IN_3_0_FOR(gtk_widget_override_background_color)
-void gtk_widget_modify_bg (GtkWidget *widget,
- GtkStateType state,
- const GdkColor *color);
-GDK_DEPRECATED_IN_3_0_FOR(CSS style classes)
-void gtk_widget_modify_text (GtkWidget *widget,
- GtkStateType state,
- const GdkColor *color);
-GDK_DEPRECATED_IN_3_0_FOR(CSS style classes)
-void gtk_widget_modify_base (GtkWidget *widget,
- GtkStateType state,
- const GdkColor *color);
-GDK_DEPRECATED_IN_3_0_FOR(CSS style classes)
-void gtk_widget_modify_cursor (GtkWidget *widget,
- const GdkColor *primary,
- const GdkColor *secondary);
-GDK_DEPRECATED_IN_3_0_FOR(gtk_widget_override_font)
-void gtk_widget_modify_font (GtkWidget *widget,
- PangoFontDescription *font_desc);
-GDK_DEPRECATED_IN_3_0_FOR(gtk_widget_reset_style)
-void gtk_widget_reset_rc_styles (GtkWidget *widget);
-GDK_DEPRECATED_IN_3_0_FOR(gtk_style_context_new)
-GtkStyle* gtk_widget_get_default_style (void);
-GDK_DEPRECATED_IN_3_0_FOR(gtk_widget_get_path)
-void gtk_widget_path (GtkWidget *widget,
- guint *path_length,
- gchar **path,
- gchar **path_reversed);
-GDK_DEPRECATED_IN_3_0
-void gtk_widget_class_path (GtkWidget *widget,
- guint *path_length,
- gchar **path,
- gchar **path_reversed);
-GDK_DEPRECATED_IN_3_0_FOR(gtk_widget_render_icon_pixbuf)
-GdkPixbuf *gtk_widget_render_icon (GtkWidget *widget,
- const gchar *stock_id,
- GtkIconSize size,
- const gchar *detail);
-
-G_END_DECLS
-
-#endif /* __GTK_STYLE_H__ */
diff --git a/gtk/gtk-autocleanups.h b/gtk/gtk-autocleanups.h
index 561485ec51..0b1c23081e 100644
--- a/gtk/gtk-autocleanups.h
+++ b/gtk/gtk-autocleanups.h
@@ -133,7 +133,6 @@ G_DEFINE_AUTOPTR_CLEANUP_FUNC(GtkRadioButton, g_object_unref)
G_DEFINE_AUTOPTR_CLEANUP_FUNC(GtkRadioMenuItem, g_object_unref)
G_DEFINE_AUTOPTR_CLEANUP_FUNC(GtkRadioToolButton, g_object_unref)
G_DEFINE_AUTOPTR_CLEANUP_FUNC(GtkRange, g_object_unref)
-G_DEFINE_AUTOPTR_CLEANUP_FUNC(GtkRcStyle, g_object_unref)
G_DEFINE_AUTOPTR_CLEANUP_FUNC(GtkRecentChooser, g_object_unref)
G_DEFINE_AUTOPTR_CLEANUP_FUNC(GtkRecentChooserDialog, g_object_unref)
G_DEFINE_AUTOPTR_CLEANUP_FUNC(GtkRecentChooserMenu, g_object_unref)
@@ -159,7 +158,6 @@ G_DEFINE_AUTOPTR_CLEANUP_FUNC(GtkSpinner, g_object_unref)
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(GtkStyle, 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)
diff --git a/gtk/gtk.h b/gtk/gtk.h
index 7cc03bfc2f..7784446885 100644
--- a/gtk/gtk.h
+++ b/gtk/gtk.h
@@ -263,10 +263,8 @@
#include <gtk/deprecated/gtkimagemenuitem.h>
#include <gtk/deprecated/gtkmisc.h>
#include <gtk/deprecated/gtkradioaction.h>
-#include <gtk/deprecated/gtkrc.h>
#include <gtk/deprecated/gtkrecentaction.h>
#include <gtk/deprecated/gtkstock.h>
-#include <gtk/deprecated/gtkstyle.h>
#include <gtk/deprecated/gtkstyleproperties.h>
#include <gtk/deprecated/gtksymboliccolor.h>
#include <gtk/deprecated/gtktable.h>
diff --git a/gtk/gtkicontheme.c b/gtk/gtkicontheme.c
index 4eec9fe90a..963a258588 100644
--- a/gtk/gtkicontheme.c
+++ b/gtk/gtkicontheme.c
@@ -50,13 +50,6 @@
#include "gtkprivate.h"
#include "gdkpixbufutilsprivate.h"
-#undef GDK_DEPRECATED
-#undef GDK_DEPRECATED_FOR
-#define GDK_DEPRECATED
-#define GDK_DEPRECATED_FOR(f)
-
-#include "deprecated/gtkstyle.h"
-
/* this is in case round() is not provided by the compiler,
* such as in the case of C89 compilers, like MSVC
*/
@@ -5111,90 +5104,6 @@ gtk_icon_info_load_symbolic_for_context_finish (GtkIconInfo *icon_info,
return gtk_icon_info_load_symbolic_finish (icon_info, result, was_symbolic, error);
}
-static GdkRGBA *
-color_to_rgba (GdkColor *color,
- GdkRGBA *rgba)
-{
- rgba->red = color->red / 65535.0;
- rgba->green = color->green / 65535.0;
- rgba->blue = color->blue / 65535.0;
- rgba->alpha = 1.0;
- return rgba;
-}
-
-/**
- * gtk_icon_info_load_symbolic_for_style:
- * @icon_info: a #GtkIconInfo
- * @style: a #GtkStyle to take the colors from
- * @state: the widget state to use for colors
- * @was_symbolic: (out) (allow-none): a #gboolean, returns whether the
- * loaded icon was a symbolic one and whether the @fg color was
- * applied to it.
- * @error: (allow-none): location to store error information on failure,
- * or %NULL.
- *
- * Loads an icon, modifying it to match the system colours for the foreground,
- * success, warning and error colors provided. If the icon is not a symbolic
- * one, the function will return the result from gtk_icon_info_load_icon().
- *
- * This allows loading symbolic icons that will match the system theme.
- *
- * See gtk_icon_info_load_symbolic() for more details.
- *
- * Returns: (transfer full): a #GdkPixbuf representing the loaded icon
- *
- * Since: 3.0
- *
- * Deprecated: 3.0: Use gtk_icon_info_load_symbolic_for_context() instead
- */
-GdkPixbuf *
-gtk_icon_info_load_symbolic_for_style (GtkIconInfo *icon_info,
- GtkStyle *style,
- GtkStateType state,
- gboolean *was_symbolic,
- GError **error)
-{
- GdkColor color;
- GdkRGBA fg;
- GdkRGBA success_color;
- GdkRGBA *success_colorp;
- GdkRGBA warning_color;
- GdkRGBA *warning_colorp;
- GdkRGBA error_color;
- GdkRGBA *error_colorp;
- gboolean is_symbolic;
-
- g_return_val_if_fail (icon_info != NULL, NULL);
- g_return_val_if_fail (style != NULL, NULL);
-
- is_symbolic = gtk_icon_info_is_symbolic (icon_info);
-
- if (was_symbolic)
- *was_symbolic = is_symbolic;
-
- if (!is_symbolic)
- return gtk_icon_info_load_icon (icon_info, error);
-
- color_to_rgba (&style->fg[state], &fg);
-
- success_colorp = warning_colorp = error_colorp = NULL;
-
- if (gtk_style_lookup_color (style, "success_color", &color))
- success_colorp = color_to_rgba (&color, &success_color);
-
- if (gtk_style_lookup_color (style, "warning_color", &color))
- warning_colorp = color_to_rgba (&color, &warning_color);
-
- if (gtk_style_lookup_color (style, "error_color", &color))
- error_colorp = color_to_rgba (&color, &error_color);
-
- return gtk_icon_info_load_symbolic_internal (icon_info,
- &fg, success_colorp,
- warning_colorp, error_colorp,
- TRUE,
- error);
-}
-
/**
* gtk_icon_info_set_raw_coordinates:
* @icon_info: a #GtkIconInfo
diff --git a/gtk/gtkicontheme.h b/gtk/gtkicontheme.h
index 7824a46765..48a22e69a6 100644
--- a/gtk/gtkicontheme.h
+++ b/gtk/gtkicontheme.h
@@ -351,12 +351,6 @@ GdkPixbuf * gtk_icon_info_load_symbolic_for_context_finish (GtkIconInf
GAsyncResult *res,
gboolean *was_symbolic,
GError **error);
-GDK_DEPRECATED_IN_3_0_FOR(gtk_icon_info_load_symbol_for_context)
-GdkPixbuf * gtk_icon_info_load_symbolic_for_style (GtkIconInfo *icon_info,
- GtkStyle *style,
- GtkStateType state,
- gboolean *was_symbolic,
- GError **error);
GDK_DEPRECATED_IN_3_14
void gtk_icon_info_set_raw_coordinates (GtkIconInfo *icon_info,
gboolean raw_coordinates);
diff --git a/gtk/gtksizerequest.c b/gtk/gtksizerequest.c
index 1dd3671e6c..94617c8e6b 100644
--- a/gtk/gtksizerequest.c
+++ b/gtk/gtksizerequest.c
@@ -29,7 +29,6 @@
#include "gtksizegroup-private.h"
#include "gtksizerequestcacheprivate.h"
#include "gtkwidgetprivate.h"
-#include "deprecated/gtkstyle.h"
#ifdef G_ENABLE_CONSISTENCY_CHECKS
@@ -169,10 +168,6 @@ gtk_widget_query_size_for_orientation (GtkWidget *widget,
{
gint adjusted_min, adjusted_natural, adjusted_for_size = for_size;
- G_GNUC_BEGIN_IGNORE_DEPRECATIONS;
- gtk_widget_ensure_style (widget);
- G_GNUC_END_IGNORE_DEPRECATIONS;
-
if (orientation == GTK_ORIENTATION_HORIZONTAL)
{
if (for_size < 0)
diff --git a/gtk/gtktypes.h b/gtk/gtktypes.h
index f1b645a182..243aabb710 100644
--- a/gtk/gtktypes.h
+++ b/gtk/gtktypes.h
@@ -36,11 +36,9 @@ typedef struct _GtkBuilder GtkBuilder;
typedef struct _GtkClipboard GtkClipboard;
typedef struct _GtkIconSet GtkIconSet;
typedef struct _GtkIconSource GtkIconSource;
-typedef struct _GtkRcStyle GtkRcStyle;
typedef struct _GtkRequisition GtkRequisition;
typedef struct _GtkSelectionData GtkSelectionData;
typedef struct _GtkSettings GtkSettings;
-typedef struct _GtkStyle GtkStyle;
typedef struct _GtkStyleContext GtkStyleContext;
typedef struct _GtkTooltip GtkTooltip;
typedef struct _GtkWidget GtkWidget;
diff --git a/gtk/gtkwidget.c b/gtk/gtkwidget.c
index d50a77c581..97b952bb40 100644
--- a/gtk/gtkwidget.c
+++ b/gtk/gtkwidget.c
@@ -503,7 +503,6 @@ enum {
STATE_CHANGED,
PARENT_SET,
HIERARCHY_CHANGED,
- STYLE_SET,
DIRECTION_CHANGED,
GRAB_NOTIFY,
CHILD_NOTIFY,
@@ -580,7 +579,6 @@ enum {
PROP_HAS_DEFAULT,
PROP_RECEIVES_DEFAULT,
PROP_COMPOSITE_CHILD,
- PROP_STYLE,
PROP_EVENTS,
PROP_NO_SHOW_ALL,
PROP_HAS_TOOLTIP,
@@ -643,8 +641,6 @@ static void gtk_widget_real_realize (GtkWidget *widget);
static void gtk_widget_real_unrealize (GtkWidget *widget);
static void gtk_widget_real_size_allocate (GtkWidget *widget,
GtkAllocation *allocation);
-static void gtk_widget_real_style_set (GtkWidget *widget,
- GtkStyle *previous_style);
static void gtk_widget_real_direction_changed(GtkWidget *widget,
GtkTextDirection previous_direction);
@@ -1039,7 +1035,6 @@ gtk_widget_class_init (GtkWidgetClass *klass)
klass->state_flags_changed = gtk_widget_real_state_flags_changed;
klass->parent_set = NULL;
klass->hierarchy_changed = NULL;
- klass->style_set = gtk_widget_real_style_set;
klass->direction_changed = gtk_widget_real_direction_changed;
klass->grab_notify = NULL;
klass->child_notify = NULL;
@@ -1218,24 +1213,6 @@ gtk_widget_class_init (GtkWidgetClass *klass)
FALSE,
GTK_PARAM_READABLE);
-G_GNUC_BEGIN_IGNORE_DEPRECATIONS
-
- /**
- * GtkWidget:style:
- *
- * The style of the widget, which contains information about how it will look (colors, etc).
- *
- * Deprecated: Use #GtkStyleContext instead
- */
- widget_props[PROP_STYLE] =
- g_param_spec_object ("style",
- P_("Style"),
- P_("The style of the widget, which contains information about how it will look (colors etc)"),
- GTK_TYPE_STYLE,
- GTK_PARAM_READWRITE|G_PARAM_DEPRECATED);
-
-G_GNUC_END_IGNORE_DEPRECATIONS
-
widget_props[PROP_EVENTS] =
g_param_spec_flags ("events",
P_("Events"),
@@ -1850,37 +1827,6 @@ G_GNUC_END_IGNORE_DEPRECATIONS
GTK_TYPE_WIDGET);
/**
- * GtkWidget::style-set:
- * @widget: the object on which the signal is emitted
- * @previous_style: (allow-none): the previous style, or %NULL if the widget
- * just got its initial style
- *
- * The ::style-set signal is emitted when a new style has been set
- * on a widget. Note that style-modifying functions like
- * gtk_widget_modify_base() also cause this signal to be emitted.
- *
- * Note that this signal is emitted for changes to the deprecated
- * #GtkStyle. To track changes to the #GtkStyleContext associated
- * with a widget, use the #GtkWidget::style-updated signal.
- *
- * Deprecated:3.0: Use the #GtkWidget::style-updated signal
- */
-
-G_GNUC_BEGIN_IGNORE_DEPRECATIONS
-
- widget_signals[STYLE_SET] =
- g_signal_new (I_("style-set"),
- G_TYPE_FROM_CLASS (gobject_class),
- G_SIGNAL_RUN_FIRST | G_SIGNAL_DEPRECATED,
- G_STRUCT_OFFSET (GtkWidgetClass, style_set),
- NULL, NULL,
- NULL,
- G_TYPE_NONE, 1,
- GTK_TYPE_STYLE);
-
-G_GNUC_END_IGNORE_DEPRECATIONS
-
- /**
* GtkWidget::style-updated:
* @widget: the object on which the signal is emitted
*
@@ -3736,11 +3682,6 @@ gtk_widget_set_property (GObject *object,
case PROP_RECEIVES_DEFAULT:
gtk_widget_set_receives_default (widget, g_value_get_boolean (value));
break;
- case PROP_STYLE:
- G_GNUC_BEGIN_IGNORE_DEPRECATIONS;
- gtk_widget_set_style (widget, g_value_get_object (value));
- G_GNUC_END_IGNORE_DEPRECATIONS;
- break;
case PROP_EVENTS:
if (!_gtk_widget_get_realized (widget) && _gtk_widget_get_has_window (widget))
gtk_widget_set_events (widget, g_value_get_flags (value));
@@ -3931,11 +3872,6 @@ gtk_widget_get_property (GObject *object,
case PROP_COMPOSITE_CHILD:
g_value_set_boolean (value, widget->priv->composite_child);
break;
- case PROP_STYLE:
- G_GNUC_BEGIN_IGNORE_DEPRECATIONS;
- g_value_set_object (value, gtk_widget_get_style (widget));
- G_GNUC_END_IGNORE_DEPRECATIONS;
- break;
case PROP_EVENTS:
eventp = g_object_get_qdata (G_OBJECT (widget), quark_event_mask);
g_value_set_flags (value, GPOINTER_TO_INT (eventp));
@@ -4406,11 +4342,6 @@ gtk_widget_init (GTypeInstance *instance, gpointer g_class)
/* need to set correct type here, and only class has the correct type here */
gtk_css_node_set_widget_type (priv->cssnode, G_TYPE_FROM_CLASS (g_class));
gtk_css_node_set_name (priv->cssnode, GTK_WIDGET_CLASS (g_class)->priv->css_name);
-
- G_GNUC_BEGIN_IGNORE_DEPRECATIONS;
- priv->style = gtk_widget_get_default_style ();
- G_GNUC_END_IGNORE_DEPRECATIONS;
- g_object_ref (priv->style);
}
@@ -5444,10 +5375,6 @@ gtk_widget_realize (GtkWidget *widget)
if (priv->parent && !_gtk_widget_get_realized (priv->parent))
gtk_widget_realize (priv->parent);
- G_GNUC_BEGIN_IGNORE_DEPRECATIONS
- gtk_widget_ensure_style (widget);
- G_GNUC_END_IGNORE_DEPRECATIONS
-
g_signal_emit (widget, widget_signals[REALIZE], 0);
gtk_widget_real_set_has_tooltip (widget, gtk_widget_get_has_tooltip (widget), TRUE);
@@ -8144,8 +8071,6 @@ gtk_widget_real_state_flags_changed (GtkWidget *widget,
static void
gtk_widget_real_style_updated (GtkWidget *widget)
{
- GtkWidgetPrivate *priv = widget->priv;
-
gtk_widget_update_alpha (widget);
if (widget->priv->context)
@@ -8176,21 +8101,6 @@ gtk_widget_real_style_updated (GtkWidget *widget)
if (widget->priv->anchored)
gtk_widget_queue_resize (widget);
}
-
- G_GNUC_BEGIN_IGNORE_DEPRECATIONS;
- if (priv->style != NULL &&
- priv->style != gtk_widget_get_default_style ())
- {
- /* Trigger ::style-set for old
- * widgets not listening to this
- */
- g_signal_emit (widget,
- widget_signals[STYLE_SET],
- 0,
- widget->priv->style);
- }
- G_GNUC_END_IGNORE_DEPRECATIONS;
-
}
static gboolean
@@ -9830,12 +9740,6 @@ gtk_widget_real_direction_changed (GtkWidget *widget,
gtk_widget_queue_resize (widget);
}
-static void
-gtk_widget_real_style_set (GtkWidget *widget,
- GtkStyle *previous_style)
-{
-}
-
typedef struct {
GtkWidget *previous_toplevel;
GdkScreen *previous_screen;
@@ -12128,13 +12032,6 @@ gtk_widget_real_destroy (GtkWidget *object)
gtk_grab_remove (widget);
destroy_tick_callbacks (widget);
-
- G_GNUC_BEGIN_IGNORE_DEPRECATIONS;
- if (priv->style)
- g_object_unref (priv->style);
- priv->style = gtk_widget_get_default_style ();
- g_object_ref (priv->style);
- G_GNUC_END_IGNORE_DEPRECATIONS;
}
static void
@@ -12146,8 +12043,6 @@ gtk_widget_finalize (GObject *object)
gtk_grab_remove (widget);
- g_clear_object (&priv->style);
-
g_free (priv->name);
g_clear_object (&priv->accessible);
@@ -16496,20 +16391,6 @@ gtk_widget_get_modifier_mask (GtkWidget *widget,
intent);
}
-GtkStyle *
-_gtk_widget_get_style (GtkWidget *widget)
-{
- return widget->priv->style;
-}
-
-void
-_gtk_widget_set_style (GtkWidget *widget,
- GtkStyle *style)
-{
- g_signal_emit (widget, widget_signals[STYLE_SET], 0, widget->priv->style);
- widget->priv->style = style;
-}
-
GtkActionMuxer *
_gtk_widget_get_parent_muxer (GtkWidget *widget,
gboolean create)
diff --git a/gtk/gtkwidget.h b/gtk/gtkwidget.h
index 65a832d858..8d546cc02e 100644
--- a/gtk/gtkwidget.h
+++ b/gtk/gtkwidget.h
@@ -391,8 +391,6 @@ struct _GtkWidgetClass
GtkWidget *previous_parent);
void (* hierarchy_changed) (GtkWidget *widget,
GtkWidget *previous_toplevel);
- void (* style_set) (GtkWidget *widget,
- GtkStyle *previous_style);
void (* direction_changed) (GtkWidget *widget,
GtkTextDirection previous_direction);
void (* grab_notify) (GtkWidget *widget,
diff --git a/gtk/gtkwidgetprivate.h b/gtk/gtkwidgetprivate.h
index 4e26280c74..ea5dcd7c1d 100644
--- a/gtk/gtkwidgetprivate.h
+++ b/gtk/gtkwidgetprivate.h
@@ -132,7 +132,6 @@ struct _GtkWidgetPrivate
* along with graphics contexts used to draw with and
* the font to use for text.
*/
- GtkStyle *style;
GtkCssNode *cssnode;
GtkStyleContext *context;
@@ -248,9 +247,6 @@ void _gtk_widget_buildable_finish_accelerator (GtkWidget *widget,
GtkWidget *toplevel,
gpointer user_data);
GtkStyleContext * _gtk_widget_peek_style_context (GtkWidget *widget);
-GtkStyle * _gtk_widget_get_style (GtkWidget *widget);
-void _gtk_widget_set_style (GtkWidget *widget,
- GtkStyle *style);
gboolean _gtk_widget_supports_clip (GtkWidget *widget);
void _gtk_widget_set_simple_clip (GtkWidget *widget,
GtkAllocation *content_clip);