diff options
Diffstat (limited to 'src/object')
| -rw-r--r-- | src/object/sp-anchor.cpp | 24 | ||||
| -rw-r--r-- | src/object/sp-item.h | 26 |
2 files changed, 34 insertions, 16 deletions
diff --git a/src/object/sp-anchor.cpp b/src/object/sp-anchor.cpp index 9fd556945..d4361a4ef 100644 --- a/src/object/sp-anchor.cpp +++ b/src/object/sp-anchor.cpp @@ -20,7 +20,7 @@ #include "xml/repr.h" #include "attributes.h" #include "sp-anchor.h" -#include "ui/view/view.h" +#include "ui/view/svg-view.h" #include "document.h" SPAnchor::SPAnchor() : SPGroup() { @@ -153,22 +153,34 @@ gchar* SPAnchor::description() const { } /* fixme: We should forward event to appropriate container/view */ +/* The only use of SPEvent appears to be here, to change the cursor in Inkview when over a link (and + * which hasn't worked since at least 0.48). */ gint SPAnchor::event(SPEvent* event) { switch (event->type) { - case SP_EVENT_ACTIVATE: + case SPEvent::ACTIVATE: if (this->href) { g_print("Activated xlink:href=\"%s\"\n", this->href); return TRUE; } break; - case SP_EVENT_MOUSEOVER: - (static_cast<Inkscape::UI::View::View*>(event->data))->mouseover(); + case SPEvent::MOUSEOVER: + { + auto view = dynamic_cast<Inkscape::UI::View::SVGView*>(event->view); + if (view) { + view->mouseover(); + } break; + } - case SP_EVENT_MOUSEOUT: - (static_cast<Inkscape::UI::View::View*>(event->data))->mouseout(); + case SPEvent::MOUSEOUT: + { + auto view = dynamic_cast<Inkscape::UI::View::SVGView*>(event->view); + if (view) { + view->mouseout(); + } break; + } default: break; diff --git a/src/object/sp-item.h b/src/object/sp-item.h index 2bd8f2215..068571d85 100644 --- a/src/object/sp-item.h +++ b/src/object/sp-item.h @@ -46,15 +46,12 @@ class Drawing; class DrawingItem; class URIReference; +namespace UI { +namespace View { +class View; +} +} } - -enum { - SP_EVENT_INVALID, - SP_EVENT_NONE, - SP_EVENT_ACTIVATE, - SP_EVENT_MOUSEOVER, - SP_EVENT_MOUSEOUT -}; // TODO make a completely new function that transforms either the fill or // stroke of any SPItem without adding an extra parameter to adjust_pattern. @@ -75,9 +72,18 @@ enum PatternTransform { * */ class SPEvent { + public: - unsigned int type; - void* data; + enum Type { + INVALID, + NONE, + ACTIVATE, + MOUSEOVER, + MOUSEOUT + }; + + Type type; + Inkscape::UI::View::View* view; }; class SPItemView { |
