## Public API Reference

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

# Event handling

## 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...
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 521 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 const static char * StaticHandlerName()         \
      { return (x); }                                                       \
      CS_CONST_METHOD const static 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 550 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 341 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 333 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 329 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 337 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 313 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 321 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 317 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 325 of file eventnames.h.

#define CS_MAX_JOYSTICK_AXES 8

| Maximal number of joystick axes supported. Definition at line 49 of file event.h.

#define CS_MAX_JOYSTICK_BUTTONS 10

| Maximal number of joystick buttons supported. Definition at line 47 of file event.h. Referenced by csJoystickDriver::GetLastButton().

#define CS_MAX_JOYSTICK_COUNT 16

| Maximal number of joysticks supported. Definition at line 45 of file event.h. Referenced by csJoystickDriver::GetLastButton().

#define CS_MAX_MOUSE_AXES 8

| Maximal number of mouse axes supported. Definition at line 41 of file event.h.

#define CS_MAX_MOUSE_BUTTONS 10

| Maximal number of mouse buttons supported. Definition at line 43 of file event.h. Referenced by csMouseDriver::GetLastButton().

#define CS_MAX_MOUSE_COUNT 4

| Maximal number of mice supported. Definition at line 39 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 151 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 431 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 446 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 439 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 418 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 458 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 359 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 367 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 375 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 159 of file eventnames.h. Referenced by csEventQueue::PostProcessFrameEventDispatcher::GenericSucc(), csEventQueue::ProcessFrameEventDispatcher::GenericSucc(), and csEventQueue::PreProcessFrameEventDispatcher::GenericSucc().

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

| Generic input event. All actual input events are children of this one. Definition at line 165 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 297 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 301 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 258 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 309 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 305 of file eventnames.h.

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

| Keyboard key down event. Definition at line 176 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 172 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 180 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 221 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 239 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 245 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 227 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 184 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 251 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 233 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 352 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 395 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 388 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 37 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 265 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 235 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 up.
  csmbExtra1 | Thumb button 1 (e.g. on 5-button mice).
  csmbExtra2 | Thumb button 2 (e.g. on 5-button mice).

Definition at line 148 of file event.h.

## 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 403 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 270 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 261 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 286 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 276 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 195 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 187 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 211 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 201 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.