PCTool.h

Classes

PCToolPosEH -- PixelCanvas position event handler for PCTool. (full description)
PCToolMotEH -- PixelCanvas motion event handler for PCTool. (full description)
PCToolRefEH -- PixelCanvas refresh event handler for PCTool. (full description)
PCTool -- Base class for PixelCanvas event-based tools. (full description)

class PCToolPosEH : public PCPositionEH

Interface

Public Members
PCToolPosEH(PCTool *tool)
virtual ~PCToolPosEH()
virtual void operator()(const PCPositionEvent& ev)

Description

Synopsis

This class is a simple implementation of a PCPositionEH which passes PixelCanvas position events on to a single PCTool.

Member Description

PCToolPosEH(PCTool *tool)

virtual ~PCToolPosEH()

virtual void operator()(const PCPositionEvent& ev)


class PCToolMotEH : public PCMotionEH

Interface

PCToolMotEH(PCTool *tool)
virtual ~PCToolMotEH()
virtual void operator()(const PCMotionEvent& ev)

Description

Synopsis

This class is a simple implementation of a PCMotionEH which passes PixelCanvas motion events on to a single PCTool.

Member Description

PCToolMotEH(PCTool *tool)

virtual ~PCToolMotEH()

virtual void operator()(const PCMotionEvent& ev)


class PCToolRefEH : public PCRefreshEH

Interface

PCToolRefEH(PCTool *tool)
virtual ~PCToolRefEH()
virtual void operator()(const PCRefreshEvent& ev)

Description

Synopsis

This class is a simple implementation of a PCRefreshEH which passes PixelCanvas refresh events on to a single PCTool.

Member Description

PCToolRefEH(PCTool *tool)

virtual ~PCToolRefEH()

virtual void operator()(const PCRefreshEvent& ev)


class PCTool

Interface

PCTool(PixelCanvas *pcanvas, Display::KeySym keysym = Display::K_Pointer_Button1)
virtual ~PCTool()
virtual void enable()
virtual void disable()
virtual void operator()(const PCPositionEvent& ev)
virtual void operator()(const PCMotionEvent& ev)
virtual void operator()(const PCRefreshEvent& ev)
virtual void keyPressed(const PCPositionEvent &ev)
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
virtual void setKey(const Display::KeySym &keysym)
virtual Display::KeySym getKey() const
Protected Members
virtual Bool keyPresentlyDown(const PCMotionEvent &ev)

Description

Review Status

Date Reviewed:
yyyy/mm/dd

  • PCPositionEH
  • PCMotionEH
  • PCRefreshEH

    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

    Member Description

    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 ~PCTool()

    Destructor.

    virtual void enable()
    virtual void disable()

    Switch the tool on/off. This simply registers or unregisters the event handlers.

    virtual void operator()(const PCPositionEvent& ev)
    virtual void operator()(const PCMotionEvent& ev)
    virtual void operator()(const PCRefreshEvent& ev)

    Required operators for event handling. These are called when events occur, and distribute the events to the "user-level" methods.

    virtual void keyPressed(const PCPositionEvent &ev)
    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)

    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 PixelCanvas *pixelCanvas() const

    Get the PixelCanvas to which this Tool is attached.

    virtual void setKey(const Display::KeySym &keysym)
    virtual Display::KeySym getKey() const

    Set/get which key to catch.

    virtual Bool keyPresentlyDown(const PCMotionEvent &ev)

    Indicate whether key is presently pressed.