23 #include <tulip/Plugin.h>
24 #include <tulip/PluginLister.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(QCursor cursor READ cursor)
70 return INTERACTOR_CATEGORY;
72 std::string
icon()
const override {
73 return ":/tulip/gui/icons/32/plugin_interactor.png";
95 virtual QLabel *configurationDocWidget()
const {
98 virtual QWidget *configurationOptionsWidget()
const {
185 return QObject::eventFilter(obj, ev);
194 class TLP_QT_SCOPE InteractorLister {
195 static QMap<std::string, std::list<std::string>> _compatibilityMap;
198 static void initInteractorsDependencies();
199 static std::list<std::string> compatibleInteractors(
const std::string &viewName);
226 #define INTERACTORPLUGINVIEWEXTENSION(CLASS_NAME, STRING_CLASS_NAME, BASE_INTERACTOR_STRING_NAME, \
227 VIEW_STRING_NAME, AUTHOR, DATE, DESCRIPTION, VERSION) \
228 class CLASS_NAME : public tlp::Interactor { \
229 mutable tlp::Interactor *_component; \
232 std::string name() const { \
233 return std::string(STRING_CLASS_NAME); \
235 std::string author() const { \
236 return std::string(AUTHOR); \
238 std::string date() const { \
239 return std::string(DATE); \
241 std::string info() const { \
242 return std::string(DESCRIPTION); \
244 std::string release() const { \
245 return std::string(VERSION); \
247 std::string tulipRelease() const { \
248 return std::string(TULIP_VERSION); \
250 std::string group() const { \
251 return getComponent()->group(); \
253 CLASS_NAME(const PluginContext *) : _component(nullptr) {} \
254 bool isCompatible(const std::string &viewName) const { \
255 return viewName == VIEW_STRING_NAME; \
257 QWidget *configurationWidget() const { \
258 return getComponent()->configurationWidget(); \
260 QLabel *configurationDocWidget() const { \
261 return getComponent()->configurationDocWidget(); \
263 QWidget *configurationActionsWidget() const { \
264 return getComponent()->configurationOptionsWidget(); \
266 unsigned int priority() const { \
267 return getComponent()->priority(); \
269 QAction *action() const { \
270 return getComponent()->action(); \
272 tlp::View *view() const { \
273 return getComponent()->view(); \
275 QCursor cursor() const { \
276 return getComponent()->cursor(); \
279 getComponent()->construct(); \
281 void setView(tlp::View *v) { \
282 getComponent()->setView(v); \
284 void install(QObject *target) { \
285 getComponent()->install(target); \
288 getComponent()->uninstall(); \
290 void undoIsDone() { \
291 getComponent()->undoIsDone(); \
293 tlp::Interactor *getComponent() const { \
296 tlp::PluginLister::getPluginObject<Interactor>(BASE_INTERACTOR_STRING_NAME, nullptr); \
297 assert(_component != nullptr); \
313 #define INTERACTORPLUGINVIEWEXTENSIONWITHPRIORITY(CLASS_NAME, STRING_CLASS_NAME, \
314 BASE_INTERACTOR_STRING_NAME, VIEW_STRING_NAME, \
315 AUTHOR, DATE, DESCRIPTION, VERSION, PRIORITY) \
316 class CLASS_NAME : public tlp::Interactor { \
317 mutable tlp::Interactor *_component; \
320 std::string name() const { \
321 return std::string(STRING_CLASS_NAME); \
323 std::string author() const { \
324 return std::string(AUTHOR); \
326 std::string date() const { \
327 return std::string(DATE); \
329 std::string info() const { \
330 return std::string(DESCRIPTION); \
332 std::string release() const { \
333 return std::string(VERSION); \
335 std::string tulipRelease() const { \
336 return std::string(TULIP_VERSION); \
338 std::string group() const { \
339 return getComponent()->group(); \
341 CLASS_NAME(const PluginContext *) : _component(nullptr) {} \
342 bool isCompatible(const std::string &viewName) const { \
343 return viewName == VIEW_STRING_NAME; \
345 QWidget *configurationWidget() const { \
346 return getComponent()->configurationWidget(); \
348 QLabel *configurationDocWidget() const { \
349 return getComponent()->configurationDocWidget(); \
351 QWidget *configurationActionsWidget() const { \
352 return getComponent()->configurationOptionsWidget(); \
354 unsigned int priority() const { \
357 QAction *action() const { \
358 return getComponent()->action(); \
360 tlp::View *view() const { \
361 return getComponent()->view(); \
363 QCursor cursor() const { \
364 return getComponent()->cursor(); \
367 getComponent()->construct(); \
369 void setView(tlp::View *v) { \
370 getComponent()->setView(v); \
372 void install(QObject *target) { \
373 getComponent()->install(target); \
376 getComponent()->uninstall(); \
378 void undoIsDone() { \
379 getComponent()->undoIsDone(); \
381 tlp::Interactor *getComponent() const { \
384 tlp::PluginLister::getPluginObject<Interactor>(BASE_INTERACTOR_STRING_NAME, nullptr); \
385 assert(_component != nullptr); \
Interactor provides a way to handle user inputs over a view. Basically, The interactor class is an ov...
virtual QAction * action() const =0
virtual void install(QObject *target)=0
Install the interactor on the given target A call to this method means that the interactor should sta...
virtual tlp::View * view() const =0
virtual QCursor cursor() const =0
virtual QWidget * configurationWidget() const
static void setupConfigWidget(QWidget *)
this method should be called before setting up the ui of an interactor config widget
virtual bool showContextMenu(const QPoint &, const QPointF &)
This method is called whenever the context menu is required on the view.
std::string category() const override
A string identifier for a plugin used for categorization purposes.
std::string icon() const override
The icon (preferably a thumbnail) of the plugin.
virtual void undoIsDone()=0
Informs the interactor when the undo command (Ctrl+Z) has been triggered.
virtual bool isCompatible(const std::string &viewName) const =0
Checks the compatibility between the interactor and the given view (identified by its name)....
bool eventFilter(QObject *obj, QEvent *ev) override
Provides input filtering for the interactor.
virtual void uninstall()=0
Removes the interactor from the previously set target. Interactors can be installed on only one targe...
virtual void construct()=0
Builds up the interactor's internal state. This method should be used instead of the constructor to i...
virtual unsigned int priority() const =0
virtual void setView(tlp::View *)=0
Defines the view object associated to this interactor.
Top-level interface for plug-ins.
View plugins provide a way to dynamically add to a Tulip plateform various ways to visualize a graph.