[AdgEntity] adg_entity_get_parent() must return a const
[adg.git] / adg / adg-entity.h
blob962ab1cc2ee1f9c0c402c97cda5d94553647809c
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 #ifndef __ADG_ENTITY_H__
22 #define __ADG_ENTITY_H__
24 #include <adg/adg-util.h>
25 #include <adg/adg-type-builtins.h>
26 #include <adg/adg-matrix.h>
27 #include <cpml/cpml.h>
30 G_BEGIN_DECLS
32 #define ADG_TYPE_ENTITY (adg_entity_get_type())
33 #define ADG_ENTITY(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), ADG_TYPE_ENTITY, AdgEntity))
34 #define ADG_ENTITY_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass), ADG_TYPE_ENTITY, AdgEntityClass))
35 #define ADG_IS_ENTITY(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj), ADG_TYPE_ENTITY))
36 #define ADG_IS_ENTITY_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass), ADG_TYPE_ENTITY))
37 #define ADG_ENTITY_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS((obj), ADG_TYPE_ENTITY, AdgEntityClass))
40 /* Forward declaration */
41 ADG_FORWARD_DECL(AdgStyle);
42 typedef gint AdgDress;
45 typedef struct _AdgEntity AdgEntity;
46 typedef struct _AdgEntityClass AdgEntityClass;
47 typedef void (*AdgEntityCallback) (AdgEntity *entity, gpointer user_data);
49 ADG_FORWARD_DECL(AdgCanvas);
52 struct _AdgEntity {
53 /*< private >*/
54 GInitiallyUnowned parent;
55 gpointer data;
58 struct _AdgEntityClass {
59 /*< private >*/
60 GInitiallyUnownedClass parent_class;
61 /*< public >*/
62 /* Signals */
63 void (*parent_set) (AdgEntity *entity,
64 AdgEntity *old_parent);
65 void (*global_changed) (AdgEntity *entity);
66 void (*local_changed) (AdgEntity *entity);
68 /* Virtual Table */
69 void (*invalidate) (AdgEntity *entity);
70 void (*arrange) (AdgEntity *entity);
71 void (*render) (AdgEntity *entity,
72 cairo_t *cr);
76 void adg_switch_extents (gboolean state);
78 GType adg_entity_get_type (void) G_GNUC_CONST;
79 AdgCanvas * adg_entity_get_canvas (AdgEntity *entity);
81 const AdgEntity *adg_entity_get_parent (AdgEntity *entity);
82 void adg_entity_set_parent (AdgEntity *entity,
83 AdgEntity *parent);
84 const AdgMatrix *adg_entity_get_global_map (AdgEntity *entity);
85 void adg_entity_set_global_map (AdgEntity *entity,
86 const AdgMatrix *map);
87 void adg_entity_transform_global_map(AdgEntity *entity,
88 const AdgMatrix *transformation,
89 AdgTransformMode mode);
90 const AdgMatrix *adg_entity_get_local_map (AdgEntity *entity);
91 void adg_entity_set_local_map (AdgEntity *entity,
92 const AdgMatrix *map);
93 void adg_entity_transform_local_map (AdgEntity *entity,
94 const AdgMatrix *transformation,
95 AdgTransformMode mode);
96 AdgMixMethod adg_entity_get_local_method (AdgEntity *entity);
97 void adg_entity_set_local_method (AdgEntity *entity,
98 AdgMixMethod local_method);
99 const CpmlExtents *
100 adg_entity_extents (AdgEntity *entity);
101 void adg_entity_set_extents (AdgEntity *entity,
102 const CpmlExtents *extents);
103 AdgStyle * adg_entity_style (AdgEntity *entity,
104 AdgDress dress);
105 AdgStyle * adg_entity_get_style (AdgEntity *entity,
106 AdgDress dress);
107 void adg_entity_set_style (AdgEntity *entity,
108 AdgDress dress,
109 AdgStyle *style);
110 void adg_entity_apply_dress (AdgEntity *entity,
111 AdgDress dress,
112 cairo_t *cr);
113 void adg_entity_global_changed (AdgEntity *entity);
114 void adg_entity_local_changed (AdgEntity *entity);
115 const AdgMatrix *adg_entity_get_global_matrix (AdgEntity *entity);
116 const AdgMatrix *adg_entity_get_local_matrix (AdgEntity *entity);
117 void adg_entity_invalidate (AdgEntity *entity);
118 void adg_entity_arrange (AdgEntity *entity);
119 void adg_entity_render (AdgEntity *entity,
120 cairo_t *cr);
122 G_END_DECLS
125 #endif /* __ADG_ENTITY_H__ */