casa  $Rev:20696$
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines
Public Member Functions | Protected Member Functions | Private Attributes
casa::PCTool Class Reference

Base class for PixelCanvas event-based tools. More...

#include <PCTool.h>

Inheritance diagram for casa::PCTool:
casa::PCInvisTool casa::PCITFiddler

List of all members.

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 PixelCanvaspixelCanvas () 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

PixelCanvasitsPixelCanvas
 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.
PCToolPosEHitsPositionEH
 The event handlers.
PCToolMotEHitsMotionEH
PCToolRefEHitsRefreshEH

Detailed Description

Base class for PixelCanvas event-based tools.

Intended use:

Public interface

Review Status

Date Reviewed:
yyyy/mm/dd

<prerequisites> PCPositionEH PCMotionEH PCRefreshEH </prerequisites>

Etymology

PCTool stands for PixelCanvas Tool.

Synopsis

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.

Example

Motivation

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.

To Do

Definition at line 138 of file PCTool.h.


Constructor & Destructor Documentation

Constructor.

A PixelCanvas to attach to must be specified, and normally a key to respond to as well.

virtual casa::PCTool::~PCTool ( ) [virtual]

Destructor.


Member Function Documentation

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]

Definition at line 185 of file PCTool.h.

References itsKeySym.

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.


Member Data Documentation

Whether the event handlers are currently registered.

Definition at line 206 of file PCTool.h.

The modifier mask for the key.

Definition at line 203 of file PCTool.h.

The key to handle.

Definition at line 200 of file PCTool.h.

Referenced by getKey().

Definition at line 210 of file PCTool.h.

The PixelCanvas to which this is connected.

Definition at line 197 of file PCTool.h.

Referenced by pixelCanvas().

The event handlers.

Definition at line 209 of file PCTool.h.

Definition at line 211 of file PCTool.h.


The documentation for this class was generated from the following file: