diff options
| author | Markus Engel <markus.engel@tum.de> | 2012-08-20 21:48:42 +0000 |
|---|---|---|
| committer | Markus Engel <markus.engel@tum.de> | 2012-08-20 21:48:42 +0000 |
| commit | fa1b664180baa1ec99b8d5b9ec7c8b21c7203c9f (patch) | |
| tree | da8223be6032c272ad1331fab1b297c35d1b5600 /src | |
| parent | As all subclasses of SPItem now have "virtual pads" with correct inheritance,... (diff) | |
| download | inkscape-fa1b664180baa1ec99b8d5b9ec7c8b21c7203c9f.tar.gz inkscape-fa1b664180baa1ec99b8d5b9ec7c8b21c7203c9f.zip | |
Added "virtual pad" to SPTitle.
(bzr r11608.1.31)
Diffstat (limited to 'src')
| -rw-r--r-- | src/sp-title.cpp | 33 | ||||
| -rw-r--r-- | src/sp-title.h | 18 |
2 files changed, 40 insertions, 11 deletions
diff --git a/src/sp-title.cpp b/src/sp-title.cpp index ddeccede2..c7739823c 100644 --- a/src/sp-title.cpp +++ b/src/sp-title.cpp @@ -52,23 +52,36 @@ sp_title_class_init(SPTitleClass *klass) sp_object_class->write = sp_title_write; } +CTitle::CTitle(SPTitle* title) : CObject(title) { + this->sptitle = title; +} + +CTitle::~CTitle() { +} + static void -sp_title_init(SPTitle */*desc*/) +sp_title_init(SPTitle *desc) { + desc->ctitle = new CTitle(desc); + desc->cobject = desc->ctitle; } -/** - * Writes it's settings to an incoming repr object, if any. - */ -static Inkscape::XML::Node *sp_title_write(SPObject *object, Inkscape::XML::Document *doc, Inkscape::XML::Node *repr, guint flags) -{ +Inkscape::XML::Node* CTitle::onWrite(Inkscape::XML::Document *xml_doc, Inkscape::XML::Node *repr, guint flags) { + SPTitle* object = this->sptitle; + if (!repr) { - repr = object->getRepr()->duplicate(doc); + repr = object->getRepr()->duplicate(xml_doc); } - if (((SPObjectClass *) title_parent_class)->write) { - ((SPObjectClass *) title_parent_class)->write(object, doc, repr, flags); - } + CObject::onWrite(xml_doc, repr, flags); return repr; } + +/** + * Writes it's settings to an incoming repr object, if any. + */ +static Inkscape::XML::Node *sp_title_write(SPObject *object, Inkscape::XML::Document *doc, Inkscape::XML::Node *repr, guint flags) +{ + return ((SPTitle*)object)->ctitle->onWrite(doc, repr, flags); +} diff --git a/src/sp-title.h b/src/sp-title.h index a5f0a2fea..a048b6a55 100644 --- a/src/sp-title.h +++ b/src/sp-title.h @@ -19,14 +19,30 @@ class SPTitle; class SPTitleClass; +class CTitle; -struct SPTitle : public SPObject { +class SPTitle : public SPObject { +public: + CTitle* ctitle; }; struct SPTitleClass { SPObjectClass parent_class; }; + +class CTitle : public CObject { +public: + CTitle(SPTitle* title); + virtual ~CTitle(); + + virtual Inkscape::XML::Node* onWrite(Inkscape::XML::Document *xml_doc, Inkscape::XML::Node *repr, guint flags); + +protected: + SPTitle* sptitle; +}; + + GType sp_title_get_type (void); #endif |
