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 drawing container
25 * This container represents the object where the rendering process draws. All
26 * the drawing must have a canvas, and only one, as master parent (as all the
27 * #GtkWidget must have a #GtkWindow).
29 * Internally, the target is mantained as a #cairo_t context pointer.
35 * All fields are private and should not be used directly.
36 * Use its public methods instead.
40 #include "adg-canvas.h"
41 #include "adg-canvas-private.h"
42 #include "adg-line-style.h"
43 #include "adg-font-style.h"
44 #include "adg-arrow-style.h"
48 static AdgStyle
* context_filler (AdgStyleClass
*style_class
,
52 G_DEFINE_TYPE(AdgCanvas
, adg_canvas
, ADG_TYPE_CONTAINER
);
56 adg_canvas_class_init(AdgCanvasClass
*klass
)
58 g_type_class_add_private(klass
, sizeof(AdgCanvasPrivate
));
62 adg_canvas_init(AdgCanvas
*canvas
)
65 AdgCanvasPrivate
*data
= G_TYPE_INSTANCE_GET_PRIVATE(canvas
,
71 context
= adg_context_new(context_filler
, NULL
);
72 adg_entity_set_context((AdgEntity
*) canvas
, context
);
73 g_object_unref(context
);
80 * Creates a new empty canvas object.
87 return g_object_new(ADG_TYPE_CANVAS
, NULL
);
92 context_filler(AdgStyleClass
*style_class
, gpointer user_data
)
94 return adg_style_get_default(style_class
);