23 #include <tulip/Plugin.h> 35 static const std::string INTERACTOR_CATEGORY =
"Interactor";
63 Q_PROPERTY(
unsigned int priority READ priority)
64 Q_PROPERTY(QAction *action READ action)
65 Q_PROPERTY(
tlp::View *view READ view WRITE setView)
66 Q_PROPERTY(QCursor cursor READ cursor)
70 return INTERACTOR_CATEGORY;
72 std::string
icon()
const override {
73 return ":/tulip/gui/icons/32/plugin_interactor.png";
81 virtual bool isCompatible(
const std::string &viewName)
const = 0;
90 virtual QWidget *configurationWidget()
const = 0;
98 virtual unsigned int priority()
const = 0;
105 virtual QAction *action()
const = 0;
118 virtual QCursor cursor()
const = 0;
124 virtual void construct() = 0;
141 virtual void install(QObject *target) = 0;
147 virtual void uninstall() = 0;
152 virtual void undoIsDone() = 0;
160 return QObject::eventFilter(obj, ev);
169 static QMap<std::string, QList<std::string>> _compatibilityMap;
172 static void initInteractorsDependencies();
173 static QList<std::string> compatibleInteractors(
const std::string &viewName);
199 #define INTERACTORPLUGINVIEWEXTENSION(CLASS_NAME, STRING_CLASS_NAME, BASE_INTERACTOR_STRING_NAME, \ 200 VIEW_STRING_NAME, AUTHOR, DATE, DESCRIPTION, VERSION) \ 201 class CLASS_NAME : public tlp::Interactor { \ 202 mutable tlp::Interactor *_component; \ 205 std::string name() const { \ 206 return std::string(STRING_CLASS_NAME); \ 208 std::string author() const { \ 209 return std::string(AUTHOR); \ 211 std::string date() const { \ 212 return std::string(DATE); \ 214 std::string info() const { \ 215 return std::string(DESCRIPTION); \ 217 std::string release() const { \ 218 return std::string(VERSION); \ 220 std::string tulipRelease() const { \ 221 return std::string(TULIP_VERSION); \ 223 std::string group() const { \ 224 return getComponent()->group(); \ 226 CLASS_NAME(const PluginContext *) : _component(nullptr) {} \ 227 bool isCompatible(const std::string &viewName) const { \ 228 return viewName == VIEW_STRING_NAME; \ 230 QWidget *configurationWidget() const { \ 231 return getComponent()->configurationWidget(); \ 233 unsigned int priority() const { \ 234 return getComponent()->priority(); \ 236 QAction *action() const { \ 237 return getComponent()->action(); \ 239 tlp::View *view() const { \ 240 return getComponent()->view(); \ 242 QCursor cursor() const { \ 243 return getComponent()->cursor(); \ 246 getComponent()->construct(); \ 248 void setView(tlp::View *v) { \ 249 getComponent()->setView(v); \ 251 void install(QObject *target) { \ 252 getComponent()->install(target); \ 255 getComponent()->uninstall(); \ 257 void undoIsDone() { \ 258 getComponent()->undoIsDone(); \ 260 tlp::Interactor *getComponent() const { \ 262 _component = tlp::PluginLister::instance()->getPluginObject<Interactor>( \ 263 BASE_INTERACTOR_STRING_NAME, nullptr); \ 264 assert(_component != nullptr); \ 280 #define INTERACTORPLUGINVIEWEXTENSIONWITHPRIORITY(CLASS_NAME, STRING_CLASS_NAME, \ 281 BASE_INTERACTOR_STRING_NAME, VIEW_STRING_NAME, \ 282 AUTHOR, DATE, DESCRIPTION, VERSION, PRIORITY) \ 283 class CLASS_NAME : public tlp::Interactor { \ 284 mutable tlp::Interactor *_component; \ 287 std::string name() const { \ 288 return std::string(STRING_CLASS_NAME); \ 290 std::string author() const { \ 291 return std::string(AUTHOR); \ 293 std::string date() const { \ 294 return std::string(DATE); \ 296 std::string info() const { \ 297 return std::string(DESCRIPTION); \ 299 std::string release() const { \ 300 return std::string(VERSION); \ 302 std::string tulipRelease() const { \ 303 return std::string(TULIP_VERSION); \ 305 std::string group() const { \ 306 return getComponent()->group(); \ 308 CLASS_NAME(const PluginContext *) : _component(nullptr) {} \ 309 bool isCompatible(const std::string &viewName) const { \ 310 return viewName == VIEW_STRING_NAME; \ 312 QWidget *configurationWidget() const { \ 313 return getComponent()->configurationWidget(); \ 315 unsigned int priority() const { \ 318 QAction *action() const { \ 319 return getComponent()->action(); \ 321 tlp::View *view() const { \ 322 return getComponent()->view(); \ 324 QCursor cursor() const { \ 325 return getComponent()->cursor(); \ 328 getComponent()->construct(); \ 330 void setView(tlp::View *v) { \ 331 getComponent()->setView(v); \ 333 void install(QObject *target) { \ 334 getComponent()->install(target); \ 337 getComponent()->uninstall(); \ 339 void undoIsDone() { \ 340 getComponent()->undoIsDone(); \ 342 tlp::Interactor *getComponent() const { \ 344 _component = tlp::PluginLister::instance()->getPluginObject<Interactor>( \ 345 BASE_INTERACTOR_STRING_NAME, nullptr); \ 346 assert(_component != nullptr); \
bool eventFilter(QObject *obj, QEvent *ev) override
Provides input filtering for the interactor.
Interactor provides a way to handle user inputs over a view. Basically, The interactor class is an ov...
Top-level interface for plug-ins.
std::string category() const override
A string identifier for a plugin used for categorization purposes.
View plugins provide a way to dynamically add to a Tulip plateform various ways to visualize a graph...
The InteractorLister class lists compatible interactors for a given tlp::View.
std::string icon() const override
The icon (preferably a thumbnail) of the plugin.