Commit e598f178 authored by Matthias Clasen's avatar Matthias Clasen Committed by Carlos Garnacho

Some header cleanups

Move GtkGradient to their own files, also move GtkBorder out of
gtkstyle.h, so that header can be all deprecated.
parent 1915a195
......@@ -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">
......
......@@ -5314,33 +5314,6 @@ GTK_STYLE_PROVIDER_GET_IFACE
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>
......@@ -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>
......@@ -5531,6 +5510,43 @@ GTK_TYPE_THEMING_ENGINE
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>
......@@ -5570,12 +5586,6 @@ gtk_paint_layout
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
......
......@@ -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>
......
/* 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)
/* 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__ */
......@@ -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>
......
/* 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