s/2008,2009/2008,2009,2010/
[adg.git] / adg / adg-entity.h
blob5d3b6b845001dd83911c5d925cac08ec7c3a6ae4
1 /* ADG - Automatic Drawing Generation
2 * Copyright (C) 2007,2008,2009,2010 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 #if !defined(__ADG_H__)
22 #error "Only <adg/adg.h> can be included directly."
23 #endif
26 #ifndef __ADG_ENTITY_H__
27 #define __ADG_ENTITY_H__
29 #include <adg/adg-util.h>
30 #include <adg/adg-type-builtins.h>
31 #include <adg/adg-matrix.h>
32 #include <cpml/cpml.h>
35 G_BEGIN_DECLS
37 #define ADG_TYPE_ENTITY (adg_entity_get_type())
38 #define ADG_ENTITY(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), ADG_TYPE_ENTITY, AdgEntity))
39 #define ADG_ENTITY_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass), ADG_TYPE_ENTITY, AdgEntityClass))
40 #define ADG_IS_ENTITY(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj), ADG_TYPE_ENTITY))
41 #define ADG_IS_ENTITY_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass), ADG_TYPE_ENTITY))
42 #define ADG_ENTITY_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS((obj), ADG_TYPE_ENTITY, AdgEntityClass))
45 /* Forward declaration */
46 ADG_FORWARD_DECL(AdgStyle);
47 typedef gint AdgDress;
50 typedef struct _AdgEntity AdgEntity;
51 typedef struct _AdgEntityClass AdgEntityClass;
52 typedef void (*AdgEntityCallback) (AdgEntity *entity, gpointer user_data);
54 ADG_FORWARD_DECL(AdgCanvas);
57 struct _AdgEntity {
58 /*< private >*/
59 GInitiallyUnowned parent;
60 gpointer data;
63 struct _AdgEntityClass {
64 /*< private >*/
65 GInitiallyUnownedClass parent_class;
66 /*< public >*/
67 /* Signals */
68 void (*parent_set) (AdgEntity *entity,
69 AdgEntity *old_parent);
70 void (*global_changed) (AdgEntity *entity);
71 void (*local_changed) (AdgEntity *entity);
73 /* Virtual Table */
74 void (*invalidate) (AdgEntity *entity);
75 void (*arrange) (AdgEntity *entity);
76 void (*render) (AdgEntity *entity,
77 cairo_t *cr);
81 void adg_switch_extents (gboolean state);
83 GType adg_entity_get_type (void) G_GNUC_CONST;
84 AdgCanvas * adg_entity_get_canvas (AdgEntity *entity);
86 void adg_entity_set_parent (AdgEntity *entity,
87 AdgEntity *parent);
88 AdgEntity * adg_entity_get_parent (AdgEntity *entity);
89 void adg_entity_set_global_map (AdgEntity *entity,
90 const AdgMatrix *map);
91 void adg_entity_transform_global_map(AdgEntity *entity,
92 const AdgMatrix *transformation,
93 AdgTransformMode mode);
94 const AdgMatrix *adg_entity_get_global_map (AdgEntity *entity);
95 const AdgMatrix *adg_entity_get_global_matrix (AdgEntity *entity);
96 void adg_entity_set_local_map (AdgEntity *entity,
97 const AdgMatrix *map);
98 void adg_entity_transform_local_map (AdgEntity *entity,
99 const AdgMatrix *transformation,
100 AdgTransformMode mode);
101 const AdgMatrix *adg_entity_get_local_map (AdgEntity *entity);
102 const AdgMatrix *adg_entity_get_local_matrix (AdgEntity *entity);
103 void adg_entity_set_local_method (AdgEntity *entity,
104 AdgMixMethod local_method);
105 AdgMixMethod adg_entity_get_local_method (AdgEntity *entity);
106 void adg_entity_set_extents (AdgEntity *entity,
107 const CpmlExtents *extents);
108 const CpmlExtents *
109 adg_entity_get_extents (AdgEntity *entity);
110 void adg_entity_set_style (AdgEntity *entity,
111 AdgDress dress,
112 AdgStyle *style);
113 AdgStyle * adg_entity_get_style (AdgEntity *entity,
114 AdgDress dress);
115 AdgStyle * adg_entity_style (AdgEntity *entity,
116 AdgDress dress);
117 void adg_entity_apply_dress (AdgEntity *entity,
118 AdgDress dress,
119 cairo_t *cr);
120 void adg_entity_global_changed (AdgEntity *entity);
121 void adg_entity_local_changed (AdgEntity *entity);
122 void adg_entity_invalidate (AdgEntity *entity);
123 void adg_entity_arrange (AdgEntity *entity);
124 void adg_entity_render (AdgEntity *entity,
125 cairo_t *cr);
127 G_END_DECLS
130 #endif /* __ADG_ENTITY_H__ */