casa  5.7.0-16
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Public Member Functions | Protected Member Functions | Private Attributes | List of all members
casa::PCTool Class Reference

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

#include <PCTool.h>

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

Public Member Functions

 PCTool (PixelCanvas *pcanvas, Display::KeySym keysym=Display::K_Pointer_Button1)
 Constructor. More...
 
virtual ~PCTool ()
 Destructor. More...
 
virtual void enable ()
 Switch the tool on/off. More...
 
virtual void disable ()
 
virtual void operator() (const PCPositionEvent &ev)
 Required operators for event handling. More...
 
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. More...
 
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. More...
 
virtual void setKey (const Display::KeySym &keysym)
 Set/get which key to catch. More...
 
virtual Display::KeySym getKey () const
 

Protected Member Functions

virtual casacore::Bool keyPresentlyDown (const PCMotionEvent &ev)
 Indicate whether key is presently pressed. More...
 

Private Attributes

PixelCanvasitsPixelCanvas
 The PixelCanvas to which this is connected. More...
 
Display::KeySym itsKeySym
 The key to handle. More...
 
Display::KeyModifier itsKeyModifier
 The modifier mask for the key. More...
 
casacore::Bool itsEventHandlersRegistered
 Whether the event handlers are currently registered. More...
 
PCToolPosEHitsPositionEH
 The event handlers. More...
 
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

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.

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
inlinevirtual

Definition at line 186 of file PCTool.h.

References itsKeySym.

virtual casacore::Bool casa::PCTool::keyPresentlyDown ( const PCMotionEvent ev)
protectedvirtual

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
inlinevirtual

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

casacore::Bool casa::PCTool::itsEventHandlersRegistered
private

Whether the event handlers are currently registered.

Definition at line 208 of file PCTool.h.

Display::KeyModifier casa::PCTool::itsKeyModifier
private

The modifier mask for the key.

Definition at line 205 of file PCTool.h.

Display::KeySym casa::PCTool::itsKeySym
private

The key to handle.

Definition at line 202 of file PCTool.h.

Referenced by getKey().

PCToolMotEH* casa::PCTool::itsMotionEH
private

Definition at line 212 of file PCTool.h.

PixelCanvas* casa::PCTool::itsPixelCanvas
private

The PixelCanvas to which this is connected.

Definition at line 199 of file PCTool.h.

Referenced by pixelCanvas().

PCToolPosEH* casa::PCTool::itsPositionEH
private

The event handlers.

Definition at line 211 of file PCTool.h.

PCToolRefEH* casa::PCTool::itsRefreshEH
private

Definition at line 213 of file PCTool.h.


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