[docs] Autogenerating cpml-sections.txt
[adg.git] / adg / adg-style.c
blob81139281409eba20d486954ad4e2b171297fa230
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 cairo_t *cr);
43 G_DEFINE_ABSTRACT_TYPE(AdgStyle, adg_style, G_TYPE_OBJECT);
46 static void
47 adg_style_class_init(AdgStyleClass *klass)
49 klass->apply = apply;
52 static void
53 adg_style_init(AdgStyle *style)
58 /**
59 * adg_style_apply:
60 * @style: an #AdgStyle derived style
61 * @cr: the subject cairo context
63 * Applies @style to @cr so the next rendering operations will be done
64 * accordling to this style directives.
65 **/
66 void
67 adg_style_apply(AdgStyle *style, cairo_t *cr)
69 g_return_if_fail(ADG_IS_STYLE(style));
70 g_return_if_fail(cr != NULL);
72 ADG_STYLE_GET_CLASS(style)->apply(style, cr);
76 static void
77 apply(AdgStyle *style, cairo_t *cr)
79 /* The apply method must be defined */
80 g_warning("%s: `apply' method not implemented for type `%s'",
81 G_STRLOC, g_type_name(G_OBJECT_TYPE(style)));