C4 Engine
C4 Engine API Documentation

ViewportWidget::SetMouseEventCallback

Defined in:  C4Viewports.h
Sets the mouse event callback function for a viewport widget.
Prototype

void SetMouseEventCallback(MouseEventCallback *callback, void *cookie = nullptr);

Parameters
callback A pointer to the mouse event callback function.
cookie A user-defined pointer that is passed to the callback function.
Description
The SetMouseEventCallback function installs a callback function that is called when a mouse event occurs inside a viewport widget. The callback parameter should point to a function having the following prototype.

typedef void MouseEventCallback(const MouseEventData *, ViewportWidget *, void *);

The first parameter passed to the callback function is a pointer to the mouse event data, and the second parameter is a pointer to the viewport inside which a mouse event occurred. The last parameter receives the pointer specified by the cookie parameter.

The current mouse event callback function is called when the viewport widget's Widget::HandleMouseEvent function is called by the Interface Manager.

If the callback parameter is nullptr, then any currently installed mouse event callback function is removed.

In between mouse down and mouse up events, the track task callback function is called once per frame if such a callback function has been installed using the ViewportWidget::SetTrackTaskCallback function.
See Also

ViewportWidget::SetTrackTaskCallback

ViewportWidget::SetDirectRenderCallback

ViewportWidget::SetTextureRenderCallback

MouseEventData