diff options
author | Matthias Clasen <mclasen@redhat.com> | 2010-11-25 20:39:53 -0500 |
---|---|---|
committer | Carlos Garnacho <carlosg@gnome.org> | 2010-12-04 15:39:47 +0100 |
commit | e598f17871086a233e9bfabae98c56908201e3e3 (patch) | |
tree | 4d19d334708d07eb4804b516897f71745273077c | |
parent | 1915a19503a888e264d1c18ee2e0b10bbaac011a (diff) | |
download | gtk+-e598f17871086a233e9bfabae98c56908201e3e3.tar.gz |
Some header cleanups
Move GtkGradient to their own files, also move GtkBorder out of
gtkstyle.h, so that header can be all deprecated.
-rw-r--r-- | docs/reference/gtk/gtk-docs.sgml | 16 | ||||
-rw-r--r-- | docs/reference/gtk/gtk3-sections.txt | 87 | ||||
-rw-r--r-- | gtk/Makefile.am | 58 | ||||
-rw-r--r-- | gtk/gtk.h | 2 | ||||
-rw-r--r-- | gtk/gtkborder.c | 76 | ||||
-rw-r--r-- | gtk/gtkborder.h | 68 | ||||
-rw-r--r-- | gtk/gtkcssprovider.c | 6 | ||||
-rw-r--r-- | gtk/gtkgradient.c | 282 | ||||
-rw-r--r-- | gtk/gtkgradient.h | 57 | ||||
-rw-r--r-- | gtk/gtksettings.c | 1 | ||||
-rw-r--r-- | gtk/gtkstyle.c | 50 | ||||
-rw-r--r-- | gtk/gtkstyle.h | 26 | ||||
-rw-r--r-- | gtk/gtkstylecontext.c | 4 | ||||
-rw-r--r-- | gtk/gtkstylecontext.h | 14 | ||||
-rw-r--r-- | gtk/gtkstyleproperties.c | 6 | ||||
-rw-r--r-- | gtk/gtkstyleproperties.h | 13 | ||||
-rw-r--r-- | gtk/gtksymboliccolor.c | 262 | ||||
-rw-r--r-- | gtk/gtksymboliccolor.h | 51 | ||||
-rw-r--r-- | gtk/gtkwidget.c | 1 | ||||
-rw-r--r-- | gtk/gtkwidget.h | 1 |
20 files changed, 629 insertions, 452 deletions
diff --git a/docs/reference/gtk/gtk-docs.sgml b/docs/reference/gtk/gtk-docs.sgml index 505531a640..3671b672e9 100644 --- a/docs/reference/gtk/gtk-docs.sgml +++ b/docs/reference/gtk/gtk-docs.sgml @@ -40,14 +40,10 @@ <xi:include href="xml/gtkaccelmap.xml" /> <xi:include href="xml/gtkclipboard.xml" /> <xi:include href="xml/gtkdnd.xml" /> - <xi:include href="xml/gtkicontheme.xml" /> <xi:include href="xml/gtkstock.xml" /> - <xi:include href="xml/gtkiconfactory.xml" /> - <xi:include href="xml/gtkrc.xml" /> <xi:include href="xml/gtksettings.xml" /> <xi:include href="xml/gtkbindings.xml" /> <xi:include href="xml/gtkenums.xml" /> - <xi:include href="xml/gtkstyle.xml" /> <xi:include href="xml/gtkselection.xml" /> <xi:include href="xml/gtktesting.xml" /> <xi:include href="xml/filesystem.xml" /> @@ -55,12 +51,18 @@ <part id="theming"> <title>Theming in GTK+</title> - <xi:include href="xml/gtkwidgetpath.xml" /> - <xi:include href="xml/gtkstyleprovider.xml" /> - <xi:include href="xml/gtkstyleproperties.xml" /> <xi:include href="xml/gtkstylecontext.xml" /> <xi:include href="xml/gtkcssprovider.xml" /> + <xi:include href="xml/gtkstyleprovider.xml" /> + <xi:include href="xml/gtkstyleproperties.xml" /> <xi:include href="xml/gtkthemingengine.xml" /> + <xi:include href="xml/gtkwidgetpath.xml" /> + <xi:include href="xml/gtksymboliccolor.xml" /> + <xi:include href="xml/gtkgradient.xml" /> + <xi:include href="xml/gtkicontheme.xml" /> + <xi:include href="xml/gtkiconfactory.xml" /> + <xi:include href="xml/gtkrc.xml" /> + <xi:include href="xml/gtkstyle.xml" /> </part> <part id="gtkobjects"> diff --git a/docs/reference/gtk/gtk3-sections.txt b/docs/reference/gtk/gtk3-sections.txt index f17596ae6c..71202082f0 100644 --- a/docs/reference/gtk/gtk3-sections.txt +++ b/docs/reference/gtk/gtk3-sections.txt @@ -5315,33 +5315,6 @@ gtk_style_provider_get_type </SECTION> <SECTION> -<FILE>gtksymboliccolor</FILE> -<TITLE>GtkSymbolicColor</TITLE> -GtkSymbolicColor -GtkGradient -gtk_symbolic_color_new_literal -gtk_symbolic_color_new_mix -gtk_symbolic_color_new_name -gtk_symbolic_color_new_shade -gtk_symbolic_color_new_alpha -gtk_symbolic_color_resolve -gtk_symbolic_color_ref -gtk_symbolic_color_unref -gtk_gradient_new_linear -gtk_gradient_new_radial -gtk_gradient_add_color_stop -gtk_gradient_resolve -gtk_gradient_ref -gtk_gradient_unref -<SUBSECTION Standard> -GTK_TYPE_GRADIENT -GTK_TYPE_SYMBOLIC_COLOR -<SUBSECTION Private> -gtk_symbolic_color_get_type -gtk_gradient_get_type -</SECTION> - -<SECTION> <FILE>gtkstyleproperties</FILE> <TITLE>GtkStyleProperties</TITLE> GtkStyleProperties @@ -5446,9 +5419,12 @@ gtk_style_context_has_region gtk_style_context_list_regions gtk_style_context_set_screen gtk_style_context_set_state -gtk_style_context_state_transition_start -gtk_style_context_state_transition_stop -gtk_style_context_state_transition_update + +<SUBSECTION> +GtkBorder +gtk_border_new +gtk_border_copy +gtk_border_free <SUBSECTION> gtk_render_arrow @@ -5474,8 +5450,11 @@ GTK_STYLE_CONTEXT_CLASS GTK_STYLE_CONTEXT_GET_CLASS GTK_IS_STYLE_CONTEXT GTK_IS_STYLE_CONTEXT_CLASS +GTK_TYPE_BORDER + <SUBSECTION Private> gtk_style_context_get_type +gtk_border_get_type </SECTION> <SECTION> @@ -5532,6 +5511,43 @@ gtk_theming_engine_get_type </SECTION> <SECTION> +<FILE>gtksymboliccolor</FILE> +<TITLE>GtkSymbolicColor</TITLE> +GtkSymbolicColor +gtk_symbolic_color_new_literal +gtk_symbolic_color_new_name +gtk_symbolic_color_new_shade +gtk_symbolic_color_new_alpha +gtk_symbolic_color_new_mix +gtk_symbolic_color_ref +gtk_symbolic_color_unref +gtk_symbolic_color_resolve + +<SUBSECTION Standard> +GTK_TYPE_SYMBOLIC_COLOR + +<SUBSECTION Private> +gtk_symbolic_color_get_type +</SECTION> + +<SECTION> +<FILE>gtkgradient</FILE> +<TITLE>GtkGradient</TITLE> +GtkGradient +gtk_gradient_new_linear +gtk_gradient_new_radial +gtk_gradient_add_color_stop +gtk_gradient_ref +gtk_gradient_unref +gtk_gradient_resolve + +<SUBSECTION Standard> +GTK_TYPE_GRADIENT + +gtk_gradient_get_type +</SECTION> + +<SECTION> <FILE>gtkstyle</FILE> <TITLE>GtkStyle</TITLE> GTK_STYLE_ATTACHED @@ -5571,12 +5587,6 @@ gtk_paint_resize_grip gtk_draw_insertion_cursor <SUBSECTION> -GtkBorder -gtk_border_new -gtk_border_copy -gtk_border_free - -<SUBSECTION> GtkRcProperty GtkRcPropertyParser @@ -5588,10 +5598,8 @@ GTK_TYPE_STYLE GTK_STYLE_CLASS GTK_IS_STYLE_CLASS GTK_STYLE_GET_CLASS -GTK_TYPE_BORDER -<SUBSECTION Private> + gtk_style_get_type -gtk_border_get_type GtkThemeEngine </SECTION> @@ -6012,6 +6020,7 @@ gtk_icon_info_get_builtin_pixbuf gtk_icon_info_load_icon gtk_icon_info_load_symbolic gtk_icon_info_load_symbolic_for_style +gtk_icon_info_load_symbolic_for_context gtk_icon_info_set_raw_coordinates gtk_icon_info_get_embedded_rect gtk_icon_info_get_attach_points diff --git a/gtk/Makefile.am b/gtk/Makefile.am index 14bde8ccfd..e69d29337c 100644 --- a/gtk/Makefile.am +++ b/gtk/Makefile.am @@ -167,6 +167,7 @@ gtk_public_h_sources = \ gtkbbox.h \ gtkbin.h \ gtkbindings.h \ + gtkborder.h \ gtkbox.h \ gtkbuilder.h \ gtkbuildable.h \ @@ -179,7 +180,7 @@ gtk_public_h_sources = \ gtkcellrenderercombo.h \ gtkcellrendererpixbuf.h \ gtkcellrendererprogress.h \ - gtkcellrendererspin.h \ + gtkcellrendererspin.h \ gtkcellrendererspinner.h\ gtkcellrenderertext.h \ gtkcellrenderertoggle.h \ @@ -194,26 +195,27 @@ gtk_public_h_sources = \ gtkcomboboxtext.h \ gtkcontainer.h \ gtkcssprovider.h \ - gtkdebug.h \ + gtkdebug.h \ gtkdialog.h \ gtkdnd.h \ gtkdrawingarea.h \ - gtkeditable.h \ + gtkeditable.h \ gtkentry.h \ gtkentrybuffer.h \ gtkentrycompletion.h \ gtkenums.h \ gtkeventbox.h \ gtkexpander.h \ - gtkfilechooser.h \ - gtkfilechooserbutton.h \ - gtkfilechooserdialog.h \ - gtkfilechooserwidget.h \ + gtkfilechooser.h \ + gtkfilechooserbutton.h \ + gtkfilechooserdialog.h \ + gtkfilechooserwidget.h \ gtkfilefilter.h \ gtkfixed.h \ gtkfontbutton.h \ gtkfontsel.h \ gtkframe.h \ + gtkgradient.h \ gtkgrid.h \ gtkhandlebox.h \ gtkhbbox.h \ @@ -235,7 +237,7 @@ gtk_public_h_sources = \ gtkinfobar.h \ gtkinvisible.h \ gtklabel.h \ - gtklayout.h \ + gtklayout.h \ gtklinkbutton.h \ gtkliststore.h \ gtkmain.h \ @@ -247,7 +249,7 @@ gtk_public_h_sources = \ gtkmessagedialog.h \ gtkmisc.h \ gtkmodules.h \ - gtkmountoperation.h \ + gtkmountoperation.h \ gtknotebook.h \ gtkoffscreenwindow.h \ gtkorientable.h \ @@ -257,7 +259,7 @@ gtk_public_h_sources = \ gtkplug.h \ gtkprintcontext.h \ gtkprintoperation.h \ - gtkprintoperationpreview.h \ + gtkprintoperationpreview.h \ gtkprintsettings.h \ gtkprogressbar.h \ gtkradioaction.h \ @@ -269,13 +271,13 @@ gtk_public_h_sources = \ gtkrecentaction.h \ gtkrecentchooser.h \ gtkrecentchooserdialog.h \ - gtkrecentchoosermenu.h \ + gtkrecentchoosermenu.h \ gtkrecentchooserwidget.h \ - gtkrecentfilter.h \ + gtkrecentfilter.h \ gtkrecentmanager.h \ gtkscale.h \ gtkscalebutton.h \ - gtkscrollable.h \ + gtkscrollable.h \ gtkscrollbar.h \ gtkscrolledwindow.h \ gtkselection.h \ @@ -299,7 +301,7 @@ gtk_public_h_sources = \ gtkswitch.h \ gtksymboliccolor.h \ gtktable.h \ - gtktearoffmenuitem.h \ + gtktearoffmenuitem.h \ gtktestutils.h \ gtktextbuffer.h \ gtktextbufferrichtext.h \ @@ -461,6 +463,7 @@ gtk_base_c_sources = \ gtkbbox.c \ gtkbin.c \ gtkbindings.c \ + gtkborder.c \ gtkbox.c \ gtkbuildable.c \ gtkbuilder.c \ @@ -490,7 +493,7 @@ gtk_base_c_sources = \ gtkcssprovider.c \ gtkdialog.c \ gtkdrawingarea.c \ - gtkeditable.c \ + gtkeditable.c \ gtkentry.c \ gtkentrybuffer.c \ gtkentrycompletion.c \ @@ -508,9 +511,10 @@ gtk_base_c_sources = \ gtkfilesystem.c \ gtkfilesystemmodel.c \ gtkfixed.c \ - gtkfontbutton.c \ - gtkfontsel.c \ + gtkfontbutton.c \ + gtkfontsel.c \ gtkframe.c \ + gtkgradient.c \ gtkgrid.c \ gtkhandlebox.c \ gtkhbbox.c \ @@ -549,7 +553,7 @@ gtk_base_c_sources = \ gtkmisc.c \ gtkmnemonichash.c \ gtkmodules.c \ - gtkmountoperation.c \ + gtkmountoperation.c \ gtknotebook.c \ gtkoffscreenwindow.c \ gtkorientable.c \ @@ -561,7 +565,7 @@ gtk_base_c_sources = \ gtkplug.c \ gtkprintcontext.c \ gtkprintoperation.c \ - gtkprintoperationpreview.c \ + gtkprintoperationpreview.c \ gtkprintsettings.c \ gtkprintutils.c \ gtkprogressbar.c \ @@ -570,20 +574,20 @@ gtk_base_c_sources = \ gtkradiomenuitem.c \ gtkradiotoolbutton.c \ gtkrange.c \ - gtkrbtree.c \ + gtkrbtree.c \ gtkrc.c \ gtkrecentaction.c \ gtkrecentchooserdefault.c \ - gtkrecentchooserdialog.c \ - gtkrecentchoosermenu.c \ - gtkrecentchooserwidget.c \ + gtkrecentchooserdialog.c\ + gtkrecentchoosermenu.c \ + gtkrecentchooserwidget.c\ gtkrecentchooserutils.c \ gtkrecentchooser.c \ gtkrecentfilter.c \ gtkrecentmanager.c \ gtkscale.c \ gtkscalebutton.c \ - gtkscrollable.c \ + gtkscrollable.c \ gtkscrollbar.c \ gtkscrolledwindow.c \ gtkselection.c \ @@ -607,7 +611,7 @@ gtk_base_c_sources = \ gtkswitch.c \ gtksymboliccolor.c \ gtktable.c \ - gtktearoffmenuitem.c \ + gtktearoffmenuitem.c \ gtktestutils.c \ gtktextbtree.c \ gtktextbuffer.c \ @@ -633,7 +637,7 @@ gtk_base_c_sources = \ gtktoolbar.c \ gtktoolbutton.c \ gtktoolitem.c \ - gtktoolitemgroup.c \ + gtktoolitemgroup.c \ gtktoolpalette.c \ gtktoolshell.c \ gtktooltip.c \ @@ -660,7 +664,7 @@ gtk_base_c_sources = \ gtkvseparator.c \ gtkwidget.c \ gtkwidgetpath.c \ - gtkwindow-decorate.c \ + gtkwindow-decorate.c \ gtkwindow.c \ $(gtk_clipboard_dnd_c_sources) \ $(gtk_appchooser_impl_c_sources) @@ -51,6 +51,7 @@ #include <gtk/gtkbbox.h> #include <gtk/gtkbin.h> #include <gtk/gtkbindings.h> +#include <gtk/gtkborder.h> #include <gtk/gtkbox.h> #include <gtk/gtkbuildable.h> #include <gtk/gtkbuilder.h> @@ -98,6 +99,7 @@ #include <gtk/gtkfontbutton.h> #include <gtk/gtkfontsel.h> #include <gtk/gtkframe.h> +#include <gtk/gtkgradient.h> #include <gtk/gtkgrid.h> #include <gtk/gtkhandlebox.h> #include <gtk/gtkhbbox.h> diff --git a/gtk/gtkborder.c b/gtk/gtkborder.c new file mode 100644 index 0000000000..6ea466a405 --- /dev/null +++ b/gtk/gtkborder.c @@ -0,0 +1,76 @@ +/* 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, write to the + * Free Software Foundation, Inc., 59 Temple Place - Suite 330, + * Boston, MA 02111-1307, USA. + */ + +/* + * 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 "gtkborder.h" + +/** + * gtk_border_new: + * + * Allocates a new #GtkBorder structure and initializes its elements to zero. + * + * Returns: a newly allocated #GtkBorder. Free with gtk_border_free() + * + * Since: 2.14 + */ +GtkBorder * +gtk_border_new (void) +{ + return g_slice_new0 (GtkBorder); +} + +/** + * gtk_border_copy: + * @border_: a #GtkBorder + * + * Copies a #GtkBorder structure. + * + * Returns: a copy of @border_. + */ +GtkBorder * +gtk_border_copy (const GtkBorder *border_) +{ + g_return_val_if_fail (border_ != NULL, NULL); + + return g_slice_dup (GtkBorder, border_); +} + +/** + * gtk_border_free: + * @border_: a #GtkBorder + * + * Frees a #GtkBorder structure. + */ +void +gtk_border_free (GtkBorder *border_) +{ + g_slice_free (GtkBorder, border_); +} + +G_DEFINE_BOXED_TYPE (GtkBorder, gtk_border, + gtk_border_copy, + gtk_border_free) diff --git a/gtk/gtkborder.h b/gtk/gtkborder.h new file mode 100644 index 0000000000..51a5b7bfd6 --- /dev/null +++ b/gtk/gtkborder.h @@ -0,0 +1,68 @@ +/* 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, write to the + * Free Software Foundation, Inc., 59 Temple Place - Suite 330, + * Boston, MA 02111-1307, USA. + */ + +/* + * 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/. + */ + +#if !defined (__GTK_H_INSIDE__) && !defined (GTK_COMPILATION) +#error "Only <gtk/gtk.h> can be included directly." +#endif + +#ifndef __GTK_BORDER_H__ +#define __GTK_BORDER_H__ + +#include <glib-object.h> + +G_BEGIN_DECLS + +typedef struct _GtkBorder GtkBorder; + +#define GTK_TYPE_BORDER (gtk_border_get_type ()) + +/** + * GtkBorder: + * @left: The width of the left border. + * @right: The width of the right border. + * @top: The width of the top border. + * @bottom: The width of the bottom border. + * + * A struct that specifies a border around a rectangular area that can + * be of different width on each side. + */ +struct _GtkBorder +{ + gint16 left; + gint16 right; + gint16 top; + gint16 bottom; +}; + +GType gtk_border_get_type (void) G_GNUC_CONST; +GtkBorder *gtk_border_new (void) G_GNUC_MALLOC; +GtkBorder *gtk_border_copy (const GtkBorder *border_); +void gtk_border_free (GtkBorder *border_); + + +G_END_DECLS + +#endif /* __GTK_BORDER_H__ */ diff --git a/gtk/gtkcssprovider.c b/gtk/gtkcssprovider.c index b2fde3981c..76fd8665ae 100644 --- a/gtk/gtkcssprovider.c +++ b/gtk/gtkcssprovider.c @@ -36,9 +36,9 @@ * @Title: GtkCssProvider * @See_also: #GtkStyleContext, #GtkStyleProvider * - * #GtkCssProvider is an object implementing #GtkStyleProvider, it is able - * to parse <ulink url="http://www.w3.org/TR/CSS2">CSS</ulink>-like input - * in order to style widgets. + * GtkCssProvider is an object implementing the #GtkStyleProvider interface. + * It is able to parse <ulink url="http://www.w3.org/TR/CSS2">CSS</ulink>-like + * input in order to style widgets. * * <refsect2 id="gtkcssprovider-files"> * <title>Default files</title> diff --git a/gtk/gtkgradient.c b/gtk/gtkgradient.c new file mode 100644 index 0000000000..a19b8fe583 --- /dev/null +++ b/gtk/gtkgradient.c @@ -0,0 +1,282 @@ +/* GTK - The GIMP Toolkit + * Copyright (C) 2010 Carlos Garnacho <carlosg@gnome.org> + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the + * Free Software Foundation, Inc., 59 Temple Place - Suite 330, + * Boston, MA 02111-1307, USA. + */ + +#include "config.h" +#include "gtkgradient.h" +#include "gtkstyleproperties.h" +#include "gtkintl.h" + +/** + * SECTION:gtkgradient + * @Short_description: Gradients + * @Title: GtkGradient + * + * GtkGradient is a boxed type that represents a gradient. + * It is the result of parsing a + * <link linkend="gtkcssprovider-gradients">gradient expression</link>. + * To obtain the gradient represented by a GtkGradient, it has to + * be resolved with gtk_gradient_resolve(), which replaces all + * symbolic color references by the colors they refer to (in a given + * context) and constructs a #cairo_pattern_t value. + * + * It is not normally necessary to deal directly with #GtkGradients, + * since they are mostly used behind the scenes by #GtkStyleContext and + * #GtkCssProvider. + */ + +G_DEFINE_BOXED_TYPE (GtkGradient, gtk_gradient, + gtk_gradient_ref, gtk_gradient_unref) + +typedef struct ColorStop ColorStop; + +struct ColorStop +{ + gdouble offset; + GtkSymbolicColor *color; +}; + +struct _GtkGradient +{ + gdouble x0; + gdouble y0; + gdouble x1; + gdouble y1; + gdouble radius0; + gdouble radius1; + + GArray *stops; + + guint ref_count; +}; + +/** + * gtk_gradient_new_linear: + * @x0: X coordinate of the starting point + * @y0: Y coordinate of the starting point + * @x1: X coordinate of the end point + * @y1: Y coordinate of the end point + * + * Creates a new linear gradient along the line defined by (x0, y0) and (x1, y1). Before using the gradient + * a number of stop colors must be added through gtk_gradient_add_color_stop(). + * + * Returns: A newly created #GtkGradient + * + * Since: 3.0 + **/ +GtkGradient * +gtk_gradient_new_linear (gdouble x0, + gdouble y0, + gdouble x1, + gdouble y1) +{ + GtkGradient *gradient; + + gradient = g_slice_new (GtkGradient); + gradient->stops = g_array_new (FALSE, FALSE, sizeof (ColorStop)); + + gradient->x0 = x0; + gradient->y0 = y0; + gradient->x1 = x1; + gradient->y1 = y1; + gradient->radius0 = 0; + gradient->radius1 = 0; + + gradient->ref_count = 1; + + return gradient; +} + +/** + * gtk_gradient_new_radial: + * @x0: X coordinate of the start circle + * @y0: Y coordinate of the start circle + * @radius0: radius of the start circle + * @x1: X coordinate of the end circle + * @y1: Y coordinate of the end circle + * @radius1: radius of the end circle + * + * Creates a new radial gradient along the two circles defined by (x0, y0, radius0) and + * (x1, y1, radius1). Before using the gradient a number of stop colors must be added + * through gtk_gradient_add_color_stop(). + * + * Returns: A newly created #GtkGradient + * + * Since: 3.0 + **/ +GtkGradient * +gtk_gradient_new_radial (gdouble x0, + gdouble y0, + gdouble radius0, + gdouble x1, + gdouble y1, + gdouble radius1) +{ + GtkGradient *gradient; + + gradient = g_slice_new (GtkGradient); + gradient->stops = g_array_new (FALSE, FALSE, sizeof (ColorStop)); + + gradient->x0 = x0; + gradient->y0 = y0; + gradient->x1 = x1; + gradient->y1 = y1; + gradient->radius0 = radius0; + gradient->radius1 = radius1; + + gradient->ref_count = 1; + + return gradient; +} + +/** + * gtk_gradient_add_color_stop: + * @gradient: a #GtkGradient + * @offset: offset for the color stop + * @color: color to use + * + * Adds a stop color to @gradient. + * + * Since: 3.0 + **/ +void +gtk_gradient_add_color_stop (GtkGradient *gradient, + gdouble offset, + GtkSymbolicColor *color) +{ + ColorStop stop; + + g_return_if_fail (gradient != NULL); + + stop.offset = offset; + stop.color = gtk_symbolic_color_ref (color); + + g_array_append_val (gradient->stops, stop); +} + +/** + * gtk_gradient_ref: + * @gradient: a #GtkGradient + * + * Increases the reference count of @gradient. + * + * Returns: The same @gradient + * + * Since: 3.0 + **/ +GtkGradient * +gtk_gradient_ref (GtkGradient *gradient) +{ + g_return_val_if_fail (gradient != NULL, NULL); + + gradient->ref_count++; + + return gradient; +} + +/** + * gtk_gradient_unref: + * @gradient: a #GtkGradient + * + * Decreases the reference count of @gradient, freeing its memory + * if the reference count reaches 0. + * + * Since: 3.0 + **/ +void +gtk_gradient_unref (GtkGradient *gradient) +{ + g_return_if_fail (gradient != NULL); + + gradient->ref_count--; + + if (gradient->ref_count == 0) + { + guint i; + + for (i = 0; i < gradient->stops->len; i++) + { + ColorStop *stop; + + stop = &g_array_index (gradient->stops, ColorStop, i); + gtk_symbolic_color_unref (stop->color); + } + + g_array_free (gradient->stops, TRUE); + g_slice_free (GtkGradient, gradient); + } +} + +/** + * gtk_gradient_resolve: + * @gradient: a #GtkGradient + * @props: #GtkStyleProperties to use when resolving named colors + * @resolved_gradient: (out): return location for the resolved pattern + * + * If @gradient is resolvable, @resolved_gradient will be filled in + * with the resolved gradient as a cairo_pattern_t, and %TRUE will + * be returned. Generally, if @gradient can't be resolved, it is + * due to it being defined on top of a named color that doesn't + * exist in @props. + * + * Returns: %TRUE if the gradient has been resolved + * + * Since: 3.0 + **/ +gboolean +gtk_gradient_resolve (GtkGradient *gradient, + GtkStyleProperties *props, + cairo_pattern_t **resolved_gradient) +{ + cairo_pattern_t *pattern; + guint i; + + g_return_val_if_fail (gradient != NULL, FALSE); + g_return_val_if_fail (GTK_IS_STYLE_PROPERTIES (props), FALSE); + g_return_val_if_fail (resolved_gradient != NULL, FALSE); + + if (gradient->radius0 == 0 && gradient->radius1 == 0) + pattern = cairo_pattern_create_linear (gradient->x0, gradient->y0, + gradient->x1, gradient->y1); + else + pattern = cairo_pattern_create_radial (gradient->x0, gradient->y0, + gradient->radius0, + gradient->x1, gradient->y1, + gradient->radius1); + + for (i = 0; i < gradient->stops->len; i++) + { + ColorStop *stop; + GdkRGBA color; + + stop = &g_array_index (gradient->stops, ColorStop, i); + + if (!gtk_symbolic_color_resolve (stop->color, props, &color)) + { + cairo_pattern_destroy (pattern); + return FALSE; + } + + cairo_pattern_add_color_stop_rgba (pattern, stop->offset, + color.red, color.green, + color.blue, color.alpha); + } + + *resolved_gradient = pattern; + return TRUE; +} diff --git a/gtk/gtkgradient.h b/gtk/gtkgradient.h new file mode 100644 index 0000000000..3e6b70fc78 --- /dev/null +++ b/gtk/gtkgradient.h @@ -0,0 +1,57 @@ +/* GTK - The GIMP Toolkit + * Copyright (C) 2010 Carlos Garnacho <carlosg@gnome.org> + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the + * Free Software Foundation, Inc., 59 Temple Place - Suite 330, + * Boston, MA 02111-1307, USA. + */ + +#ifndef __GTK_GRADIENT_H__ +#define __GTK_GRADIENT_H__ + +#include <gdk/gdk.h> +#include <gtk/gtkstyleproperties.h> +#include <gtk/gtksymboliccolor.h> + +G_BEGIN_DECLS + +#define GTK_TYPE_GRADIENT (gtk_gradient_get_type ()) + +GType gtk_gradient_get_type (void) G_GNUC_CONST; + +GtkGradient * gtk_gradient_new_linear (gdouble x0, + gdouble y0, + gdouble x1, + gdouble y1); +GtkGradient * gtk_gradient_new_radial (gdouble x0, + gdouble y0, + gdouble radius0, + gdouble x1, + gdouble y1, + gdouble radius1); + +void gtk_gradient_add_color_stop (GtkGradient *gradient, + gdouble offset, + GtkSymbolicColor *color); + +GtkGradient * gtk_gradient_ref (GtkGradient *gradient); +void gtk_gradient_unref (GtkGradient *gradient); + +gboolean gtk_gradient_resolve (GtkGradient *gradient, + GtkStyleProperties *props, + cairo_pattern_t **resolved_gradient); + +G_END_DECLS + +#endif /* __GTK_GRADIENT_H__ */ diff --git a/gtk/gtksettings.c b/gtk/gtksettings.c index 8b70038827..58fd2c1f4d 100644 --- a/gtk/gtksettings.c +++ b/gtk/gtksettings.c @@ -31,6 +31,7 @@ #include "gtktypeutils.h" #include "gtkprivate.h" #include "gtkcssprovider.h" +#include "gtksymboliccolor.h" #include "gtkversion.h" #ifdef GDK_WINDOWING_X11 diff --git a/gtk/gtkstyle.c b/gtk/gtkstyle.c index 3c8cdc5d9a..a59f1e4bb4 100644 --- a/gtk/gtkstyle.c +++ b/gtk/gtkstyle.c @@ -41,6 +41,7 @@ #include "gtkintl.h" #include "gtkdebug.h" #include "gtkspinner.h" +#include "gtkborder.h" /** @@ -60,7 +61,9 @@ * Usually applications should not need to use or modify the #GtkStyle of their * widgets. * + * <warning> * In GTK+ 3.0, GtkStyle has been deprecated and replaced by #GtkStyleContext. + * </warning> */ @@ -4576,53 +4579,6 @@ gtk_paint_spinner (GtkStyle *style, cairo_restore (cr); } -/** - * gtk_border_new: - * - * Allocates a new #GtkBorder structure and initializes its elements to zero. - * - * Returns: a new empty #GtkBorder. The newly allocated #GtkBorder should be - * freed with gtk_border_free() - * - * Since: 2.14 - **/ -GtkBorder * -gtk_border_new (void) -{ - return g_slice_new0 (GtkBorder); -} - -/** - * gtk_border_copy: - * @border_: a #GtkBorder. - * @returns: a copy of @border_. - * - * Copies a #GtkBorder structure. - **/ -GtkBorder * -gtk_border_copy (const GtkBorder *border) -{ - g_return_val_if_fail (border != NULL, NULL); - - return g_slice_dup (GtkBorder, border); -} - -/** - * gtk_border_free: - * @border_: a #GtkBorder. - * - * Frees a #GtkBorder structure. - **/ -void -gtk_border_free (GtkBorder *border) -{ - g_slice_free (GtkBorder, border); -} - -G_DEFINE_BOXED_TYPE (GtkBorder, gtk_border, - gtk_border_copy, - gtk_border_free) - typedef struct _CursorInfo CursorInfo; struct _CursorInfo diff --git a/gtk/gtkstyle.h b/gtk/gtkstyle.h index 8bd38ec755..3d44b1ffa7 100644 --- a/gtk/gtkstyle.h +++ b/gtk/gtkstyle.h @@ -45,12 +45,9 @@ G_BEGIN_DECLS #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)) -#define GTK_TYPE_BORDER (gtk_border_get_type ()) - /* Some forward declarations needed to rationalize the header * files. */ -typedef struct _GtkBorder GtkBorder; typedef struct _GtkStyle GtkStyle; typedef struct _GtkStyleClass GtkStyleClass; typedef struct _GtkThemeEngine GtkThemeEngine; @@ -383,29 +380,6 @@ struct _GtkStyleClass void (*_gtk_reserved11) (void); }; -/** - * GtkBorder: - * @left: The width of the left border. - * @right: The width of the right border. - * @top: The width of the top border. - * @bottom: The width of the bottom border. - * - * A struct that specifies a border around a rectangular area that can - * be of different width on each side. - */ -struct _GtkBorder -{ - gint16 left; - gint16 right; - gint16 top; - gint16 bottom; -}; - -GType gtk_border_get_type (void) G_GNUC_CONST; -GtkBorder *gtk_border_new (void) G_GNUC_MALLOC; -GtkBorder *gtk_border_copy (const GtkBorder *border_); -void gtk_border_free (GtkBorder *border_); - #if !defined(GTK_DISABLE_DEPRECATED) || defined(GTK_COMPILATION) GType gtk_style_get_type (void) G_GNUC_CONST; diff --git a/gtk/gtkstylecontext.c b/gtk/gtkstylecontext.c index 61d3b7b5cd..190579d892 100644 --- a/gtk/gtkstylecontext.c +++ b/gtk/gtkstylecontext.c @@ -30,14 +30,14 @@ #include "gtkwidget.h" #include "gtkwindow.h" #include "gtkprivate.h" +#include "gtksymboliccolor.h" #include "gtkanimationdescription.h" #include "gtktimeline.h" /** * SECTION:gtkstylecontext - * @Short_description: rendering UI elements + * @Short_description: Rendering UI elements * @Title: GtkStyleContext - * @See_also: * * #GtkStyleContext is an object that stores styling information affecting * a widget defined by #GtkWidgetPath. diff --git a/gtk/gtkstylecontext.h b/gtk/gtkstylecontext.h index 43f38939fd..2868c85a8c 100644 --- a/gtk/gtkstylecontext.h +++ b/gtk/gtkstylecontext.h @@ -430,20 +430,6 @@ void _gtk_style_context_coalesce_animation_areas (GtkStyleContext *c gint rel_x, gint rel_y); -/* Animation for state changes */ -void gtk_style_context_state_transition_start (GtkStyleContext *context, - gpointer identifier, - GtkWidget *widget, - GtkStateType state, - gboolean value, - GdkRectangle *rect); -void gtk_style_context_state_transition_update (GtkStyleContext *context, - gpointer identifier, - GdkRectangle *rect, - GtkStateType state); -void gtk_style_context_state_transition_stop (GtkStyleContext *context, - gpointer identifier); - void gtk_style_context_invalidate (GtkStyleContext *context); void gtk_style_context_reset_widgets (GdkScreen *screen); diff --git a/gtk/gtkstyleproperties.c b/gtk/gtkstyleproperties.c index 5c54b21da8..49c05d9447 100644 --- a/gtk/gtkstyleproperties.c +++ b/gtk/gtkstyleproperties.c @@ -19,16 +19,20 @@ #include "config.h" +#include "gtkstyleproperties.h" + #include <stdlib.h> #include <gobject/gvaluecollector.h> #include <cairo-gobject.h> #include "gtktypebuiltins.h" #include "gtkstyleprovider.h" -#include "gtkstyleproperties.h" +#include "gtksymboliccolor.h" #include "gtkprivate.h" #include "gtkthemingengine.h" #include "gtkanimationdescription.h" +#include "gtkborder.h" +#include "gtkgradient.h" #include "gtk9slice.h" #include "gtkintl.h" diff --git a/gtk/gtkstyleproperties.h b/gtk/gtkstyleproperties.h index c419459976..8a243b7f4f 100644 --- a/gtk/gtkstyleproperties.h +++ b/gtk/gtkstyleproperties.h @@ -22,8 +22,7 @@ #include <glib-object.h> #include <gdk/gdk.h> -#include "gtkenums.h" -#include "gtksymboliccolor.h" +#include <gtk/gtkenums.h> G_BEGIN_DECLS @@ -37,6 +36,9 @@ G_BEGIN_DECLS typedef struct _GtkStyleProperties GtkStyleProperties; typedef struct _GtkStylePropertiesClass GtkStylePropertiesClass; +typedef struct _GtkSymbolicColor GtkSymbolicColor; +typedef struct _GtkGradient GtkGradient; + struct _GtkStyleProperties { GObject parent_object; @@ -101,13 +103,6 @@ void gtk_style_properties_merge (GtkStyleProperties *props, const GtkStyleProperties *props_to_merge, gboolean replace); -gboolean gtk_symbolic_color_resolve (GtkSymbolicColor *color, - GtkStyleProperties *props, - GdkRGBA *resolved_color); -gboolean gtk_gradient_resolve (GtkGradient *gradient, - GtkStyleProperties *props, - cairo_pattern_t **resolved_gradient); - G_END_DECLS #endif /* __GTK_STYLE_PROPERTIES_H__ */ diff --git a/gtk/gtksymboliccolor.c b/gtk/gtksymboliccolor.c index cb5a9191b0..2345cfa396 100644 --- a/gtk/gtksymboliccolor.c +++ b/gtk/gtksymboliccolor.c @@ -22,10 +22,27 @@ #include "gtkstyleproperties.h" #include "gtkintl.h" +/** + * SECTION:gtksymboliccolor + * @Short_description: Symbolic colors + * @Title: GtkSymbolicColor + * + * GtkSymbolicColor is a boxed type that represents a symbolic color. + * It is the result of parsing a + * <link linkend="gtkcssprovider-symbolic-colors">color expression</link>. + * To obtain the color represented by a GtkSymbolicColor, it has to + * be resolved with gtk_symbolic_color_resolve(), which replaces all + * symbolic color references by the colors they refer to (in a given + * context) and evaluates mix, shade and other expressions, resulting + * in a #GdkRGBA value. + * + * It is not normally necessary to deal directly with #GtkSymbolicColors, + * since they are mostly used behind the scenes by #GtkStyleContext and + * #GtkCssProvider. + */ + G_DEFINE_BOXED_TYPE (GtkSymbolicColor, gtk_symbolic_color, - gtk_symbolic_color_ref, gtk_symbolic_color_unref) -G_DEFINE_BOXED_TYPE (GtkGradient, gtk_gradient, - gtk_gradient_ref, gtk_gradient_unref) + gtk_symbolic_color_ref, gtk_symbolic_color_unref) /* Symbolic colors */ typedef enum { @@ -61,28 +78,6 @@ struct _GtkSymbolicColor }; }; -typedef struct ColorStop ColorStop; - -struct ColorStop -{ - gdouble offset; - GtkSymbolicColor *color; -}; - -struct _GtkGradient -{ - gdouble x0; - gdouble y0; - gdouble x1; - gdouble y1; - gdouble radius0; - gdouble radius1; - - GArray *stops; - - guint ref_count; -}; - /** * gtk_symbolic_color_new_literal: * @color: a #GdkRGBA @@ -561,220 +556,3 @@ gtk_symbolic_color_resolve (GtkSymbolicColor *color, return FALSE; } - -/* GtkGradient */ -/** - * gtk_gradient_new_linear: - * @x0: X coordinate of the starting point - * @y0: Y coordinate of the starting point - * @x1: X coordinate of the end point - * @y1: Y coordinate of the end point - * - * Creates a new linear gradient along the line defined by (x0, y0) and (x1, y1). Before using the gradient - * a number of stop colors must be added through gtk_gradient_add_color_stop(). - * - * Returns: A newly created #GtkGradient - * - * Since: 3.0 - **/ -GtkGradient * -gtk_gradient_new_linear (gdouble x0, - gdouble y0, - gdouble x1, - gdouble y1) -{ - GtkGradient *gradient; - - gradient = g_slice_new (GtkGradient); - gradient->stops = g_array_new (FALSE, FALSE, sizeof (ColorStop)); - - gradient->x0 = x0; - gradient->y0 = y0; - gradient->x1 = x1; - gradient->y1 = y1; - gradient->radius0 = 0; - gradient->radius1 = 0; - - gradient->ref_count = 1; - - return gradient; -} - -/** - * gtk_gradient_new_radial: - * @x0: X coordinate of the start circle - * @y0: Y coordinate of the start circle - * @radius0: radius of the start circle - * @x1: X coordinate of the end circle - * @y1: Y coordinate of the end circle - * @radius1: radius of the end circle - * - * Creates a new radial gradient along the two circles defined by (x0, y0, radius0) and - * (x1, y1, radius1). Before using the gradient a number of stop colors must be added - * through gtk_gradient_add_color_stop(). - * - * Returns: A newly created #GtkGradient - * - * Since: 3.0 - **/ -GtkGradient * -gtk_gradient_new_radial (gdouble x0, - gdouble y0, - gdouble radius0, - gdouble x1, - gdouble y1, - gdouble radius1) -{ - GtkGradient *gradient; - - gradient = g_slice_new (GtkGradient); - gradient->stops = g_array_new (FALSE, FALSE, sizeof (ColorStop)); - - gradient->x0 = x0; - gradient->y0 = y0; - gradient->x1 = x1; - gradient->y1 = y1; - gradient->radius0 = radius0; - gradient->radius1 = radius1; - - gradient->ref_count = 1; - - return gradient; -} - -/** - * gtk_gradient_add_color_stop: - * @gradient: a #GtkGradient - * @offset: offset for the color stop - * @color: color to use - * - * Adds a stop color to @gradient. - * - * Since: 3.0 - **/ -void -gtk_gradient_add_color_stop (GtkGradient *gradient, - gdouble offset, - GtkSymbolicColor *color) -{ - ColorStop stop; - - g_return_if_fail (gradient != NULL); - - stop.offset = offset; - stop.color = gtk_symbolic_color_ref (color); - - g_array_append_val (gradient->stops, stop); -} - -/** - * gtk_gradient_ref: - * @gradient: a #GtkGradient - * - * Increases the reference count of @gradient. - * - * Returns: The same @gradient - * - * Since: 3.0 - **/ -GtkGradient * -gtk_gradient_ref (GtkGradient *gradient) -{ - g_return_val_if_fail (gradient != NULL, NULL); - - gradient->ref_count++; - - return gradient; -} - -/** - * gtk_gradient_unref: - * @gradient: a #GtkGradient - * - * Decreases the reference count of @gradient, freeing its memory - * if the reference count reaches 0. - * - * Since: 3.0 - **/ -void -gtk_gradient_unref (GtkGradient *gradient) -{ - g_return_if_fail (gradient != NULL); - - gradient->ref_count--; - - if (gradient->ref_count == 0) - { - guint i; - - for (i = 0; i < gradient->stops->len; i++) - { - ColorStop *stop; - - stop = &g_array_index (gradient->stops, ColorStop, i); - gtk_symbolic_color_unref (stop->color); - } - - g_array_free (gradient->stops, TRUE); - g_slice_free (GtkGradient, gradient); - } -} - -/** - * gtk_gradient_resolve: - * @gradient: a #GtkGradient - * @props: #GtkStyleProperties to use when resolving named colors - * @resolved_gradient: (out): return location for the resolved pattern - * - * If @gradient is resolvable, @resolved_gradient will be filled in - * with the resolved gradient as a cairo_pattern_t, and %TRUE will - * be returned. Generally, if @gradient can't be resolved, it is - * due to it being defined on top of a named color that doesn't - * exist in @props. - * - * Returns: %TRUE if the gradient has been resolved - * - * Since: 3.0 - **/ -gboolean -gtk_gradient_resolve (GtkGradient *gradient, - GtkStyleProperties *props, - cairo_pattern_t **resolved_gradient) -{ - cairo_pattern_t *pattern; - guint i; - - g_return_val_if_fail (gradient != NULL, FALSE); - g_return_val_if_fail (GTK_IS_STYLE_PROPERTIES (props), FALSE); - g_return_val_if_fail (resolved_gradient != NULL, FALSE); - - if (gradient->radius0 == 0 && gradient->radius1 == 0) - pattern = cairo_pattern_create_linear (gradient->x0, gradient->y0, - gradient->x1, gradient->y1); - else - pattern = cairo_pattern_create_radial (gradient->x0, gradient->y0, - gradient->radius0, - gradient->x1, gradient->y1, - gradient->radius1); - - for (i = 0; i < gradient->stops->len; i++) - { - ColorStop *stop; - GdkRGBA color; - - stop = &g_array_index (gradient->stops, ColorStop, i); - - if (!gtk_symbolic_color_resolve (stop->color, props, &color)) - { - cairo_pattern_destroy (pattern); - return FALSE; - } - - cairo_pattern_add_color_stop_rgba (pattern, stop->offset, - color.red, color.green, - color.blue, color.alpha); - } - - *resolved_gradient = pattern; - return TRUE; -} diff --git a/gtk/gtksymboliccolor.h b/gtk/gtksymboliccolor.h index fdcb915fe4..462f086b09 100644 --- a/gtk/gtksymboliccolor.h +++ b/gtk/gtksymboliccolor.h @@ -21,49 +21,30 @@ #define __GTK_SYMBOLIC_COLOR_H__ #include <gdk/gdk.h> +#include <gtk/gtkstyleproperties.h> G_BEGIN_DECLS -/* Dummy typedefs */ -typedef struct _GtkSymbolicColor GtkSymbolicColor; -typedef struct _GtkGradient GtkGradient; - #define GTK_TYPE_SYMBOLIC_COLOR (gtk_symbolic_color_get_type ()) -#define GTK_TYPE_GRADIENT (gtk_gradient_get_type ()) - -GType gtk_symbolic_color_get_type (void) G_GNUC_CONST; -GType gtk_gradient_get_type (void) G_GNUC_CONST; - -GtkSymbolicColor * gtk_symbolic_color_new_literal (const GdkRGBA *color); -GtkSymbolicColor * gtk_symbolic_color_new_name (const gchar *name); -GtkSymbolicColor * gtk_symbolic_color_new_shade (GtkSymbolicColor *color, - gdouble factor); -GtkSymbolicColor * gtk_symbolic_color_new_alpha (GtkSymbolicColor *color, - gdouble factor); -GtkSymbolicColor * gtk_symbolic_color_new_mix (GtkSymbolicColor *color1, - GtkSymbolicColor *color2, - gdouble factor); -GtkSymbolicColor * gtk_symbolic_color_ref (GtkSymbolicColor *color); -void gtk_symbolic_color_unref (GtkSymbolicColor *color); +GType gtk_symbolic_color_get_type (void) G_GNUC_CONST; -GtkGradient * gtk_gradient_new_linear (gdouble x0, - gdouble y0, - gdouble x1, - gdouble y1); -GtkGradient * gtk_gradient_new_radial (gdouble x0, - gdouble y0, - gdouble radius0, - gdouble x1, - gdouble y1, - gdouble radius1); +GtkSymbolicColor * gtk_symbolic_color_new_literal (const GdkRGBA *color); +GtkSymbolicColor * gtk_symbolic_color_new_name (const gchar *name); +GtkSymbolicColor * gtk_symbolic_color_new_shade (GtkSymbolicColor *color, + gdouble factor); +GtkSymbolicColor * gtk_symbolic_color_new_alpha (GtkSymbolicColor *color, + gdouble factor); +GtkSymbolicColor * gtk_symbolic_color_new_mix (GtkSymbolicColor *color1, + GtkSymbolicColor *color2, + gdouble factor); -void gtk_gradient_add_color_stop (GtkGradient *gradient, - gdouble offset, - GtkSymbolicColor *color); +GtkSymbolicColor * gtk_symbolic_color_ref (GtkSymbolicColor *color); +void gtk_symbolic_color_unref (GtkSymbolicColor *color); -GtkGradient * gtk_gradient_ref (GtkGradient *gradient); -void gtk_gradient_unref (GtkGradient *gradient); +gboolean gtk_symbolic_color_resolve (GtkSymbolicColor *color, + GtkStyleProperties *props, + GdkRGBA *resolved_color); G_END_DECLS diff --git a/gtk/gtkwidget.c b/gtk/gtkwidget.c index 324ed3d318..1c0bfee777 100644 --- a/gtk/gtkwidget.c +++ b/gtk/gtkwidget.c @@ -59,6 +59,7 @@ #include "gtkbuilderprivate.h" #include "gtksizerequest.h" #include "gtkstylecontext.h" +#include "gtksymboliccolor.h" #include "gtkcssprovider.h" #include "gtkanimationdescription.h" #include "gtkversion.h" diff --git a/gtk/gtkwidget.h b/gtk/gtkwidget.h index 6240c64338..7f688555df 100644 --- a/gtk/gtkwidget.h +++ b/gtk/gtkwidget.h @@ -35,6 +35,7 @@ #include <gtk/gtkaccelgroup.h> #include <gtk/gtkadjustment.h> #include <gtk/gtkstyle.h> +#include <gtk/gtkborder.h> #include <gtk/gtksettings.h> #include <gtk/gtkstylecontext.h> #include <gtk/gtkwidgetpath.h> |