23 #include <tulip/Plugin.h> 36 static const std::string INTERACTOR_CATEGORY =
"Interactor";
64 Q_PROPERTY(
unsigned int priority READ priority)
65 Q_PROPERTY(QAction *action READ action)
66 Q_PROPERTY(
tlp::View *view READ view WRITE setView)
67 Q_PROPERTY(QCursor cursor READ cursor)
71 return INTERACTOR_CATEGORY;
73 std::string
icon()
const override {
74 return ":/tulip/gui/icons/32/plugin_interactor.png";
82 virtual bool isCompatible(
const std::string &viewName)
const = 0;
96 virtual QLabel *configurationDocWidget()
const {
99 virtual QWidget *configurationOptionsWidget()
const {
109 virtual unsigned int priority()
const = 0;
116 virtual QAction *action()
const = 0;
129 virtual QCursor cursor()
const = 0;
135 virtual void construct() = 0;
152 virtual void install(QObject *target) = 0;
158 virtual void uninstall() = 0;
163 virtual void undoIsDone() = 0;
171 return QObject::eventFilter(obj, ev);
180 class TLP_QT_SCOPE InteractorLister {
181 static QMap<std::string, QList<std::string>> _compatibilityMap;
184 static void initInteractorsDependencies();
185 static QList<std::string> compatibleInteractors(
const std::string &viewName);
212 #define INTERACTORPLUGINVIEWEXTENSION(CLASS_NAME, STRING_CLASS_NAME, BASE_INTERACTOR_STRING_NAME, \ 213 VIEW_STRING_NAME, AUTHOR, DATE, DESCRIPTION, VERSION) \ 214 class CLASS_NAME : public tlp::Interactor { \ 215 mutable tlp::Interactor *_component; \ 218 std::string name() const { \ 219 return std::string(STRING_CLASS_NAME); \ 221 std::string author() const { \ 222 return std::string(AUTHOR); \ 224 std::string date() const { \ 225 return std::string(DATE); \ 227 std::string info() const { \ 228 return std::string(DESCRIPTION); \ 230 std::string release() const { \ 231 return std::string(VERSION); \ 233 std::string tulipRelease() const { \ 234 return std::string(TULIP_VERSION); \ 236 std::string group() const { \ 237 return getComponent()->group(); \ 239 CLASS_NAME(const PluginContext *) : _component(nullptr) {} \ 240 bool isCompatible(const std::string &viewName) const { \ 241 return viewName == VIEW_STRING_NAME; \ 243 QWidget *configurationWidget() const { \ 244 return getComponent()->configurationWidget(); \ 246 QLabel *configurationDocWidget() const { \ 247 return getComponent()->configurationDocWidget(); \ 249 QWidget *configurationActionsWidget() const { \ 250 return getComponent()->configurationOptionsWidget(); \ 252 unsigned int priority() const { \ 253 return getComponent()->priority(); \ 255 QAction *action() const { \ 256 return getComponent()->action(); \ 258 tlp::View *view() const { \ 259 return getComponent()->view(); \ 261 QCursor cursor() const { \ 262 return getComponent()->cursor(); \ 265 getComponent()->construct(); \ 267 void setView(tlp::View *v) { \ 268 getComponent()->setView(v); \ 270 void install(QObject *target) { \ 271 getComponent()->install(target); \ 274 getComponent()->uninstall(); \ 276 void undoIsDone() { \ 277 getComponent()->undoIsDone(); \ 279 tlp::Interactor *getComponent() const { \ 282 tlp::PluginLister::getPluginObject<Interactor>(BASE_INTERACTOR_STRING_NAME, nullptr); \ 283 assert(_component != nullptr); \ 299 #define INTERACTORPLUGINVIEWEXTENSIONWITHPRIORITY(CLASS_NAME, STRING_CLASS_NAME, \ 300 BASE_INTERACTOR_STRING_NAME, VIEW_STRING_NAME, \ 301 AUTHOR, DATE, DESCRIPTION, VERSION, PRIORITY) \ 302 class CLASS_NAME : public tlp::Interactor { \ 303 mutable tlp::Interactor *_component; \ 306 std::string name() const { \ 307 return std::string(STRING_CLASS_NAME); \ 309 std::string author() const { \ 310 return std::string(AUTHOR); \ 312 std::string date() const { \ 313 return std::string(DATE); \ 315 std::string info() const { \ 316 return std::string(DESCRIPTION); \ 318 std::string release() const { \ 319 return std::string(VERSION); \ 321 std::string tulipRelease() const { \ 322 return std::string(TULIP_VERSION); \ 324 std::string group() const { \ 325 return getComponent()->group(); \ 327 CLASS_NAME(const PluginContext *) : _component(nullptr) {} \ 328 bool isCompatible(const std::string &viewName) const { \ 329 return viewName == VIEW_STRING_NAME; \ 331 QWidget *configurationWidget() const { \ 332 return getComponent()->configurationWidget(); \ 334 QLabel *configurationDocWidget() const { \ 335 return getComponent()->configurationDocWidget(); \ 337 QWidget *configurationActionsWidget() const { \ 338 return getComponent()->configurationOptionsWidget(); \ 340 unsigned int priority() const { \ 343 QAction *action() const { \ 344 return getComponent()->action(); \ 346 tlp::View *view() const { \ 347 return getComponent()->view(); \ 349 QCursor cursor() const { \ 350 return getComponent()->cursor(); \ 353 getComponent()->construct(); \ 355 void setView(tlp::View *v) { \ 356 getComponent()->setView(v); \ 358 void install(QObject *target) { \ 359 getComponent()->install(target); \ 362 getComponent()->uninstall(); \ 364 void undoIsDone() { \ 365 getComponent()->undoIsDone(); \ 367 tlp::Interactor *getComponent() const { \ 370 tlp::PluginLister::getPluginObject<Interactor>(BASE_INTERACTOR_STRING_NAME, nullptr); \ 371 assert(_component != nullptr); \
virtual QWidget * configurationWidget() const
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...
std::string icon() const override
The icon (preferably a thumbnail) of the plugin.