[docs] s/Return value:/Returns:/g
[adg.git] / adg / adg-canvas.c
bloba05fd978be9647c09787c60a09bb47a016597e7a
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 /**
22 * SECTION:adg-canvas
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.
32 /**
33 * AdgCanvas:
35 * All fields are private and should not be used directly.
36 * Use its public methods instead.
37 **/
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"
45 #include "adg-intl.h"
48 static AdgStyle * context_filler (AdgStyleClass *style_class,
49 gpointer user_data);
52 G_DEFINE_TYPE(AdgCanvas, adg_canvas, ADG_TYPE_CONTAINER);
55 static void
56 adg_canvas_class_init(AdgCanvasClass *klass)
58 g_type_class_add_private(klass, sizeof(AdgCanvasPrivate));
61 static void
62 adg_canvas_init(AdgCanvas *canvas)
64 AdgContext *context;
65 AdgCanvasPrivate *data = G_TYPE_INSTANCE_GET_PRIVATE(canvas,
66 ADG_TYPE_CANVAS,
67 AdgCanvasPrivate);
69 canvas->data = data;
71 context = adg_context_new(context_filler, NULL);
72 adg_entity_set_context((AdgEntity *) canvas, context);
73 g_object_unref(context);
77 /**
78 * adg_canvas_new:
80 * Creates a new empty canvas object.
82 * Returns: the canvas
83 **/
84 AdgCanvas *
85 adg_canvas_new(void)
87 return g_object_new(ADG_TYPE_CANVAS, NULL);
91 static AdgStyle *
92 context_filler(AdgStyleClass *style_class, gpointer user_data)
94 return adg_style_get_default(style_class);