C4 Engine
C4 Engine API Documentation

class DisplayEventHandler

Defined in:  C4Engine.h
The DisplayEventHandler class encapsulates a display event handler function.
Definition

class DisplayEventHandler : public ListElement<DisplayEventHandler>

Constructor

DisplayEventHandler(HandlerCallback *callback, void *cookie = nullptr);

Parameters
callback The callback function to invoke when a display event occurs.
cookie The cookie that is passed to the callback function as its last parameter.
Description
The DisplayEventHandler class encapsulates a callback function that is invoked when a display event occurs. Once an instance of the DisplayEventHandler class has been constructed, it can be installed by calling the Engine::InstallDisplayEventHandler function.

When a display event occurs, the callback functions corresponding to all installed display event handlers are invoked. The HandlerCallback type is defined as follows.

typedef void HandlerCallback(const DisplayEventData *eventData, void *cookie);

The eventType field of the DisplayEventData structure specifies what type of display event occurred and can be one of the following constants.
kEventDisplayChange The dimensions of the display have changed.
The cookie parameter is the value passed to the DisplayEventHandler constructor.

A display event callback function is uninstalled by destroying its associated class instance.
Base Classes
ListElement<DisplayEventHandler> Used internally to store all instances of DisplayEventHandler in a list.