casa
$Rev:20696$
|
Base class for PixelCanvas event-based tools. More...
#include <PCTool.h>
Public Member Functions | |
PCTool (PixelCanvas *pcanvas, Display::KeySym keysym=Display::K_Pointer_Button1) | |
Constructor. | |
virtual | ~PCTool () |
Destructor. | |
virtual void | enable () |
Switch the tool on/off. | |
virtual void | disable () |
virtual void | operator() (const PCPositionEvent &ev) |
Required operators for event handling. | |
virtual void | operator() (const PCMotionEvent &ev) |
virtual void | operator() (const PCRefreshEvent &ev) |
virtual void | keyPressed (const PCPositionEvent &ev) |
Functions called by the local event handling operators. | |
virtual void | keyReleased (const PCPositionEvent &ev) |
virtual void | otherKeyPressed (const PCPositionEvent &ev) |
virtual void | otherKeyReleased (const PCPositionEvent &ev) |
virtual void | moved (const PCMotionEvent &ev) |
virtual void | refresh (const PCRefreshEvent &ev) |
virtual PixelCanvas * | pixelCanvas () const |
Get the PixelCanvas to which this Tool is attached. | |
virtual void | setKey (const Display::KeySym &keysym) |
Set/get which key to catch. | |
virtual Display::KeySym | getKey () const |
Protected Member Functions | |
virtual Bool | keyPresentlyDown (const PCMotionEvent &ev) |
Private Attributes | |
PixelCanvas * | itsPixelCanvas |
The PixelCanvas to which this is connected. | |
Display::KeySym | itsKeySym |
The key to handle. | |
Display::KeyModifier | itsKeyModifier |
The modifier mask for the key. | |
Bool | itsEventHandlersRegistered |
Whether the event handlers are currently registered. | |
PCToolPosEH * | itsPositionEH |
The event handlers. | |
PCToolMotEH * | itsMotionEH |
PCToolRefEH * | itsRefreshEH |
Base class for PixelCanvas event-based tools.
Public interface
<prerequisites> PCPositionEH PCMotionEH PCRefreshEH </prerequisites>
PCTool stands for PixelCanvas Tool.
This class is a base class upon which tools which respond to various events on a PixelCanvas 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. PCTool 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 PixelCanvas 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::PCTool::PCTool | ( | PixelCanvas * | pcanvas, |
Display::KeySym | keysym = Display::K_Pointer_Button1 |
||
) |
Constructor.
A PixelCanvas to attach to must be specified, and normally a key to respond to as well.
virtual casa::PCTool::~PCTool | ( | ) | [virtual] |
Destructor.
virtual void casa::PCTool::disable | ( | ) | [virtual] |
virtual void casa::PCTool::enable | ( | ) | [virtual] |
Switch the tool on/off.
This simply registers or unregisters the event handlers.
virtual Display::KeySym casa::PCTool::getKey | ( | ) | const [inline, virtual] |
virtual Bool casa::PCTool::keyPresentlyDown | ( | const PCMotionEvent & | ev | ) | [protected, virtual] |
Indicate whether key is presently pressed.
virtual void casa::PCTool::keyPressed | ( | const PCPositionEvent & | ev | ) | [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::PCInvisTool.
virtual void casa::PCTool::keyReleased | ( | const PCPositionEvent & | ev | ) | [virtual] |
virtual void casa::PCTool::moved | ( | const PCMotionEvent & | ev | ) | [virtual] |
Reimplemented in casa::PCInvisTool.
virtual void casa::PCTool::operator() | ( | const PCPositionEvent & | ev | ) | [virtual] |
Required operators for event handling.
These are called when events occur, and distribute the events to the "user-level" methods.
virtual void casa::PCTool::operator() | ( | const PCMotionEvent & | ev | ) | [virtual] |
virtual void casa::PCTool::operator() | ( | const PCRefreshEvent & | ev | ) | [virtual] |
virtual void casa::PCTool::otherKeyPressed | ( | const PCPositionEvent & | ev | ) | [virtual] |
virtual void casa::PCTool::otherKeyReleased | ( | const PCPositionEvent & | ev | ) | [virtual] |
virtual PixelCanvas* casa::PCTool::pixelCanvas | ( | ) | const [inline, virtual] |
Get the PixelCanvas to which this Tool is attached.
Definition at line 179 of file PCTool.h.
References itsPixelCanvas.
virtual void casa::PCTool::refresh | ( | const PCRefreshEvent & | ev | ) | [virtual] |
virtual void casa::PCTool::setKey | ( | const Display::KeySym & | keysym | ) | [virtual] |
Set/get which key to catch.
Bool casa::PCTool::itsEventHandlersRegistered [private] |
Display::KeySym casa::PCTool::itsKeySym [private] |
PCToolMotEH* casa::PCTool::itsMotionEH [private] |
PixelCanvas* casa::PCTool::itsPixelCanvas [private] |
The PixelCanvas to which this is connected.
Definition at line 197 of file PCTool.h.
Referenced by pixelCanvas().
PCToolPosEH* casa::PCTool::itsPositionEH [private] |
PCToolRefEH* casa::PCTool::itsRefreshEH [private] |