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

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

#include <WCTool.h>

Inheritance diagram for casa::WCTool:
casa::DisplayTool casa::WCCrosshairTool casa::WCInvisTool casa::WCPolyTool casa::WCRectTool casa::WCPTRegion casa::WCRTRegion casa::WCRTZoomer

List of all members.

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 WorldCanvasworldCanvas () const
 Get the WorldCanvas that this Tool is attached to.
virtual PixelCanvaspixelCanvas () 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.
WCTooloperator= (const WCTool &other)
 (Required) copy assignment.

Private Attributes

WorldCanvasitsWorldCanvas
 The WorldCanvas to which this is connected.
PixelCanvasitsPixelCanvas
 The PixelCanvas to which this is connected via the WorldCanvas.
Bool itsEventHandlersRegistered
 whether the event handlers are registered
WCToolPosEHitsPositionEH
 event handlers:
WCToolMotEHitsMotionEH
WCToolRefEHitsRefreshEH

Detailed Description

Base class for WorldCanvas event-based tools.

Intended use:

Public interface

Review Status

Date Reviewed:
yyyy/mm/dd

<prerequisites> WCPositionEH WCMotionEH WCRefreshEH </prerequisites>

Etymology

WCTool stands for WorldCanvas Tool

Synopsis

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.

Example

Motivation

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.

To Do

Definition at line 141 of file WCTool.h.


Constructor & Destructor Documentation

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.


Member Function Documentation

virtual void casa::WCTool::disable ( ) [virtual]
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]
virtual void casa::WCTool::moved ( const WCMotionEvent ,
const viewer::region::region_list_type  
) [virtual]
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]
WCTool& casa::WCTool::operator= ( const WCTool other) [protected]

(Required) copy assignment.

virtual void casa::WCTool::otherKeyPressed ( const WCPositionEvent ) [virtual]
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]
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.


Member Data Documentation

whether the event handlers are registered

Definition at line 209 of file WCTool.h.

Definition at line 213 of file WCTool.h.

The PixelCanvas to which this is connected via the WorldCanvas.

Definition at line 206 of file WCTool.h.

Referenced by pixelCanvas().

event handlers:

Definition at line 212 of file WCTool.h.

Definition at line 214 of file WCTool.h.

The WorldCanvas to which this is connected.

Definition at line 203 of file WCTool.h.

Referenced by worldCanvas().


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