[build] Bumped version to 0.5.3
[adg.git] / adg / adg-style.c
blob04f853ec99813e3832d5b7cf9f909519f2373ce4
1 /* ADG - Automatic Drawing Generation
2 * Copyright (C) 2007,2008,2009 Nicola Fontana <ntd at entidi.it>
4 * This library is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Lesser General Public
6 * License as published by the Free Software Foundation; either
7 * version 2 of the License, or (at your option) any later version.
9 * This library is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * Lesser General Public License for more details.
14 * You should have received a copy of the GNU Lesser General Public
15 * License along with this library; if not, write to the
16 * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
17 * Boston, MA 02110-1301, USA.
21 /**
22 * SECTION:adg-style
23 * @short_description: The base class of all styling objects
25 * This is the fundamental abstract class for styles.
26 **/
28 /**
29 * AdgStyle:
31 * All fields are private and should not be used directly.
32 * Use its public methods instead.
33 **/
36 #include "adg-style.h"
39 static void apply (AdgStyle *style,
40 AdgEntity *entity,
41 cairo_t *cr);
44 G_DEFINE_ABSTRACT_TYPE(AdgStyle, adg_style, G_TYPE_OBJECT);
47 static void
48 adg_style_class_init(AdgStyleClass *klass)
50 klass->apply = apply;
53 static void
54 adg_style_init(AdgStyle *style)
59 /**
60 * adg_style_apply:
61 * @style: an #AdgStyle derived style
62 * @entity: the caller #AdgEntity
63 * @cr: the subject cairo context
65 * Applies @style to @cr so the next rendering operations will be
66 * done accordling to this style directives. The @entity parameter
67 * is used to resolve the internal dresses of @style, if any.
68 **/
69 void
70 adg_style_apply(AdgStyle *style, AdgEntity *entity, cairo_t *cr)
72 g_return_if_fail(ADG_IS_STYLE(style));
73 g_return_if_fail(ADG_IS_ENTITY(entity));
74 g_return_if_fail(cr != NULL);
76 ADG_STYLE_GET_CLASS(style)->apply(style, entity, cr);
80 static void
81 apply(AdgStyle *style, AdgEntity *entity, cairo_t *cr)
83 /* The apply method must be defined */
84 g_warning("%s: `apply' method not implemented for type `%s'",
85 G_STRLOC, g_type_name(G_OBJECT_TYPE(style)));