[AdgContainer] "child" is an object property
[adg.git] / adg / adg-entity.h
blob15de4b2c366cff24b36a3045449707709dacb2c1
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-context.h>
26 #include <adg/adg-matrix.h>
27 #include <adg/adg-line-style.h>
28 #include <adg/adg-font-style.h>
29 #include <adg/adg-arrow-style.h>
30 #include <adg/adg-dim-style.h>
33 G_BEGIN_DECLS
35 #define ADG_TYPE_ENTITY (adg_entity_get_type ())
36 #define ADG_ENTITY(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), ADG_TYPE_ENTITY, AdgEntity))
37 #define ADG_ENTITY_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), ADG_TYPE_ENTITY, AdgEntityClass))
38 #define ADG_IS_ENTITY(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), ADG_TYPE_ENTITY))
39 #define ADG_IS_ENTITY_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), ADG_TYPE_ENTITY))
40 #define ADG_ENTITY_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), ADG_TYPE_ENTITY, AdgEntityClass))
43 typedef struct _AdgEntity AdgEntity;
44 typedef struct _AdgEntityClass AdgEntityClass;
46 ADG_FORWARD_DECL(AdgCanvas);
47 ADG_FORWARD_DECL(AdgContainer);
50 struct _AdgEntity {
51 /*< private >*/
52 GInitiallyUnowned parent;
53 gpointer data;
56 struct _AdgEntityClass {
57 /*< private >*/
58 GInitiallyUnownedClass parent_class;
60 /*< public >*/
61 /* Signals */
62 void (*parent_set) (AdgEntity *entity,
63 AdgContainer *old_parent);
64 void (*model_matrix_changed) (AdgEntity *entity,
65 AdgMatrix *parent_matrix);
66 void (*paper_matrix_changed) (AdgEntity *entity,
67 AdgMatrix *parent_matrix);
68 void (*invalidate) (AdgEntity *entity);
69 void (*render) (AdgEntity *entity,
70 cairo_t *cr);
71 /* Virtual Table */
72 AdgContainer * (*get_parent) (AdgEntity *entity);
73 void (*set_parent) (AdgEntity *entity,
74 AdgContainer *parent);
75 AdgContext * (*get_context) (AdgEntity *entity);
76 const AdgMatrix * (*get_model_matrix) (AdgEntity *entity);
77 const AdgMatrix * (*get_paper_matrix) (AdgEntity *entity);
81 #define ADG_CALLBACK(f) ((AdgCallback) (f))
84 typedef void (*AdgCallback)(AdgEntity *entity, cairo_t *cr, gpointer user_data);
87 GType adg_entity_get_type (void) G_GNUC_CONST;
88 AdgCanvas * adg_entity_get_canvas (AdgEntity *entity);
90 AdgContainer * adg_entity_get_parent (AdgEntity *entity);
91 void adg_entity_set_parent (AdgEntity *entity,
92 AdgContainer *parent);
93 void adg_entity_unparent (AdgEntity *entity);
94 void adg_entity_reparent (AdgEntity *entity,
95 AdgContainer *parent);
96 AdgContext * adg_entity_get_context (AdgEntity *entity);
97 void adg_entity_set_context (AdgEntity *entity,
98 AdgContext *context);
99 void adg_entity_get_global_map (AdgEntity *entity,
100 AdgMatrix *map);
101 void adg_entity_set_global_map (AdgEntity *entity,
102 const AdgMatrix *map);
103 void adg_entity_get_local_map (AdgEntity *entity,
104 AdgMatrix *map);
105 void adg_entity_set_local_map (AdgEntity *entity,
106 const AdgMatrix *map);
107 void adg_entity_get_global_matrix (AdgEntity *entity,
108 AdgMatrix *matrix);
109 void adg_entity_get_local_matrix (AdgEntity *entity,
110 AdgMatrix *matrix);
111 const AdgMatrix*adg_entity_get_model_matrix (AdgEntity *entity);
112 const AdgMatrix*adg_entity_get_paper_matrix (AdgEntity *entity);
113 gboolean adg_entity_build_paper2model (AdgEntity *entity,
114 AdgMatrix *matrix);
115 gboolean adg_entity_build_model2paper (AdgEntity *entity,
116 AdgMatrix *matrix);
117 void adg_entity_model_matrix_changed (AdgEntity *entity,
118 const AdgMatrix *parent_matrix);
119 void adg_entity_paper_matrix_changed (AdgEntity *entity,
120 const AdgMatrix *parent_matrix);
121 AdgStyle * adg_entity_get_style (AdgEntity *entity,
122 AdgStyleSlot style_slot);
123 void adg_entity_apply (AdgEntity *entity,
124 AdgStyleSlot style_slot,
125 cairo_t *cr);
126 gboolean adg_entity_model_matrix_applied (AdgEntity *entity);
127 gboolean adg_entity_paper_matrix_applied (AdgEntity *entity);
128 gboolean adg_entity_model_applied (AdgEntity *entity);
129 void adg_entity_invalidate (AdgEntity *entity);
130 void adg_entity_render (AdgEntity *entity,
131 cairo_t *cr);
133 G_END_DECLS
136 #endif /* __ADG_ENTITY_H__ */