diff options
| author | Matthew Petroff <matthew@mpetroff.net> | 2013-09-20 17:05:24 +0000 |
|---|---|---|
| committer | Matthew Petroff <matthew@mpetroff.net> | 2013-09-20 17:05:24 +0000 |
| commit | 48b4ee48e518d65c3c5e49369a747c2aa4b0081b (patch) | |
| tree | 7159f8bc67d3f96ae43c42c32cacec6f7813f6fa /src/sp-pattern.h | |
| parent | Fix bug in rectangle toolbar. (diff) | |
| parent | Fix grids after C++ification. Patch from Markus Engel (diff) | |
| download | inkscape-48b4ee48e518d65c3c5e49369a747c2aa4b0081b.tar.gz inkscape-48b4ee48e518d65c3c5e49369a747c2aa4b0081b.zip | |
Merge from trunk.
(bzr r12475.1.29)
Diffstat (limited to 'src/sp-pattern.h')
| -rw-r--r-- | src/sp-pattern.h | 58 |
1 files changed, 32 insertions, 26 deletions
diff --git a/src/sp-pattern.h b/src/sp-pattern.h index bcf8dd520..4e3657ccf 100644 --- a/src/sp-pattern.h +++ b/src/sp-pattern.h @@ -16,15 +16,11 @@ #include <gtk/gtk.h> #include "sp-item.h" -#define SP_TYPE_PATTERN (sp_pattern_get_type ()) -#define SP_PATTERN(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), SP_TYPE_PATTERN, SPPattern)) -#define SP_PATTERN_CLASS(k) (G_TYPE_CHECK_CLASS_CAST ((k), SP_TYPE_PATTERN, SPPatternClass)) -#define SP_IS_PATTERN(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), SP_TYPE_PATTERN)) -#define SP_IS_PATTERN_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), SP_TYPE_PATTERN)) -GType sp_pattern_get_type (void); +#define SP_PATTERN(obj) (dynamic_cast<SPPattern*>((SPObject*)obj)) +#define SP_IS_PATTERN(obj) (dynamic_cast<const SPPattern*>((SPObject*)obj) != NULL) -struct SPPattern; +class SPPatternReference; #include "svg/svg-length.h" #include "sp-paint-server.h" @@ -34,25 +30,11 @@ struct SPPattern; #include <sigc++/connection.h> -class SPPatternReference : public Inkscape::URIReference { +class SPPattern : public SPPaintServer { public: - SPPatternReference (SPObject *obj) : URIReference(obj) {} - SPPattern *getObject() const { - return reinterpret_cast<SPPattern *>(URIReference::getObject()); - } - -protected: - virtual bool _acceptObject(SPObject *obj) const { - return SP_IS_PATTERN (obj); - } -}; + SPPattern(); + virtual ~SPPattern(); -enum { - SP_PATTERN_UNITS_USERSPACEONUSE, - SP_PATTERN_UNITS_OBJECTBOUNDINGBOX -}; - -struct SPPattern : public SPPaintServer { /* Reference (href) */ gchar *href; SPPatternReference *ref; @@ -75,10 +57,34 @@ struct SPPattern : public SPPaintServer { guint viewBox_set : 1; sigc::connection modified_connection; + + virtual cairo_pattern_t* pattern_new(cairo_t *ct, Geom::OptRect const &bbox, double opacity); + +protected: + virtual void build(SPDocument* doc, Inkscape::XML::Node* repr); + virtual void release(); + virtual void set(unsigned int key, const gchar* value); + virtual void update(SPCtx* ctx, unsigned int flags); + virtual void modified(unsigned int flags); +}; + + +class SPPatternReference : public Inkscape::URIReference { +public: + SPPatternReference (SPObject *obj) : URIReference(obj) {} + SPPattern *getObject() const { + return reinterpret_cast<SPPattern *>(URIReference::getObject()); + } + +protected: + virtual bool _acceptObject(SPObject *obj) const { + return SP_IS_PATTERN (obj); + } }; -struct SPPatternClass { - SPPaintServerClass parent_class; +enum { + SP_PATTERN_UNITS_USERSPACEONUSE, + SP_PATTERN_UNITS_OBJECTBOUNDINGBOX }; guint pattern_users (SPPattern *pattern); |
