22 #include <unordered_set>
28 #include <tulip/tulipconf.h>
29 #include <tulip/Edge.h>
30 #include <tulip/Interactor.h>
31 #include <tulip/Observable.h>
32 #include <tulip/Plugin.h>
43 static const std::string VIEW_CATEGORY =
"Panel";
46 class ViewToolTipAndUrlManager;
97 std::list<tlp::Interactor *> _interactors;
100 tlp::ViewToolTipAndUrlManager *_tturlManager;
101 bool interactorsActivated;
103 std::list<tlp::Observable *> _triggers;
104 bool _displayContextMenu;
123 return VIEW_CATEGORY;
125 std::string
icon()
const override {
126 return ":/tulip/gui/icons/32/plugin_view.png";
138 virtual void resetGraphicsScene() {}
143 virtual bool rebuildSceneOnShowEvent() {
150 virtual bool centeredWhenAddedToWorkspace() {
176 return interactorsActivated;
227 virtual QPixmap
snapshot(
const QSize &outputSize = QSize())
const = 0;
241 _displayContextMenu = show;
402 void interactorsChanged();
438 void toggleInteractors(
const bool activate,
const std::unordered_set<const char *> &exceptions);
A container that can store data from any type.
Event is the base class for all events used in the Observation mechanism.
Interactor provides a way to handle user inputs over a view. Basically, The interactor class is an ov...
The Observable class is the base of Tulip's observation system.
Top-level interface for plug-ins.
View plugins provide a way to dynamically add to a Tulip plateform various ways to visualize a graph.
DataSet getState(Graph *graph)
retrieve the view saved state associated to the graph
virtual QGraphicsView * graphicsView() const =0
void activateTooltipAndUrlManager(QWidget *)
activate the management of tooltips and urls through the context menu
void toggleInteractors(const bool activate, const std::unordered_set< const char * > &exceptions)
Activate or deactivate interactors in the view.
void fillContextMenu(QMenu *menu, node n)
fills the context menu with entries related to the node.
~View() override
Destructor View's GUI components (graphics view, configuration widgets) responsibility belongs to the...
virtual void draw()=0
Asks the view to draw. A call to draw() means that internal data has most probably been modified and ...
virtual QPixmap snapshot(const QSize &outputSize=QSize()) const =0
Takes a snapshot of the view's screen and saves it into the given pixmap. The snapshot is scaled to o...
virtual void fillContextMenu(QMenu *, const QPointF &)
fills the context menu with entries related to the view. This method is called whenever the context m...
virtual void setupUi()=0
Sets up GUI elements belonging to the View. This method is called once the initial state as been set ...
virtual bool getNodeOrEdgeAtViewportPos(int, int, node &, edge &) const
indicate which node or edge is under the (x, y) position in graphicsView()->viewport()
std::string icon() const override
The icon (preferably a thumbnail) of the plugin.
virtual void setInteractors(const std::list< tlp::Interactor * > &)
defines the list of interactors available on this View
void setGraph(tlp::Graph *graph)
Defines the graph that should be displayed by the View.
virtual void refresh()
Refresh the View's panel. Calling refresh() means that no internal data has been modified....
virtual void graphDeleted(tlp::Graph *parentGraph)=0
Called when the graph associated to the view gets deleted. This method should call setGraph to input ...
View()
Default constructor.
void treatEvents(const std::vector< Event > &events) override
reimplemented from tlp::Observable to provide the triggers mechanism.
virtual void centerView(bool graphChanged=false)
Reset the visualization to the center. This method is called after major changes into the data struct...
const std::list< Interactor * > & interactors() const
virtual void currentInteractorChanged(tlp::Interactor *)
Callback method after setCurrentInteractor() was called. At this point, a call to View::currentIntera...
void setCurrentInteractor(tlp::Interactor *currentInteractor)
defines the active interactor that will receive user inputs.
virtual void interactorsInstalled(const std::list< tlp::Interactor * > &interactors)
Callback method after setInteractors() was called. At this point, a call to View::interactors() is co...
tlp::Graph * graph() const
std::string category() const override
A string identifier for a plugin used for categorization purposes.
void addRedrawTrigger(tlp::Observable *)
Registers a new trigger for automatic view drawing. Triggers are tlp::Observable subclasses....
void clearRedrawTriggers()
Clears the list of attached triggers This method removes all triggers associated to the View.
virtual bool checkOnClose()
allow to add some check when a user want to close a view.
virtual std::list< QWidget * > configurationWidgets() const
void setShowContextMenu(bool show)
This method allows to control the display of the context menu.
void saveState()
Save view state associated to the current graph.
void emitDrawNeededSignal()
This function emit the signal drawNeeded.
virtual tlp::DataSet state() const
Backup the state of the view. This method is used to restore the View's parameters when it's re-opene...
void fillContextMenu(QMenu *menu, edge e)
fills the context menu with entries related to the edge.
void removeRedrawTrigger(tlp::Observable *)
Removes a trigger from the list of registered triggers. Event coming from this trigger will no longer...
std::list< tlp::Observable * > triggers() const
tlp::Interactor * currentInteractor() const
virtual QGraphicsItem * centralItem() const
defines which item is considered as the central item in the view. The central item is considered to b...
bool showContextMenu(const QPoint &point, const QPointF &scenePoint)
This method is called whenever the context menu is required on the view.
virtual void graphChanged(tlp::Graph *)=0
Callback method after setGraph() was called. At this point, a call to View::graph() is considered val...
virtual void undoCallback()
This method is a callback to notify the panel that the pop() method (undo) has just been called on th...
void treatEvent(const Event &) override
This method is inherited from tlp::Observable and allows the view to trigger custom callback when its...
void drawNeeded()
Inform the overlying subsystem that this view needs to be drawn.
virtual bool interactorsEnabled() const
interactorsEnabled indicates if interactors are enabled or not
virtual void applySettings()
This method applies settings changed in the configuration widgets This method may be called from the ...
void graphSet(tlp::Graph *)
Emitted after the setGraph method has been called.
virtual void setState(const tlp::DataSet &)
Restores the state of the view. DataSet passed down to this method can come from a previous backup or...
The edge struct represents an edge in a Graph object.
The node struct represents a node in a Graph object.