casa
$Rev:20696$
|
Base class for WorldCanvas event-based tools. More...
#include <WCTool.h>
Public Member Functions | |
WCTool (WorldCanvas *wcanvas, const Display::KeySym &keysym=Display::K_Pointer_Button1) | |
Constructor taking a pointer to a WorldCanvas to which this tool will attach, and a primary key to respond to. | |
virtual | ~WCTool () |
Destructor. | |
virtual void | enable () |
Switch the tool on/off - this simply registers or unregisters the event handlers. | |
virtual void | disable () |
virtual void | operator() (const WCPositionEvent &ev) |
Required operators for event handling - these are called when an events occur, and distribute the events to the "user-level" methods. | |
virtual void | operator() (const WCMotionEvent &ev) |
virtual void | operator() (const WCRefreshEvent &ev) |
virtual void | keyPressed (const WCPositionEvent &) |
Functions called by the local event handling operators - by default they do nothing, so a derived class needs only implement the events it cares about. | |
virtual void | keyReleased (const WCPositionEvent &) |
virtual void | otherKeyPressed (const WCPositionEvent &) |
virtual void | otherKeyReleased (const WCPositionEvent &) |
virtual void | moved (const WCMotionEvent &, const viewer::region::region_list_type &) |
virtual void | refresh (const WCRefreshEvent &) |
virtual WorldCanvas * | worldCanvas () const |
Get the WorldCanvas that this Tool is attached to. | |
virtual PixelCanvas * | pixelCanvas () const |
Get the PixelCanvas that this Tool is attached to via its WorldCanvas. | |
Protected Member Functions | |
WCTool () | |
(Required) default constructor. | |
WCTool (const WCTool &other) | |
(Required) copy constructor. | |
WCTool & | operator= (const WCTool &other) |
(Required) copy assignment. | |
Private Attributes | |
WorldCanvas * | itsWorldCanvas |
The WorldCanvas to which this is connected. | |
PixelCanvas * | itsPixelCanvas |
The PixelCanvas to which this is connected via the WorldCanvas. | |
Bool | itsEventHandlersRegistered |
whether the event handlers are registered | |
WCToolPosEH * | itsPositionEH |
event handlers: | |
WCToolMotEH * | itsMotionEH |
WCToolRefEH * | itsRefreshEH |
Base class for WorldCanvas event-based tools.
Public interface
<prerequisites> WCPositionEH WCMotionEH WCRefreshEH </prerequisites>
WCTool stands for WorldCanvas Tool
This class is a base class upon which tools which respond to various events on a WorldCanvas can be built. It wraps up the position, motion and refresh events so that the programmer sees them all coming into one class, where they can be dealt with in a unified manner. WCTool is not actually abstract, so the programmer need only write handlers for the events in which they are interested.
The majority of tools written for the WorldCanvas will fall into the category that this class serves: they respond to a single key or mouse button, and they potentially need to respond to position, motion and refresh events.
casa::WCTool::WCTool | ( | WorldCanvas * | wcanvas, |
const Display::KeySym & | keysym = Display::K_Pointer_Button1 |
||
) |
Constructor taking a pointer to a WorldCanvas to which this tool will attach, and a primary key to respond to.
virtual casa::WCTool::~WCTool | ( | ) | [virtual] |
Destructor.
casa::WCTool::WCTool | ( | ) | [protected] |
(Required) default constructor.
casa::WCTool::WCTool | ( | const WCTool & | other | ) | [protected] |
(Required) copy constructor.
virtual void casa::WCTool::disable | ( | ) | [virtual] |
Implements casa::DisplayTool.
Reimplemented in casa::WCCrosshairTool, casa::WCPolyTool, and casa::WCRectTool.
virtual void casa::WCTool::enable | ( | ) | [virtual] |
Switch the tool on/off - this simply registers or unregisters the event handlers.
Implements casa::DisplayTool.
virtual void casa::WCTool::keyPressed | ( | const WCPositionEvent & | ) | [virtual] |
Functions called by the local event handling operators - by default they do nothing, so a derived class needs only implement the events it cares about.
Reimplemented in casa::WCCrosshairTool, casa::WCPolyTool, casa::WCRectTool, and casa::WCInvisTool.
virtual void casa::WCTool::keyReleased | ( | const WCPositionEvent & | ) | [virtual] |
Reimplemented in casa::WCCrosshairTool, casa::WCPolyTool, casa::WCRectTool, and casa::WCInvisTool.
virtual void casa::WCTool::moved | ( | const WCMotionEvent & | , |
const viewer::region::region_list_type & | |||
) | [virtual] |
Reimplemented in casa::WCCrosshairTool, casa::WCPolyTool, casa::WCRectTool, and casa::WCInvisTool.
virtual void casa::WCTool::operator() | ( | const WCPositionEvent & | ev | ) | [virtual] |
Required operators for event handling - these are called when an events occur, and distribute the events to the "user-level" methods.
virtual void casa::WCTool::operator() | ( | const WCMotionEvent & | ev | ) | [virtual] |
virtual void casa::WCTool::operator() | ( | const WCRefreshEvent & | ev | ) | [virtual] |
virtual void casa::WCTool::otherKeyPressed | ( | const WCPositionEvent & | ) | [virtual] |
Reimplemented in casa::WCCrosshairTool, casa::WCPolyTool, and casa::WCRectTool.
virtual void casa::WCTool::otherKeyReleased | ( | const WCPositionEvent & | ) | [virtual] |
virtual PixelCanvas* casa::WCTool::pixelCanvas | ( | ) | const [inline, virtual] |
Get the PixelCanvas that this Tool is attached to via its WorldCanvas.
Definition at line 186 of file WCTool.h.
References itsPixelCanvas.
virtual void casa::WCTool::refresh | ( | const WCRefreshEvent & | ) | [virtual] |
Reimplemented in casa::WCCrosshairTool, casa::WCPolyTool, and casa::WCRectTool.
virtual WorldCanvas* casa::WCTool::worldCanvas | ( | ) | const [inline, virtual] |
Get the WorldCanvas that this Tool is attached to.
Definition at line 182 of file WCTool.h.
References itsWorldCanvas.
Bool casa::WCTool::itsEventHandlersRegistered [private] |
WCToolMotEH* casa::WCTool::itsMotionEH [private] |
PixelCanvas* casa::WCTool::itsPixelCanvas [private] |
The PixelCanvas to which this is connected via the WorldCanvas.
Definition at line 206 of file WCTool.h.
Referenced by pixelCanvas().
WCToolPosEH* casa::WCTool::itsPositionEH [private] |
WCToolRefEH* casa::WCTool::itsRefreshEH [private] |
WorldCanvas* casa::WCTool::itsWorldCanvas [private] |
The WorldCanvas to which this is connected.
Definition at line 203 of file WCTool.h.
Referenced by worldCanvas().