23 #include <tulip/Plugin.h>
35 static const std::string INTERACTOR_CATEGORY =
"Interactor";
55 Q_PROPERTY(
unsigned int priority READ priority)
56 Q_PROPERTY(QAction* action READ action)
57 Q_PROPERTY(
tlp::View* view READ view WRITE setView)
58 Q_PROPERTY(QCursor cursor READ cursor)
62 return INTERACTOR_CATEGORY;
65 return ":/tulip/gui/icons/32/plugin_interactor.png";
71 virtual bool isCompatible(
const std::string& viewName)
const=0;
79 virtual QWidget* configurationWidget()
const=0;
86 virtual unsigned int priority()
const=0;
93 virtual QAction* action()
const=0;
105 virtual QCursor cursor()
const=0;
111 virtual void construct()=0;
125 virtual void install(QObject* target)=0;
131 virtual void uninstall()=0;
136 virtual void undoIsDone()=0;
144 return QObject::eventFilter(obj,ev);
153 static QMap<std::string,QList<std::string> > _compatibilityMap;
155 static void initInteractorsDependencies();
156 static QList<std::string> compatibleInteractors(
const std::string& viewName);
178 #define INTERACTORPLUGINVIEWEXTENSION(CLASS_NAME,STRING_CLASS_NAME,BASE_INTERACTOR_STRING_NAME,VIEW_STRING_NAME,AUTHOR,DATE,DESCRIPTION,VERSION)\
179 class CLASS_NAME : public tlp::Interactor {\
180 mutable tlp::Interactor* _component;\
182 std::string name() const { return std::string(STRING_CLASS_NAME); } \
183 std::string author() const { return std::string(AUTHOR); }\
184 std::string date() const { return std::string(DATE); } \
185 std::string info() const { return std::string(DESCRIPTION); } \
186 std::string release() const { return std::string(VERSION); }\
187 std::string tulipRelease() const { return std::string(TULIP_VERSION); }\
188 std::string group() const { return getComponent()->group(); }\
189 CLASS_NAME(const PluginContext *):_component(NULL) {}\
190 bool isCompatible(const std::string& viewName) const { return viewName == VIEW_STRING_NAME; }\
191 QWidget* configurationWidget() const { return getComponent()->configurationWidget(); }\
192 unsigned int priority() const { return getComponent()->priority(); }\
193 QAction* action() const { return getComponent()->action(); }\
194 tlp::View* view() const { return getComponent()->view(); }\
195 QCursor cursor() const { return getComponent()->cursor(); }\
196 void construct() { getComponent()->construct(); }\
197 void setView(tlp::View* v) { getComponent()->setView(v); }\
198 void install(QObject* target) { getComponent()->install(target); }\
199 void uninstall() { getComponent()->uninstall(); }\
200 void undoIsDone() { getComponent()->undoIsDone(); }\
201 tlp::Interactor* getComponent() const {\
203 _component = tlp::PluginLister::instance()->getPluginObject<Interactor>(BASE_INTERACTOR_STRING_NAME,NULL); assert(_component != NULL);\
217 #define INTERACTORPLUGINVIEWEXTENSIONWITHPRIORITY(CLASS_NAME,STRING_CLASS_NAME,BASE_INTERACTOR_STRING_NAME,VIEW_STRING_NAME,AUTHOR,DATE,DESCRIPTION,VERSION,PRIORITY) \
218 class CLASS_NAME : public tlp::Interactor {\
219 mutable tlp::Interactor* _component;\
221 std::string name() const { return std::string(STRING_CLASS_NAME); } \
222 std::string author() const { return std::string(AUTHOR); }\
223 std::string date() const { return std::string(DATE); } \
224 std::string info() const { return std::string(DESCRIPTION); } \
225 std::string release() const { return std::string(VERSION); }\
226 std::string tulipRelease() const { return std::string(TULIP_VERSION); }\
227 std::string group() const { return getComponent()->group(); }\
228 CLASS_NAME(const PluginContext *):_component(NULL) {}\
229 bool isCompatible(const std::string& viewName) const { return viewName == VIEW_STRING_NAME; }\
230 QWidget* configurationWidget() const { return getComponent()->configurationWidget(); }\
231 unsigned int priority() const { return PRIORITY; }\
232 QAction* action() const { return getComponent()->action(); }\
233 tlp::View* view() const { return getComponent()->view(); }\
234 QCursor cursor() const { return getComponent()->cursor(); }\
235 void construct() { getComponent()->construct(); }\
236 void setView(tlp::View* v) { getComponent()->setView(v); }\
237 void install(QObject* target) { getComponent()->install(target); }\
238 void uninstall() { getComponent()->uninstall(); }\
239 void undoIsDone() { getComponent()->undoIsDone(); }\
240 tlp::Interactor* getComponent() const {\
242 _component = tlp::PluginLister::instance()->getPluginObject<Interactor>(BASE_INTERACTOR_STRING_NAME,NULL); assert(_component != NULL);\
Interactor provides a way to handle user inputs over a view. Basically, The interactor class is an ov...
virtual bool eventFilter(QObject *obj, QEvent *ev)
Provides input filtering for the interactor.
virtual std::string category() const
A string identifier for a plugin used for categorization purposes.
Top-level interface for plug-ins.
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
The icon (preferably a thumbnail) of the plugin.