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 static QMap<std::string, QList<std::string>> _compatibilityMap;
183 static void initInteractorsDependencies();
184 static QList<std::string> compatibleInteractors(
const std::string &viewName);
210 #define INTERACTORPLUGINVIEWEXTENSION(CLASS_NAME, STRING_CLASS_NAME, BASE_INTERACTOR_STRING_NAME, \ 211 VIEW_STRING_NAME, AUTHOR, DATE, DESCRIPTION, VERSION) \ 212 class CLASS_NAME : public tlp::Interactor { \ 213 mutable tlp::Interactor *_component; \ 216 std::string name() const { \ 217 return std::string(STRING_CLASS_NAME); \ 219 std::string author() const { \ 220 return std::string(AUTHOR); \ 222 std::string date() const { \ 223 return std::string(DATE); \ 225 std::string info() const { \ 226 return std::string(DESCRIPTION); \ 228 std::string release() const { \ 229 return std::string(VERSION); \ 231 std::string tulipRelease() const { \ 232 return std::string(TULIP_VERSION); \ 234 std::string group() const { \ 235 return getComponent()->group(); \ 237 CLASS_NAME(const PluginContext *) : _component(nullptr) {} \ 238 bool isCompatible(const std::string &viewName) const { \ 239 return viewName == VIEW_STRING_NAME; \ 241 QWidget *configurationWidget() const { \ 242 return getComponent()->configurationWidget(); \ 244 QLabel *configurationDocWidget() const { \ 245 return getComponent()->configurationDocWidget(); \ 247 QWidget *configurationActionsWidget() const { \ 248 return getComponent()->configurationOptionsWidget(); \ 250 unsigned int priority() const { \ 251 return getComponent()->priority(); \ 253 QAction *action() const { \ 254 return getComponent()->action(); \ 256 tlp::View *view() const { \ 257 return getComponent()->view(); \ 259 QCursor cursor() const { \ 260 return getComponent()->cursor(); \ 263 getComponent()->construct(); \ 265 void setView(tlp::View *v) { \ 266 getComponent()->setView(v); \ 268 void install(QObject *target) { \ 269 getComponent()->install(target); \ 272 getComponent()->uninstall(); \ 274 void undoIsDone() { \ 275 getComponent()->undoIsDone(); \ 277 tlp::Interactor *getComponent() const { \ 279 _component = tlp::PluginLister::instance()->getPluginObject<Interactor>( \ 280 BASE_INTERACTOR_STRING_NAME, nullptr); \ 281 assert(_component != nullptr); \ 297 #define INTERACTORPLUGINVIEWEXTENSIONWITHPRIORITY(CLASS_NAME, STRING_CLASS_NAME, \ 298 BASE_INTERACTOR_STRING_NAME, VIEW_STRING_NAME, \ 299 AUTHOR, DATE, DESCRIPTION, VERSION, PRIORITY) \ 300 class CLASS_NAME : public tlp::Interactor { \ 301 mutable tlp::Interactor *_component; \ 304 std::string name() const { \ 305 return std::string(STRING_CLASS_NAME); \ 307 std::string author() const { \ 308 return std::string(AUTHOR); \ 310 std::string date() const { \ 311 return std::string(DATE); \ 313 std::string info() const { \ 314 return std::string(DESCRIPTION); \ 316 std::string release() const { \ 317 return std::string(VERSION); \ 319 std::string tulipRelease() const { \ 320 return std::string(TULIP_VERSION); \ 322 std::string group() const { \ 323 return getComponent()->group(); \ 325 CLASS_NAME(const PluginContext *) : _component(nullptr) {} \ 326 bool isCompatible(const std::string &viewName) const { \ 327 return viewName == VIEW_STRING_NAME; \ 329 QWidget *configurationWidget() const { \ 330 return getComponent()->configurationWidget(); \ 332 QLabel *configurationDocWidget() const { \ 333 return getComponent()->configurationDocWidget(); \ 335 QWidget *configurationActionsWidget() const { \ 336 return getComponent()->configurationOptionsWidget(); \ 338 unsigned int priority() const { \ 341 QAction *action() const { \ 342 return getComponent()->action(); \ 344 tlp::View *view() const { \ 345 return getComponent()->view(); \ 347 QCursor cursor() const { \ 348 return getComponent()->cursor(); \ 351 getComponent()->construct(); \ 353 void setView(tlp::View *v) { \ 354 getComponent()->setView(v); \ 356 void install(QObject *target) { \ 357 getComponent()->install(target); \ 360 getComponent()->uninstall(); \ 362 void undoIsDone() { \ 363 getComponent()->undoIsDone(); \ 365 tlp::Interactor *getComponent() const { \ 367 _component = tlp::PluginLister::instance()->getPluginObject<Interactor>( \ 368 BASE_INTERACTOR_STRING_NAME, nullptr); \ 369 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...
The InteractorLister class lists compatible interactors for a given tlp::View.
std::string icon() const override
The icon (preferably a thumbnail) of the plugin.