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.
23 * @short_description: The base class of all styling objects
25 * This is the fundamental abstract class for styles.
31 * All fields are private and should not be used directly.
32 * Use its public methods instead.
36 #include "adg-style.h"
39 static void apply (AdgStyle
*style
,
44 G_DEFINE_ABSTRACT_TYPE(AdgStyle
, adg_style
, G_TYPE_OBJECT
);
48 adg_style_class_init(AdgStyleClass
*klass
)
54 adg_style_init(AdgStyle
*style
)
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.
70 adg_style_apply(AdgStyle
*style
, AdgEntity
*entity
, cairo_t
*cr
)
74 g_return_if_fail(ADG_IS_STYLE(style
));
75 g_return_if_fail(ADG_IS_ENTITY(entity
));
76 g_return_if_fail(cr
!= NULL
);
78 klass
= ADG_STYLE_GET_CLASS(style
);
81 klass
->apply(style
, entity
, cr
);
86 apply(AdgStyle
*style
, AdgEntity
*entity
, cairo_t
*cr
)
88 /* The apply method must be defined */
89 g_warning("%s: `apply' method not implemented for type `%s'",
90 G_STRLOC
, g_type_name(G_OBJECT_TYPE(style
)));