DisplayTool.h

Classes

DisplayTool -- Base class for event-based tools in the display classes. (full description)

class DisplayTool

Interface

Public Members
virtual ~DisplayTool()
virtual void enable() = 0
virtual void disable() = 0
virtual void setKey(const Display::KeySym &keysym)
virtual Display::KeySym getKey() const
Protected Members
explicit DisplayTool(const Display::KeySym &keysym = Display::K_Pointer_Button1)
DisplayTool(const DisplayTool &other)
DisplayTool &operator=(const DisplayTool &other)
Display::KeyModifier keyModifiers()
Private Members
void chooseKeyModifier()

Description

Review Status

Reviewed By:
Ralph Marson
Date Reviewed:
2000/04/18
Programs:
Tests:

Etymology

"DisplayTool" is a base interface for "Tools" to be used in "Display" applications.

Etymology

Synopsis

This class is a simple base class which provides a suitable base upon which to build interactive user tools for the display classes. It simply provides a facility to setup a key to catch and respond to, and an interface to enable and disable the tool.

Example

A function to provide information about a DisplayTool might look like:
    void MyClass::printToolKey(const DisplayTool &tool) const {
        cout << tool.getKey() << endl;
    }
    

Motivation

This class unites all key handling for display tools.

To Do

Member Description

virtual ~DisplayTool()

Destructor.

virtual void enable() = 0
virtual void disable() = 0

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

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

Set/get which key to catch.

explicit DisplayTool(const Display::KeySym &keysym = Display::K_Pointer_Button1)

Constructor taking a key to which this tool will initially be attached, typically one of the pointer buttons.

DisplayTool(const DisplayTool &other)

Copy constructor - construct a new DisplayTool from other, using copy semantics.

DisplayTool &operator=(const DisplayTool &other)

Copy assignment using copy semantics.

Display::KeyModifier keyModifiers()

Return the modifier mask. Some keys, specifically the mouse (pointer) buttons, have associated with them a bit mask which is used to determine if that key is currently held down. This function returns the modifier for the key of this tool, and returns 0 if the key does not have a modifier bit mask, eg. it is an alphanumeric key on the keyboard.

void chooseKeyModifier()

Support function to choose a key modifier for the tool key.