C4 Engine Terathon Software C4 Engine API Documentation

• Interface Manager

API Links
Developer Links

class WindowEventHandler

Defined in:  C4Interface.h
The WindowEventHandler class encapsulates a window event handler function.
Definition

class WindowEventHandler : public ListElement<WindowEventHandler>

Constructor

WindowEventHandler(HandlerProc *proc, void *cookie = nullptr);

Parameters
proc The procedure to invoke when a window event occurs.
cookie The cookie that is passed to the event handler as its last parameter.
Description
The WindowEventHandler class encapsulates a procedure that is invoked when a window event occurs. Once an instance of the WindowEventHandler class has been constructed, it can be installed by calling the InterfaceMgr::InstallWindowEventHandler function.

When a window event occurs, the procedures corresponding to all installed window event handlers are invoked. The HandlerProc type is defined as follows.

typedef void HandlerProc(const WindowEventData *eventData, void *cookie);

The eventType field of the WindowEventData structure specifies what type of window event occurred and can be one of the following values.
kEventWindowAdd A window was added to the interface.
kEventWindowRemove A window was removed from the interface.
kEventWindowChange A window's enable state or visibility state was changed.
The eventWindow field of the WindowEventData structure specifies the window for which the event occurred. The cookie parameter is the value passed to the WindowEventHandler constructor.

A window event handler is uninstalled by destroying its associated class instance.
Base Classes
ListElement<WindowEventHandler> Used internally to store all instances of WindowEventHandler in a list.