Implemented adg_entity_build_{paper2model,model2paper}()
[adg.git] / adg / adg-entity.h
blobe1e05b05440dbfeb5b281cce336d2eac60d91196
1 /* ADG - Automatic Drawing Generation
2 * Copyright (C) 2007-2008, 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 Library 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 * Library 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., 59 Temple Place - Suite 330,
17 * Boston, MA 02111-1307, USA.
21 #ifndef __ADG_ENTITY_H__
22 #define __ADG_ENTITY_H__
24 #include <adg/adg-context.h>
25 #include <adg/adg-matrix.h>
26 #include <adg/adg-line-style.h>
27 #include <adg/adg-font-style.h>
28 #include <adg/adg-arrow-style.h>
29 #include <adg/adg-dim-style.h>
32 G_BEGIN_DECLS
34 /* Forward declarations */
35 typedef struct _AdgCanvas AdgCanvas;
38 #define ADG_TYPE_ENTITY (adg_entity_get_type ())
39 #define ADG_ENTITY(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), ADG_TYPE_ENTITY, AdgEntity))
40 #define ADG_ENTITY_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), ADG_TYPE_ENTITY, AdgEntityClass))
41 #define ADG_IS_ENTITY(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), ADG_TYPE_ENTITY))
42 #define ADG_IS_ENTITY_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), ADG_TYPE_ENTITY))
43 #define ADG_ENTITY_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), ADG_TYPE_ENTITY, AdgEntityClass))
46 typedef struct _AdgEntity AdgEntity;
47 typedef struct _AdgEntityClass AdgEntityClass;
48 typedef struct _AdgEntityPrivate AdgEntityPrivate;
51 struct _AdgEntity {
52 GInitiallyUnowned initially_unowned;
54 /*< private >*/
55 AdgEntityPrivate *priv;
58 struct _AdgEntityClass {
59 GInitiallyUnownedClass parent_class;
60 /* Signals */
61 void (*model_matrix_changed) (AdgEntity *entity,
62 AdgMatrix *parent_matrix);
63 void (*paper_matrix_changed) (AdgEntity *entity,
64 AdgMatrix *parent_matrix);
65 void (*invalidate) (AdgEntity *entity);
66 void (*render) (AdgEntity *entity,
67 cairo_t *cr);
68 /* Virtual Table */
69 const AdgMatrix * (*get_model_matrix) (AdgEntity *entity);
70 const AdgMatrix * (*get_paper_matrix) (AdgEntity *entity);
74 #define ADG_CALLBACK(f) ((AdgCallback) (f))
77 typedef void (*AdgCallback) (AdgEntity *entity, gpointer user_data);
80 GType adg_entity_get_type (void) G_GNUC_CONST;
81 AdgCanvas * adg_entity_get_canvas (AdgEntity *entity);
83 AdgContext * adg_entity_get_context (AdgEntity *entity);
84 void adg_entity_set_context (AdgEntity *entity,
85 AdgContext *context);
86 const AdgMatrix*adg_entity_get_model_matrix (AdgEntity *entity);
87 const AdgMatrix*adg_entity_get_paper_matrix (AdgEntity *entity);
88 gboolean adg_entity_build_paper2model (AdgEntity *entity,
89 AdgMatrix *matrix);
90 gboolean adg_entity_build_model2paper (AdgEntity *entity,
91 AdgMatrix *matrix);
92 void adg_entity_scale_to_model (AdgEntity *entity,
93 cairo_t *cr);
94 void adg_entity_scale_to_paper (AdgEntity *entity,
95 cairo_t *cr);
96 void adg_entity_model_matrix_changed (AdgEntity *entity,
97 const AdgMatrix*parent_matrix);
98 void adg_entity_paper_matrix_changed (AdgEntity *entity,
99 const AdgMatrix*parent_matrix);
100 AdgStyle * adg_entity_get_style (AdgEntity *entity,
101 AdgStyleSlot style_slot);
102 void adg_entity_apply (AdgEntity *entity,
103 AdgStyleSlot style_slot,
104 cairo_t *cr);
105 gboolean adg_entity_model_matrix_applied (AdgEntity *entity);
106 gboolean adg_entity_paper_matrix_applied (AdgEntity *entity);
107 gboolean adg_entity_model_applied (AdgEntity *entity);
108 void adg_entity_invalidate (AdgEntity *entity);
109 void adg_entity_render (AdgEntity *entity,
110 cairo_t *cr);
112 G_END_DECLS
115 #endif /* __ADG_ENTITY_H__ */