1 #define __SP_TITLE_C__
3 /*
4 * SVG <title> implementation
5 *
6 * Authors:
7 * Jeff Schiller <codedread@gmail.com>
8 *
9 * Copyright (C) 2008 Jeff Schiller
10 *
11 * Released under GNU GPL, read the file 'COPYING' for more information
12 */
14 #ifdef HAVE_CONFIG_H
15 # include "config.h"
16 #endif
18 #include "sp-title.h"
19 #include "xml/repr.h"
21 static void sp_title_class_init(SPTitleClass *klass);
22 static void sp_title_init(SPTitle *rect);
23 static Inkscape::XML::Node *sp_title_write(SPObject *object, Inkscape::XML::Document *doc, Inkscape::XML::Node *repr, guint flags);
25 static SPObjectClass *title_parent_class;
27 GType
28 sp_title_get_type (void)
29 {
30 static GType title_type = 0;
32 if (!title_type) {
33 GTypeInfo title_info = {
34 sizeof (SPTitleClass),
35 NULL, NULL,
36 (GClassInitFunc) sp_title_class_init,
37 NULL, NULL,
38 sizeof (SPTitle),
39 16,
40 (GInstanceInitFunc) sp_title_init,
41 NULL, /* value_table */
42 };
43 title_type = g_type_register_static (SP_TYPE_OBJECT, "SPTitle", &title_info, (GTypeFlags)0);
44 }
45 return title_type;
46 }
48 static void
49 sp_title_class_init(SPTitleClass *klass)
50 {
51 SPObjectClass *sp_object_class = (SPObjectClass *) klass;
52 title_parent_class = (SPObjectClass *) g_type_class_ref(SP_TYPE_OBJECT);
54 sp_object_class->write = sp_title_write;
55 }
57 static void
58 sp_title_init(SPTitle */*desc*/)
59 {
60 }
62 /*
63 * \brief Writes it's settings to an incoming repr object, if any
64 */
65 static Inkscape::XML::Node *
66 sp_title_write(SPObject *object, Inkscape::XML::Document *doc, Inkscape::XML::Node *repr, guint flags)
67 {
68 if (!repr) {
69 repr = SP_OBJECT_REPR (object)->duplicate(doc);
70 }
72 if (((SPObjectClass *) title_parent_class)->write)
73 ((SPObjectClass *) title_parent_class)->write(object, doc, repr, flags);
75 return repr;
76 }