Tulip  4.6.0
Better Visualization Through Research
tlp::Interactor Class Reference

#include <Interactor.h>

+ Inheritance diagram for tlp::Interactor:
+ Collaboration diagram for tlp::Interactor:

List of all members.

Public Slots

virtual void install (QObject *target)=0
virtual void setView (tlp::View *)=0
virtual void undoIsDone ()=0
virtual void uninstall ()=0

Public Member Functions

virtual QAction * action () const =0
virtual std::string category () const
virtual QWidget * configurationWidget () const =0
virtual void construct ()=0
virtual QCursor cursor () const =0
std::string icon () const
virtual bool isCompatible (const std::string &viewName) const =0
virtual unsigned int priority () const =0
virtual tlp::Viewview () const =0

Protected Member Functions

virtual bool eventFilter (QObject *obj, QEvent *ev)

Properties

QAction action
QCursor cursor
unsigned int
tlp::View view

Detailed Description

Interactor provides a way to handle user inputs over a view. Basically, The interactor class is an overlay to the Qt's event filtering mechanism. It adds several features like the ability to define priorities, custom cursors, etc.

When an interactor is constructed, the following methods are called in this order:

  • The constructor. This method should almost be a no-op. Interactors may be instantiated by the plugin manager system and doing unneeded operations in the constructor may lead to poor performances when the application loads up.
  • isCompatible. When creating a View, the application will check for all interactors to see if they could be installed on it. This is done using the isCompatible method.
  • construct. Initialize the interactor. Since the constructor should be a no-op, initialization code should be put here.
  • setView. Defines the view this interactor is bound to. The Interactor may keep a reference to the view object to perform specific operations on user inputs.

Methods listed above are only called once. Once the interactor is initialized, it may be installed/removed several times on different QObjects. It will then repond to user inputs via the eventFilter method

See also:
QObject::eventFilter()
Examples:
interactor_plugin/interactor_plugin.cpp.

Definition at line 53 of file Interactor.h.


Member Function Documentation

virtual QAction* tlp::Interactor::action ( ) const [pure virtual]
Returns:
a QAction associated to this interactor. This is used by the overleying system to associate an icon/text to the interactor.
Warning:
The parent (QObject::parent()) object of this QAction MUST BE the Interactor.

Implemented in tlp::InteractorComposite.

virtual std::string tlp::Interactor::category ( ) const [inline, virtual]

A string identifier for a plugin used for categorization purposes.

Returns:
std::string the category of the plugin.

Implements tlp::Plugin.

Definition at line 61 of file Interactor.h.

virtual QWidget* tlp::Interactor::configurationWidget ( ) const [pure virtual]
Returns:
the configuration widget used to set up the interactor.
Warning:
This method MUST ALWAYS return the same pointer. Doing otherwise may lead to memory leaks.
Note:
The configuration widget has to be instantiated from the construct method.
It is up to the interactor developper to delete the configuration widget

Implemented in tlp::NodeLinkDiagramComponentInteractor.

virtual void tlp::Interactor::construct ( ) [pure virtual]

Builds up the interactor's internal state. This method should be used instead of the constructor to initialize the interactor.

virtual QCursor tlp::Interactor::cursor ( ) const [pure virtual]
Returns:
The cursor associated to this interactor. When the interactor gets active on a view, the View's cursor is changed to what this method returns.

Implemented in tlp::InteractorComposite.

virtual bool tlp::Interactor::eventFilter ( QObject *  obj,
QEvent *  ev 
) [inline, protected, virtual]

Provides input filtering for the interactor.

See also:
QObject::eventFilter()

Definition at line 143 of file Interactor.h.

std::string tlp::Interactor::icon ( ) const [inline, virtual]

The icon (preferably a thumbnail) of the plugin.

Returns:
std::string the icon path

Reimplemented from tlp::Plugin.

Definition at line 64 of file Interactor.h.

virtual void tlp::Interactor::install ( QObject *  target) [pure virtual, slot]

Install the interactor on the given target A call to this method means thatr the interactor should start listening to the target's events and handle them. Returning true prevents further handling of the event. Doing otherwise means that the interactor will let following filters to hand over this kind of event.

Implemented in tlp::InteractorComposite.

virtual bool tlp::Interactor::isCompatible ( const std::string &  viewName) const [pure virtual]

Checks the compatibility between the interactor and the given view (identified by its name). If this method returns true, it's very likely that the interactor will be installed on the associated view.

virtual unsigned int tlp::Interactor::priority ( ) const [pure virtual]
Returns:
the interactor's priority. Priority defines how interactors gets ordered when displayed in the View's toolbar. Interactors with the top-most priority value will be displayed at the beginning of the list while lowest priority will be position at the end.

Implemented in tlp::NodeLinkDiagramComponentInteractor.

virtual void tlp::Interactor::setView ( tlp::View ) [pure virtual, slot]

Defines the view object associated to this interactor.

Warning:
The view() method MUST ALWAYS return the same pointer as the one passed down to this method.

Implemented in tlp::InteractorComposite.

virtual void tlp::Interactor::undoIsDone ( ) [pure virtual, slot]

Informs the interactor when the undo command (Ctrl+Z) has been triggered.

Implemented in tlp::InteractorComposite.

virtual void tlp::Interactor::uninstall ( ) [pure virtual, slot]

Removes the interactor from the previously set target. Interactors can be installed on only one target at once.

Implemented in tlp::InteractorComposite.

virtual tlp::View* tlp::Interactor::view ( ) const [pure virtual]
Returns:
the View object associated to this Interactor.
Warning:
The returned object MUST be the same as the one passed down to the setView method.

Implemented in tlp::InteractorComposite.

 All Classes Files Functions Variables Enumerations Enumerator Properties