| ## Public API Reference

- Main Page
- Modules
- Namespaces
- Classes
- Files
- Related Pages

# Event handling

## Namespaces
namespace | CS
## Classes
class | csBaseEventHandler
| Base implementation of a generic event handler. More...
struct | csCommandEventData
| Structure that collects the data a command event carries. More...
class | csCommandEventHelper
| Helper class to conveniently deal with command events. More...
class | csEventHandlerRegistry
| The csEventHandlerRegistry maintains a global one-to-one mapping from strings to csHandlerIDs, and a one-to-(zero or one) mapping from csHandlerIDs to iEventHandler pointers. More...
class | csEventNameRegistry
| The csEventNameRegistry transforms textual event names (e.g., "crystalspace.input.joystick.3.button") into easier-to-manage csEventIDs (which, in non-debug builds, are really just csStringIDs). More...
class | csHashComputer< const csEventID >
class | csHashComputer< const csHandlerID >
class | csInputEventHelper
| Helper class to conveniently pull generic data out of input events. More...
struct | csJoystickEventData
| Structure that collects the data a joystick event carries. More...
class | csJoystickEventHelper
| Helper class to conveniently deal with joystick events. More...
struct | csKeyEventData
| Structure that collects the data a keyboard event carries. More...
class | csKeyEventHelper
| Helper class to conveniently deal with keyboard events. More...
struct | csMouseEventData
| Structure that collects the data a mouse event carries. More...
class | csMouseEventHelper
| Helper class to conveniently deal with mouse events. More...
class | FrameBegin3DDraw
| FrameBegin3DDraw handles every csevFrame event in the 3D phase. More...
class | FramePrinter
| FramePrinter handles every csevFrame event in the FRAME (final) phase. More...
struct | iEvent
| This interface describes any system event. More...
struct | iEventAttributeIterator
| Event attribute iterator. More...
struct | iEventCord
| The iEventCord is an interface provided by an event queue to any event handlers wanting to receive some subclasses of events ASAP in a specified priority, bypassing the queue itself. More...
struct | iEventHandler
| This interface describes an entity that can receive events. More...
struct | iEventHandlerRegistry
| This interface represents a general event handler registry/resolver. More...
struct | iEventNameRegistry
| This interface represents a general event name resolver. More...
struct | iEventOutlet
| The iEventOutlet is the interface to an object that is provided by an event queue to every event plug when it registers itself. More...
struct | iEventPlug
| Event plug interface, also referred as "event source". More...
struct | iEventQueue
| This interface represents a general event queue. More...
struct | iJoystickDriver
| Generic Joystick driver. More...
struct | iJoystickDriver
| Generic Joystick driver. More...
struct | iKeyboardDriver
| Generic Keyboard Driver. More...
struct | iKeyComposer
| Keyboard input handler. More...
struct | iMouseDriver
| Generic Mouse Driver. More...
## Common system events
These are the names of some of the most commonly-used system-generated events. Third-party applications can define their own event names. You should avoid using the "crystalspace." prefix (which is reserved for internally-generated events).
#define | CS_IS_INPUT_EVENT(reg, e) csEventNameRegistry::IsKindOf((reg), ((e).Name), csevInput(reg))
| Check if an event is any input event.
#define | CS_IS_JOYSTICK_BUTTON_EVENT(reg, e, n) csEventNameRegistry::IsKindOf((reg), ((e).Name), csevJoystickButton((reg),n))
| Check if an event is a button event from mouse n (basis 0).
#define | CS_IS_JOYSTICK_EVENT(reg, e) csEventNameRegistry::IsKindOf((reg), ((e).Name), csevJoystickEvent(reg))
| Check if an event is a joystick event.
#define | CS_IS_JOYSTICK_MOVE_EVENT(reg, e, n) csEventNameRegistry::IsKindOf((reg), ((e).Name), csevJoystickMove((reg),n))
| Check if an event is a move event from mouse n (basis 0).
#define | CS_IS_KEYBOARD_EVENT(reg, e) csEventNameRegistry::IsKindOf((reg), ((e).Name), csevKeyboardEvent(reg))
| Check if an event is a keyboard event.
#define | CS_IS_MOUSE_BUTTON_EVENT(reg, e, n) csEventNameRegistry::IsKindOf((reg), ((e).Name), csevMouseButton((reg),n))
| Check if an event is a button event from mouse n (basis 0).
#define | CS_IS_MOUSE_EVENT(reg, e) csEventNameRegistry::IsKindOf((reg), ((e).Name), csevMouseEvent(reg))
| Check if an event is a mouse event.
#define | CS_IS_MOUSE_MOVE_EVENT(reg, e, n) csEventNameRegistry::IsKindOf((reg), ((e).Name), csevMouseMove((reg),n))
| Check if an event is a move event from mouse n (basis 0).
#define | csevAllEvents(reg) (csEventNameRegistry::GetID((reg), ""))
| Root event.
#define | csevCanvasClose(reg, g2d) csevCanvasOp((reg), (g2d), "close")
| This event is sent when a graphics context x is being destroyed (where x is an iGraphics2D pointer).
#define | csevCanvasExposed(reg, g2d) csevCanvasOp((reg), (g2d), "exposed")
| Broadcast indicating that the display canvas has just become visible, such as being uniconified (where x is an iGraphics2D pointer).
#define | csevCanvasHidden(reg, g2d) csevCanvasOp((reg), (g2d), "hidden")
| Broadcast indicating that the canvas x is not currently visible to the user, such as being iconified (where x is an iGraphics2D pointer).
#define | csevCanvasResize(reg, g2d) csevCanvasOp((reg), (g2d), "resize")
| This event is generated when user resizes the application window corresponding with context x (where x is an iGraphics2D pointer).
#define | csevCommandLineHelp(reg) (csEventNameRegistry::GetID((reg), "crystalspace.application.commandlinehelp"))
| This event is broadcasted when system driver displays the help text for all supported command-line switches.
#define | csevFocusChanged(reg) (csEventNameRegistry::GetID((reg), "crystalspace.application.focus"))
| Children of this event are generated whenever application (as a whole) receives or loses focus.
#define | csevFocusGained(reg) (csEventNameRegistry::GetID((reg), "crystalspace.application.focus.gained"))
| This event is generated whenever user application (as a whole) receives system focus.
#define | csevFocusLost(reg) (csEventNameRegistry::GetID((reg), "crystalspace.application.focus.lost"))
| This event is generated whenever user application (as a whole) loses system focus.
#define | csevFrame(reg) (csEventNameRegistry::GetID((reg), "crystalspace.frame"))
| Frame event.
#define | csevInput(reg) (csEventNameRegistry::GetID((reg), "crystalspace.input"))
| Generic input event.
#define | csevJoystickButton(reg, x) csevJoystickOp((reg),(x),"button")
| Generic joystick button event from joystick x.
#define | csevJoystickDown(reg, x) csevJoystickOp((reg),(x),"button.down")
| Button down event from joystick x. The first system joystick is 0.
#define | csevJoystickEvent(reg) (csEventNameRegistry::GetID((reg), "crystalspace.input.joystick"))
| Generic joystick event.
#define | csevJoystickMove(reg, x) csevJoystickOp((reg),(x),"move")
| Move event from joystick x. The first system joystick is 0.
#define | csevJoystickUp(reg, x) csevJoystickOp((reg),(x),"button.up")
| Button up event from joystick x. The first system joystick is 0.
#define | csevKeyboardDown(reg) (csEventNameRegistry::GetID((reg), "crystalspace.input.keyboard.down"))
| Keyboard key down event.
#define | csevKeyboardEvent(reg) (csEventNameRegistry::GetID((reg), "crystalspace.input.keyboard"))
| Generic keyboard event.
#define | csevKeyboardUp(reg) (csEventNameRegistry::GetID((reg), "crystalspace.input.keyboard.up"))
| Keyboard key up event.
#define | csevMouseButton(reg, x) csevMouseOp ((reg), (x), "button")
| Generic button event from mouse x.
#define | csevMouseClick(reg, x) csevMouseOp ((reg), (x), "button.click")
| Click event from mouse x.
#define | csevMouseDoubleClick(reg, x) csevMouseOp((reg), (x), "button.doubleclick")
| Double-click event from mouse x.
#define | csevMouseDown(reg, x) csevMouseOp ((reg), (x), "button.down")
| Button down event from mouse x.
#define | csevMouseEvent(reg) (csEventNameRegistry::GetID((reg), "crystalspace.input.mouse"))
| Generic mouse event. All actual mouse events are children of this one.
#define | csevMouseMove(reg, x) csevMouseOp((reg), (x), "move")
| Move event from mouse x.
#define | csevMouseUp(reg, x) csevMouseOp ((reg), (x), "button.up")
| Button up event from mouse x.
#define | csevQuit(reg) (csEventNameRegistry::GetID((reg), "crystalspace.application.quit"))
| This event causes system driver to quit the event loop, even if the event loop has been entered multiple times.
#define | csevSystemClose(reg) (csEventNameRegistry::GetID((reg), "crystalspace.application.close"))
| This event is broadcasted to all event listeners just before modules are about to be shutdown and unloaded (that is, the system is shutting down).
#define | csevSystemOpen(reg) (csEventNameRegistry::GetID((reg), "crystalspace.application.open"))
| This event is broadcasted to all event listeners just after all modules have been initialized.
static csEventID | csevCanvasOp (iObjectRegistry *object_reg, const iGraphics2D *g2d, const csString &y)
| Check if an event is any input event.
csEventID | csevCanvasOp (csRef< iEventNameRegistry > &reg, const iGraphics2D *g2d, const csString &y)
| Check if an event is any input event.
csEventID | csevFinalProcess (iEventNameRegistry *reg)
| Check if an event is any input event.
csEventID | csevFinalProcess (iObjectRegistry *reg)
| Broadcasted after csevPostProcess on every frame.
static csEventID | csevJoystick (iObjectRegistry *object_reg, uint x)
| Check if an event is any input event.
static csEventID | csevJoystick (iEventNameRegistry *name_reg, uint x)
| Check if an event is any input event.
static csEventID | csevJoystickOp (iObjectRegistry *object_reg, uint x, const csString &y)
| Check if an event is any input event.
static csEventID | csevJoystickOp (iEventNameRegistry *name_reg, uint x, const csString &y)
| Check if an event is any input event.
static csEventID | csevMouse (iObjectRegistry *object_reg, uint x)
| Check if an event is any input event.
static csEventID | csevMouse (iEventNameRegistry *name_reg, uint x)
| Check if an event is any input event.
static csEventID | csevMouseOp (iObjectRegistry *object_reg, uint x, const csString &y)
| Check if an event is any input event.
static csEventID | csevMouseOp (iEventNameRegistry *name_reg, uint x, const csString &y)
| Check if an event is any input event.
csEventID | csevPostProcess (iEventNameRegistry *reg)
| Check if an event is any input event.
csEventID | csevPostProcess (iObjectRegistry *reg)
| Broadcasted after csevProcess on every frame.
csEventID | csevPreProcess (iEventNameRegistry *reg)
| Check if an event is any input event.
csEventID | csevPreProcess (iObjectRegistry *reg)
| Broadcasted before csevProcess on every frame.
csEventID | csevProcess (iEventNameRegistry *reg)
| Check if an event is any input event.
csEventID | csevProcess (iObjectRegistry *reg)
| Broadcasted every frame.
## Defines
#define | _CSBASEEVENT_MAXARRAYINDEX csevFrameStart
#define | CS_DECLARE_EVENT_SHORTCUTS
| Shortcut to declare class properties SystemOpen, SystemClose, Frame, PreProcess, Process, PostProcess, FinalProcess.
#define | CS_DECLARE_FRAME_EVENT_SHORTCUTS
#define | CS_DECLARE_INPUT_EVENT_SHORTCUTS
#define | CS_DECLARE_SYSTEM_EVENT_SHORTCUTS
#define | CS_EVENT_INVALID csInvalidStringID
#define | CS_EVENTHANDLER_DEFAULT_INSTANCE_CONSTRAINTS
| Macro to declare instance constraints which are the same as the generics.
#define | CS_EVENTHANDLER_NAMES(x)
| Macro to create default GenericName and GenericName methods.
#define | CS_EVENTHANDLER_NIL_CONSTRAINTS
| Macro to create "nil" generic and instance constraints.
#define | CS_EVENTHANDLER_NIL_GENERIC_CONSTRAINTS
| Macro to create nil generic constraints.
#define | CS_EVENTLIST_END csInvalidStringID
#define | CS_HANDLER_INVALID csInvalidStringID
#define | CS_HANDLERLIST_END csInvalidStringID
#define | CS_INITIALIZE_EVENT_SHORTCUTS(object_reg)
| Shortcut to initialize the properties declared by CS_DECLARE_EVENT_SHORTCUTS.
#define | CS_INITIALIZE_FRAME_EVENT_SHORTCUTS(object_reg)
#define | CS_INITIALIZE_INPUT_EVENT_SHORTCUTS(object_reg)
#define | CS_INITIALIZE_SYSTEM_EVENT_SHORTCUTS(object_reg)
#define | CS_MAX_JOYSTICK_AXES 8
| Maximal number of joystick axes supported.
#define | CS_MAX_JOYSTICK_BUTTONS 10
| Maximal number of joystick buttons supported.
#define | CS_MAX_JOYSTICK_COUNT 16
| Maximal number of joysticks supported.
#define | CS_MAX_MOUSE_AXES 8
| Maximal number of mouse axes supported.
#define | CS_MAX_MOUSE_BUTTONS 10
| Maximal number of mouse buttons supported.
#define | CS_MAX_MOUSE_COUNT 4
| Maximal number of mice supported.
## Typedefs
typedef csStringID | csEventID
| A csEventID is a handle for a string representing an event's hierarchical name (e.g., "crystalspace.input.keyboard.down").
typedef csStringID | csHandlerID
typedef enum _csKeyEventType | csKeyEventType
| Keyboard event type - stored as keyEventType attribute in keyboard events.
typedef enum _csMouseEventType | csMouseEventType
| Mouse event type - stored as mEventType attribute in mouse events.
## Enumerations
enum | _csKeyEventType { csKeyEventTypeUp = 0, csKeyEventTypeDown }
| Keyboard event type - stored as keyEventType attribute in keyboard events. More...
enum | _csMouseEventType { csMouseEventTypeMove = 0, csMouseEventTypeUp, csMouseEventTypeDown, csMouseEventTypeClick, csMouseEventTypeDoubleClick }
| Mouse event type - stored as mEventType attribute in mouse events. More...
enum | csEventAttributeType { csEventAttrUnknown, csEventAttrInt, csEventAttrUInt, csEventAttrFloat, csEventAttrDatabuffer, csEventAttrEvent, csEventAttriBase }
| Various attribute data types supported by the event system (iEvent). More...
enum | csEventError { csEventErrNone, csEventErrLossy, csEventErrNotFound, csEventErrMismatchInt, csEventErrMismatchUInt, csEventErrMismatchFloat, csEventErrMismatchBuffer, csEventErrMismatchEvent, csEventErrMismatchIBase, csEventErrUhOhUnknown }
| Error codes for event attribute retrieval. More...
enum | csKeyComposeResult { csComposeNoChar = -1, csComposeNormalChar, csComposeComposedChar, csComposeUncomposeable }
| Results for attempts to process a character key. More...
enum | csMouseButton { csmbNone = -1, csmbLeft = 0, csmbRight = 1, csmbMiddle = 2, csmbWheelUp = 3, csmbWheelDown = 4, csmbExtra1 = 5, csmbExtra2 = 6 }
| Constants for mouse buttons. More...

### Keyboard events

Keyboard events are emitted when the user does something with the keyboard - presses down a key ("key down" events), holds it down (more "key down" events in a specific interval - "auto-repeat") and releases it ("key up").

Every keyboard event has a bunch of data associated with it. First, there is a code to identify the key: the 'raw' code. It uniquely identifies the key, and every key has a distinct code, independent from any pressed modifiers: For example, pressing the "A" key will always result in the raw code 'a', holding shift or any other modifier down won't change it. However, the 'cooked' code contains such additional information: If Shift+A is pressed, the cooked code will be 'A', while the raw code is still 'a'. Other keys are also normalized; for example keypad keys: pressing "9" will result in either CSKEY_PGUP or '9', depending on the NumLock state. So, the same key can result in different 'cooked' codes, and the same 'cooked' code can be caused by different keys.

Other data contained in a keyboard event is:

- Whether it is a key up or down event
- Whether it is an autorepeat of an earlier keypress
- Modifiers at the time of the keypress
- When it is a character, whether it is a normal or dead character

Keyboard event data is stored as properties of iEvent, accessible thorugh iEvent->Find() and iEvent->Add().

Property Name | Type | Description
keyEventType | csKeyEventType (stored as uint8) | Event type (up vs down)
keyCodeRaw | uint32 | Raw key code
keyCodeCooked | uint32 | Cooked key code
keyModifiers | csKeyModifiers | Modifiers at time of the key press
keyAutoRepeat | bool | Autorepeat flag
keyCharType | csKeyCharType (stored as uint8) | Character type

A way to retrieve an keyboard event's data without requiring a plethora of iEvent->Find() invocations provides the csKeyEventHelper class.

Also see iKeyComposer for informations about composing accented etc. characters from dead and normal keys.

### Overall structure of the basic event flow in Crystal Space

       ......................
       .User application    .
       . +----------------+ .
     +-->+ Event consumer | .
     | . +----------------+ .
     | ......................
     |
     | .....................................
     | .System driver plugin               .
     | .                          +------+ .   +-----+
     | .                       +<-|event +-<<--+event|
     | .   +---------------+   |  |outlet| .   |plug |
     +-----+  event queue  +<--+  +------+ .   +-----+
     | .   +---------------+   |  +------+ .   +-----+
     | .                       +<-|event +-<<--+event|
     | .   +---------------+   |  |outlet| .   |plug |
     +-----+ event cord    +<--|  +------+ .   +-----+
       .   +---------------+   |  +------+ .   +-----+
       .                       +<-|event +-<<--+event|
       .                          |outlet| .   |plug |
       .                          +------+ .   +-----+
       .                            ....   .     ...
       .....................................

The events are generated by 'event plugs' which are plugged into 'event outlets'. The event outlets are reponsible for filtering the possibly duplicate messages that are coming from different event plugs (for example two different plugs may both intercept the keyboard and generate duplicate keydown events).

Events are put into the event queue, from where they are sent to applications and plugins. Event cords bypass the queue for specific command event categories and deliver events immediately in a prioritizied chain to specific plugins which request the categories.

## Define Documentation

#define CS_DECLARE_EVENT_SHORTCUTS

Value:

    CS_DECLARE_SYSTEM_EVENT_SHORTCUTS;                              \
      CS_DECLARE_FRAME_EVENT_SHORTCUTS;                             \
      CS_DECLARE_INPUT_EVENT_SHORTCUTS

Shortcut to declare class properties SystemOpen, SystemClose, Frame, PreProcess, Process, PostProcess, FinalProcess.

Pair with CS_INITIALIZE_EVENT_SHORTCUTS(registry).

Definition at line 524 of file eventnames.h.

#define CS_EVENTHANDLER_DEFAULT_INSTANCE_CONSTRAINTS

Value:

    CS_CONST_METHOD virtual const csHandlerID * InstancePrec (              \
        csRef<iEventHandlerRegistry> &r1, csRef<iEventNameRegistry> &r2,    \
        csEventID e) const { return GenericPrec(r1, r2, e); } \
      CS_CONST_METHOD virtual const csHandlerID * InstanceSucc (            \
        csRef<iEventHandlerRegistry> &r1, csRef<iEventNameRegistry> &r2,    \
        csEventID e) const { return GenericSucc(r1, r2, e); }

Macro to declare instance constraints which are the same as the generics.

Definition at line 196 of file eventh.h.

#define CS_EVENTHANDLER_NAMES | ( | x |  | ) |

Value:

    CS_CONST_METHOD static const char * StaticHandlerName()         \
      { return (x); }                                                       \
      CS_CONST_METHOD static const csHandlerID StaticID(csRef<iEventHandlerRegistry> &reg) \
      {return reg->GetGenericID(StaticHandlerName()); }                     \
      CS_CONST_METHOD virtual const char * GenericName() const              \
      { return StaticHandlerName(); }                                       \
      CS_CONST_METHOD virtual csHandlerID GenericID(csRef<iEventHandlerRegistry> &reg) const \
      { return StaticID(reg); }

Macro to create default GenericName and GenericName methods.

Also declares StaticHandlerName, which can be used to reference a class of event handlers abstractly without having any of them loaded.

Definition at line 165 of file eventh.h.

#define CS_EVENTHANDLER_NIL_CONSTRAINTS

Value:

    CS_EVENTHANDLER_NIL_GENERIC_CONSTRAINTS         \
            CS_EVENTHANDLER_DEFAULT_INSTANCE_CONSTRAINTS

Macro to create "nil" generic and instance constraints.

Definition at line 178 of file eventh.h.

#define CS_EVENTHANDLER_NIL_GENERIC_CONSTRAINTS

Value:

    CS_CONST_METHOD virtual const csHandlerID * GenericPrec (               \
        csRef<iEventHandlerRegistry> &, csRef<iEventNameRegistry> &,        \
        csEventID) const { return 0; }      \
      CS_CONST_METHOD virtual const csHandlerID * GenericSucc (             \
        csRef<iEventHandlerRegistry> &, csRef<iEventNameRegistry> &,        \
        csEventID) const { return 0; }

Macro to create nil generic constraints.

Definition at line 185 of file eventh.h.

#define CS_INITIALIZE_EVENT_SHORTCUTS | ( | object_reg |  | ) |

Value:

    do {    \
        CS_INITIALIZE_SYSTEM_EVENT_SHORTCUTS (object_reg);  \
        CS_INITIALIZE_FRAME_EVENT_SHORTCUTS (object_reg);   \
        CS_INITIALIZE_INPUT_EVENT_SHORTCUTS (object_reg);   \
      } while (0)

Shortcut to initialize the properties declared by CS_DECLARE_EVENT_SHORTCUTS.

Requires an iObjectRegistry or iEventNameRegistry.

Definition at line 553 of file eventnames.h.

#define CS_IS_INPUT_EVENT | ( | reg,
|  | e |  | ) | csEventNameRegistry::IsKindOf((reg), ((e).Name), csevInput(reg))

Check if an event is any input event.

Definition at line 343 of file eventnames.h.

#define CS_IS_JOYSTICK_BUTTON_EVENT | ( | reg,
|  | e,
|  | n |  | ) | csEventNameRegistry::IsKindOf((reg), ((e).Name), csevJoystickButton((reg),n))

Check if an event is a button event from mouse n (basis 0).

Definition at line 335 of file eventnames.h.

#define CS_IS_JOYSTICK_EVENT | ( | reg,
|  | e |  | ) | csEventNameRegistry::IsKindOf((reg), ((e).Name), csevJoystickEvent(reg))

Check if an event is a joystick event.

Definition at line 331 of file eventnames.h.

#define CS_IS_JOYSTICK_MOVE_EVENT | ( | reg,
|  | e,
|  | n |  | ) | csEventNameRegistry::IsKindOf((reg), ((e).Name), csevJoystickMove((reg),n))

Check if an event is a move event from mouse n (basis 0).

Definition at line 339 of file eventnames.h.

#define CS_IS_KEYBOARD_EVENT | ( | reg,
|  | e |  | ) | csEventNameRegistry::IsKindOf((reg), ((e).Name), csevKeyboardEvent(reg))

Check if an event is a keyboard event.

Definition at line 315 of file eventnames.h.

#define CS_IS_MOUSE_BUTTON_EVENT | ( | reg,
|  | e,
|  | n |  | ) | csEventNameRegistry::IsKindOf((reg), ((e).Name), csevMouseButton((reg),n))

Check if an event is a button event from mouse n (basis 0).

Definition at line 323 of file eventnames.h.

#define CS_IS_MOUSE_EVENT | ( | reg,
|  | e |  | ) | csEventNameRegistry::IsKindOf((reg), ((e).Name), csevMouseEvent(reg))

Check if an event is a mouse event.

Definition at line 319 of file eventnames.h.

#define CS_IS_MOUSE_MOVE_EVENT | ( | reg,
|  | e,
|  | n |  | ) | csEventNameRegistry::IsKindOf((reg), ((e).Name), csevMouseMove((reg),n))

Check if an event is a move event from mouse n (basis 0).

Definition at line 327 of file eventnames.h.

#define CS_MAX_JOYSTICK_AXES 8

Maximal number of joystick axes supported.

Definition at line 50 of file event.h.

#define CS_MAX_JOYSTICK_BUTTONS 10

Maximal number of joystick buttons supported.

Definition at line 48 of file event.h.

Referenced by csJoystickDriver::GetLastButton().

#define CS_MAX_JOYSTICK_COUNT 16

Maximal number of joysticks supported.

Definition at line 46 of file event.h.

Referenced by csJoystickDriver::GetLastButton().

#define CS_MAX_MOUSE_AXES 8

Maximal number of mouse axes supported.

Definition at line 42 of file event.h.

#define CS_MAX_MOUSE_BUTTONS 10

Maximal number of mouse buttons supported.

Definition at line 44 of file event.h.

Referenced by csMouseDriver::GetLastButton().

#define CS_MAX_MOUSE_COUNT 4

Maximal number of mice supported.

Definition at line 40 of file event.h.

Referenced by csMouseDriver::GetLastButton().

#define csevAllEvents | ( | reg |  | ) | (csEventNameRegistry::GetID((reg), ""))

Root event.

All event names are children of this one. WARNING: it's easy to just subscribe to this event, but this will make subscription computationally expensive and may cause lots of spurious events to be delivered to your handler. Only subscribe to this event if you know what you're doing!

Definition at line 153 of file eventnames.h.

#define csevCanvasClose | ( | reg,
|  | g2d |  | ) | csevCanvasOp((reg), (g2d), "close")

This event is sent when a graphics context x is being destroyed (where x is an iGraphics2D pointer).

Usually this event is accompanyed by a shutdown but there are exceptions, e.g., when a dynamic texture is closed (a dynamic texture is a graphics context as well).

     Info: (iGraphics2D *) The context that has been closed

Definition at line 434 of file eventnames.h.

#define csevCanvasExposed | ( | reg,
|  | g2d |  | ) | csevCanvasOp((reg), (g2d), "exposed")

Broadcast indicating that the display canvas has just become visible, such as being uniconified (where x is an iGraphics2D pointer).

Definition at line 449 of file eventnames.h.

#define csevCanvasHidden | ( | reg,
|  | g2d |  | ) | csevCanvasOp((reg), (g2d), "hidden")

Broadcast indicating that the canvas x is not currently visible to the user, such as being iconified (where x is an iGraphics2D pointer).

Definition at line 442 of file eventnames.h.

#define csevCanvasResize | ( | reg,
|  | g2d |  | ) | csevCanvasOp((reg), (g2d), "resize")

This event is generated when user resizes the application window corresponding with context x (where x is an iGraphics2D pointer).

     Info: (iGraphics2D *) The context that has been resized

Definition at line 421 of file eventnames.h.

#define csevCommandLineHelp | ( | reg |  | ) | (csEventNameRegistry::GetID((reg), "crystalspace.application.commandlinehelp"))

This event is broadcasted when system driver displays the help text for all supported command-line switches.

Upon reception of such event every plugin should display a short help for any of the command-line switches it supports. The general format is:

    <2 spaces><switch - 18 positions><space>

    <switch description>{default value}

The help should be displayed to standard output.

Definition at line 461 of file eventnames.h.

#define csevFocusChanged | ( | reg |  | ) | (csEventNameRegistry::GetID((reg), "crystalspace.application.focus"))

Children of this event are generated whenever application (as a whole) receives or loses focus.

Definition at line 361 of file eventnames.h.

#define csevFocusGained | ( | reg |  | ) | (csEventNameRegistry::GetID((reg), "crystalspace.application.focus.gained"))

This event is generated whenever user application (as a whole) receives system focus.

The application may react by staring music, showing software mouse cursor and so on.

Definition at line 369 of file eventnames.h.

#define csevFocusLost | ( | reg |  | ) | (csEventNameRegistry::GetID((reg), "crystalspace.application.focus.lost"))

This event is generated whenever user application (as a whole) loses system focus.

Upon this event the application may react by stopping music, hiding software mouse cursor and so on.

Definition at line 377 of file eventnames.h.

#define csevFrame | ( | reg |  | ) | (csEventNameRegistry::GetID((reg), "crystalspace.frame"))

Frame event.

This is sent once per frame. This should drive all rendering, periodic/clocked game state updates, input device polling, etc.

Definition at line 161 of file eventnames.h.

#define csevInput | ( | reg |  | ) | (csEventNameRegistry::GetID((reg), "crystalspace.input"))

Generic input event.

All actual input events are children of this one.

Definition at line 167 of file eventnames.h.

#define csevJoystickButton | ( | reg,
|  | x |  | ) | csevJoystickOp((reg),(x),"button")

Generic joystick button event from joystick x.

All actual joystick button events are children of this one. The first system joystick is 0.

Definition at line 299 of file eventnames.h.

#define csevJoystickDown | ( | reg,
|  | x |  | ) | csevJoystickOp((reg),(x),"button.down")

Button down event from joystick x. The first system joystick is 0.

Definition at line 303 of file eventnames.h.

#define csevJoystickEvent | ( | reg |  | ) | (csEventNameRegistry::GetID((reg), "crystalspace.input.joystick"))

Generic joystick event.

All actual joystick events are children of this one.

Definition at line 260 of file eventnames.h.

#define csevJoystickMove | ( | reg,
|  | x |  | ) | csevJoystickOp((reg),(x),"move")

Move event from joystick x. The first system joystick is 0.

Definition at line 311 of file eventnames.h.

#define csevJoystickUp | ( | reg,
|  | x |  | ) | csevJoystickOp((reg),(x),"button.up")

Button up event from joystick x. The first system joystick is 0.

Definition at line 307 of file eventnames.h.

#define csevKeyboardDown | ( | reg |  | ) | (csEventNameRegistry::GetID((reg), "crystalspace.input.keyboard.down"))

Keyboard key down event.

Definition at line 178 of file eventnames.h.

#define csevKeyboardEvent | ( | reg |  | ) | (csEventNameRegistry::GetID((reg), "crystalspace.input.keyboard"))

Generic keyboard event.

All actual keyboard events are children of this one.

Definition at line 174 of file eventnames.h.

Referenced by csInputDefinition::GetKeyCode(), and csInputDefinition::SetKeyCode().

#define csevKeyboardUp | ( | reg |  | ) | (csEventNameRegistry::GetID((reg), "crystalspace.input.keyboard.up"))

Keyboard key up event.

Definition at line 182 of file eventnames.h.

#define csevMouseButton | ( | reg,
|  | x |  | ) | csevMouseOp ((reg), (x), "button")

Generic button event from mouse x.

All button events from mouse x are children of this one. The default system mouse is 0.

Definition at line 223 of file eventnames.h.

#define csevMouseClick | ( | reg,
|  | x |  | ) | csevMouseOp ((reg), (x), "button.click")

Click event from mouse x.

The default system mouse is 0.

Definition at line 241 of file eventnames.h.

#define csevMouseDoubleClick | ( | reg,
|  | x |  | ) | csevMouseOp((reg), (x), "button.doubleclick")

Double-click event from mouse x.

The default system mouse is 0.

Definition at line 247 of file eventnames.h.

#define csevMouseDown | ( | reg,
|  | x |  | ) | csevMouseOp ((reg), (x), "button.down")

Button down event from mouse x.

The default system mouse is 0.

Definition at line 229 of file eventnames.h.

#define csevMouseEvent | ( | reg |  | ) | (csEventNameRegistry::GetID((reg), "crystalspace.input.mouse"))

Generic mouse event. All actual mouse events are children of this one.

Definition at line 186 of file eventnames.h.

#define csevMouseMove | ( | reg,
|  | x |  | ) | csevMouseOp((reg), (x), "move")

Move event from mouse x.

The default system mouse is 0.

Definition at line 253 of file eventnames.h.

#define csevMouseUp | ( | reg,
|  | x |  | ) | csevMouseOp ((reg), (x), "button.up")

Button up event from mouse x.

The default system mouse is 0.

Definition at line 235 of file eventnames.h.

#define csevQuit | ( | reg |  | ) | (csEventNameRegistry::GetID((reg), "crystalspace.application.quit"))

This event causes system driver to quit the event loop, even if the event loop has been entered multiple times.

The quit condition is never reset thus even if you call Loop again, the system driver will quit immediately. Such broadcasts are posted for irreversible finalization of the application such as when user closes the application window.

Definition at line 354 of file eventnames.h.

#define csevSystemClose | ( | reg |  | ) | (csEventNameRegistry::GetID((reg), "crystalspace.application.close"))

This event is broadcasted to all event listeners just before modules are about to be shutdown and unloaded (that is, the system is shutting down).

Definition at line 397 of file eventnames.h.

#define csevSystemOpen | ( | reg |  | ) | (csEventNameRegistry::GetID((reg), "crystalspace.application.open"))

This event is broadcasted to all event listeners just after all modules have been initialized.

NOTE - it is not (usually) a good idea to load other modules in the csevSystemOpen event handler, particularly if the so-loaded module will itself depend on receiving csevSystemOpen. (Its its subscription ordering criteria may render it unloadable once delivery of this event has begun.) Instead, modules which will need to receive csevSystemOpen should be loaded inside of other modules' Initialize() methods.

Definition at line 390 of file eventnames.h.

## Typedef Documentation

typedef csStringID csEventID

A csEventID is a handle for a string representing an event's hierarchical name (e.g., "crystalspace.input.keyboard.down").

Definition at line 38 of file eventnames.h.

typedef enum _csKeyEventType csKeyEventType

Keyboard event type - stored as keyEventType attribute in keyboard events.

typedef enum _csMouseEventType csMouseEventType

Mouse event type - stored as mEventType attribute in mouse events.

## Enumeration Type Documentation

enum _csKeyEventType

Keyboard event type - stored as keyEventType attribute in keyboard events.

Enumerator:

  csKeyEventTypeUp | A 'key up' event.
  csKeyEventTypeDown | A 'key down' event.

Definition at line 45 of file evdefs.h.

enum _csMouseEventType

Mouse event type - stored as mEventType attribute in mouse events.

Enumerator:

  csMouseEventTypeMove | A motion event.
  csMouseEventTypeUp | A 'button up' event.
  csMouseEventTypeDown | A 'button down' event.
  csMouseEventTypeClick | A 'click' event.
  csMouseEventTypeDoubleClick | A 'doubleclick' event.

Definition at line 54 of file evdefs.h.

enum csEventAttributeType

Various attribute data types supported by the event system (iEvent).

Enumerator:

  csEventAttrUnknown | The attribute type is unknown. This shouldn't occur.
  csEventAttrInt | A signed integer is contained.
  csEventAttrUInt | An unsigned integer is contained.
  csEventAttrFloat | A floating point number is contained.
  csEventAttrDatabuffer | A string or raw data buffer is contained.
  csEventAttrEvent | An iEvent is contained.
  csEventAttriBase | An iBase interface is contained.

Definition at line 242 of file event.h.

enum csEventError

Error codes for event attribute retrieval.

Enumerator:

  csEventErrNone | No error.
  csEventErrLossy | The attribute value could be converted to the requested type, however, data was lost during the conversion.
  csEventErrNotFound | The requested attribute was not found.
  csEventErrMismatchInt | The contained value can not be converted to the requested type. The error code indicates the actual contained type.
  csEventErrMismatchUInt | The contained value can not be converted to the requested type. The error code indicates the actual contained type.
  csEventErrMismatchFloat | The contained value can not be converted to the requested type. The error code indicates the actual contained type.
  csEventErrMismatchBuffer | The contained value can not be converted to the requested type. The error code indicates the actual contained type.
  csEventErrMismatchEvent | The contained value can not be converted to the requested type. The error code indicates the actual contained type.
  csEventErrMismatchIBase | The contained value can not be converted to the requested type. The error code indicates the actual contained type.
  csEventErrUhOhUnknown | Unknown error. Something doesn't work like it should.

Definition at line 212 of file event.h.

enum csKeyComposeResult

Results for attempts to process a character key.

Enumerator:

  csComposeNoChar | No character could be retrieved. Possibly the key was dead.
  csComposeNormalChar | A single, normal chararacter is retrieved.
  csComposeComposedChar | A single, composed chararacter is retrieved.
  csComposeUncomposeable | A key couldn't be combined with a previously pressed dead key, and both characters are returned individually.

Definition at line 43 of file csinput.h.

enum csMouseButton

Constants for mouse buttons.

Note: the possibly occuring values are not limited to those below, e.g. maybe some day 6-button mice are available...

Enumerator:

  csmbNone | ID to designate the absence of an acting mouse button.
  csmbLeft | Left button.
  csmbRight | Right button.
  csmbMiddle | Middle button.
  csmbWheelUp | Wheel was scrolled up.
  csmbWheelDown | Wheel was scrolled down.
  csmbExtra1 | Thumb button 1 (e.g. on 5-button mice).
  csmbExtra2 | Thumb button 2 (e.g. on 5-button mice).

Definition at line 73 of file evdefs.h.

## Enumerator Documentation

csEventErrMismatchBuffer

The contained value can not be converted to the requested type.

The error code indicates the actual contained type.

csEventErrMismatchEvent

The contained value can not be converted to the requested type.

The error code indicates the actual contained type.

csEventErrMismatchFloat

The contained value can not be converted to the requested type.

The error code indicates the actual contained type.

csEventErrMismatchIBase

The contained value can not be converted to the requested type.

The error code indicates the actual contained type.

csEventErrMismatchUInt

The contained value can not be converted to the requested type.

The error code indicates the actual contained type.

## Function Documentation

static csEventID csevCanvasOp | ( | iObjectRegistry * | object_reg,
|  | const iGraphics2D * | g2d,
|  | const csString & | y |
| ) |  |  | `[inline, static]`

Check if an event is any input event.

Definition at line 406 of file eventnames.h.

References csevCanvasOp(), and csEventNameRegistry::GetRegistry().

csEventID csevCanvasOp | ( | csRef< iEventNameRegistry > & | reg,
|  | const iGraphics2D * | g2d,
|  | const csString & | y |
| ) |  |  |

Check if an event is any input event.

Referenced by csevCanvasOp().

csEventID csevFinalProcess | ( | iEventNameRegistry * | reg | ) |

Check if an event is any input event.

csEventID csevFinalProcess | ( | iObjectRegistry * | reg | ) |

Broadcasted after csevPostProcess on every frame.

This event will go away soon, since it was a kludge to work around the lack of subscription priorities/scheduling. Should be replaced with subscriptions to csevFrame with subscription ordering.

static csEventID csevJoystick | ( | iObjectRegistry * | object_reg,
|  | uint | x |
| ) |  |  | `[inline, static]`

Check if an event is any input event.

Definition at line 272 of file eventnames.h.

References csevJoystick(), and csEventNameRegistry::GetRegistry().

static csEventID csevJoystick | ( | iEventNameRegistry * | name_reg,
|  | uint | x |
| ) |  |  | `[inline, static]`

Check if an event is any input event.

Definition at line 263 of file eventnames.h.

References cs_snprintf(), and iEventNameRegistry::GetID().

Referenced by csevJoystick().

static csEventID csevJoystickOp | ( | iObjectRegistry * | object_reg,
|  | uint | x,
|  | const csString & | y |
| ) |  |  | `[inline, static]`

Check if an event is any input event.

Definition at line 288 of file eventnames.h.

References csevJoystickOp(), and csEventNameRegistry::GetRegistry().

static csEventID csevJoystickOp | ( | iEventNameRegistry * | name_reg,
|  | uint | x,
|  | const csString & | y |
| ) |  |  | `[inline, static]`

Check if an event is any input event.

Definition at line 278 of file eventnames.h.

References csStringBase::Append(), and iEventNameRegistry::GetID().

Referenced by csevJoystickOp().

static csEventID csevMouse | ( | iObjectRegistry * | object_reg,
|  | uint | x |
| ) |  |  | `[inline, static]`

Check if an event is any input event.

Definition at line 197 of file eventnames.h.

References csevMouse(), and csEventNameRegistry::GetRegistry().

static csEventID csevMouse | ( | iEventNameRegistry * | name_reg,
|  | uint | x |
| ) |  |  | `[inline, static]`

Check if an event is any input event.

Definition at line 189 of file eventnames.h.

References csStringBase::Append(), and iEventNameRegistry::GetID().

Referenced by csevMouse().

static csEventID csevMouseOp | ( | iObjectRegistry * | object_reg,
|  | uint | x,
|  | const csString & | y |
| ) |  |  | `[inline, static]`

Check if an event is any input event.

Definition at line 213 of file eventnames.h.

References csevMouseOp(), and csEventNameRegistry::GetRegistry().

static csEventID csevMouseOp | ( | iEventNameRegistry * | name_reg,
|  | uint | x,
|  | const csString & | y |
| ) |  |  | `[inline, static]`

Check if an event is any input event.

Definition at line 203 of file eventnames.h.

References csStringBase::Append(), and iEventNameRegistry::GetID().

Referenced by csevMouseOp().

csEventID csevPostProcess | ( | iEventNameRegistry * | reg | ) |

Check if an event is any input event.

csEventID csevPostProcess | ( | iObjectRegistry * | reg | ) |

Broadcasted after csevProcess on every frame.

This event will go away soon, since it was a kludge to work around the lack of subscription priorities/scheduling. Should be replaced with subscriptions to csevFrame with subscription ordering.

csEventID csevPreProcess | ( | iEventNameRegistry * | reg | ) |

Check if an event is any input event.

csEventID csevPreProcess | ( | iObjectRegistry * | reg | ) |

Broadcasted before csevProcess on every frame.

This event will go away soon, since it was a kludge to work around the lack of subscription priorities/scheduling. Should be replaced with subscriptions to csevFrame with subscription ordering.

csEventID csevProcess | ( | iEventNameRegistry * | reg | ) |

Check if an event is any input event.

csEventID csevProcess | ( | iObjectRegistry * | reg | ) |

Broadcasted every frame.

This event will go away soon, replaced by csevFrame.