23 #include <tulip/Plugin.h> 24 #include <tulip/PluginLister.h> 37 static const std::string INTERACTOR_CATEGORY =
"Interactor";
65 Q_PROPERTY(
unsigned int priority READ priority)
66 Q_PROPERTY(QAction *action READ action)
67 Q_PROPERTY(
tlp::View *view READ view WRITE setView)
68 Q_PROPERTY(QCursor cursor READ cursor)
72 return INTERACTOR_CATEGORY;
74 std::string
icon()
const override {
75 return ":/tulip/gui/icons/32/plugin_interactor.png";
83 virtual bool isCompatible(
const std::string &viewName)
const = 0;
97 virtual QLabel *configurationDocWidget()
const {
100 virtual QWidget *configurationOptionsWidget()
const {
110 virtual unsigned int priority()
const = 0;
117 virtual QAction *action()
const = 0;
130 virtual QCursor cursor()
const = 0;
136 virtual void construct() = 0;
153 virtual void install(QObject *target) = 0;
159 virtual void uninstall() = 0;
164 virtual void undoIsDone() = 0;
172 return QObject::eventFilter(obj, ev);
181 class TLP_QT_SCOPE InteractorLister {
182 static QMap<std::string, QList<std::string>> _compatibilityMap;
185 static void initInteractorsDependencies();
186 static QList<std::string> compatibleInteractors(
const std::string &viewName);
213 #define INTERACTORPLUGINVIEWEXTENSION(CLASS_NAME, STRING_CLASS_NAME, BASE_INTERACTOR_STRING_NAME, \ 214 VIEW_STRING_NAME, AUTHOR, DATE, DESCRIPTION, VERSION) \ 215 class CLASS_NAME : public tlp::Interactor { \ 216 mutable tlp::Interactor *_component; \ 219 std::string name() const { \ 220 return std::string(STRING_CLASS_NAME); \ 222 std::string author() const { \ 223 return std::string(AUTHOR); \ 225 std::string date() const { \ 226 return std::string(DATE); \ 228 std::string info() const { \ 229 return std::string(DESCRIPTION); \ 231 std::string release() const { \ 232 return std::string(VERSION); \ 234 std::string tulipRelease() const { \ 235 return std::string(TULIP_VERSION); \ 237 std::string group() const { \ 238 return getComponent()->group(); \ 240 CLASS_NAME(const PluginContext *) : _component(nullptr) {} \ 241 bool isCompatible(const std::string &viewName) const { \ 242 return viewName == VIEW_STRING_NAME; \ 244 QWidget *configurationWidget() const { \ 245 return getComponent()->configurationWidget(); \ 247 QLabel *configurationDocWidget() const { \ 248 return getComponent()->configurationDocWidget(); \ 250 QWidget *configurationActionsWidget() const { \ 251 return getComponent()->configurationOptionsWidget(); \ 253 unsigned int priority() const { \ 254 return getComponent()->priority(); \ 256 QAction *action() const { \ 257 return getComponent()->action(); \ 259 tlp::View *view() const { \ 260 return getComponent()->view(); \ 262 QCursor cursor() const { \ 263 return getComponent()->cursor(); \ 266 getComponent()->construct(); \ 268 void setView(tlp::View *v) { \ 269 getComponent()->setView(v); \ 271 void install(QObject *target) { \ 272 getComponent()->install(target); \ 275 getComponent()->uninstall(); \ 277 void undoIsDone() { \ 278 getComponent()->undoIsDone(); \ 280 tlp::Interactor *getComponent() const { \ 283 tlp::PluginLister::getPluginObject<Interactor>(BASE_INTERACTOR_STRING_NAME, nullptr); \ 284 assert(_component != nullptr); \ 300 #define INTERACTORPLUGINVIEWEXTENSIONWITHPRIORITY(CLASS_NAME, STRING_CLASS_NAME, \ 301 BASE_INTERACTOR_STRING_NAME, VIEW_STRING_NAME, \ 302 AUTHOR, DATE, DESCRIPTION, VERSION, PRIORITY) \ 303 class CLASS_NAME : public tlp::Interactor { \ 304 mutable tlp::Interactor *_component; \ 307 std::string name() const { \ 308 return std::string(STRING_CLASS_NAME); \ 310 std::string author() const { \ 311 return std::string(AUTHOR); \ 313 std::string date() const { \ 314 return std::string(DATE); \ 316 std::string info() const { \ 317 return std::string(DESCRIPTION); \ 319 std::string release() const { \ 320 return std::string(VERSION); \ 322 std::string tulipRelease() const { \ 323 return std::string(TULIP_VERSION); \ 325 std::string group() const { \ 326 return getComponent()->group(); \ 328 CLASS_NAME(const PluginContext *) : _component(nullptr) {} \ 329 bool isCompatible(const std::string &viewName) const { \ 330 return viewName == VIEW_STRING_NAME; \ 332 QWidget *configurationWidget() const { \ 333 return getComponent()->configurationWidget(); \ 335 QLabel *configurationDocWidget() const { \ 336 return getComponent()->configurationDocWidget(); \ 338 QWidget *configurationActionsWidget() const { \ 339 return getComponent()->configurationOptionsWidget(); \ 341 unsigned int priority() const { \ 344 QAction *action() const { \ 345 return getComponent()->action(); \ 347 tlp::View *view() const { \ 348 return getComponent()->view(); \ 350 QCursor cursor() const { \ 351 return getComponent()->cursor(); \ 354 getComponent()->construct(); \ 356 void setView(tlp::View *v) { \ 357 getComponent()->setView(v); \ 359 void install(QObject *target) { \ 360 getComponent()->install(target); \ 363 getComponent()->uninstall(); \ 365 void undoIsDone() { \ 366 getComponent()->undoIsDone(); \ 368 tlp::Interactor *getComponent() const { \ 371 tlp::PluginLister::getPluginObject<Interactor>(BASE_INTERACTOR_STRING_NAME, nullptr); \ 372 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.