C4 Engine
C4 Engine API Documentation


Defined in:  C4Viewports.h
Sets the track task callback function for a viewport widget.

void SetTrackTaskCallback(TrackTaskCallback *callback, void *cookie = nullptr);

callback A pointer to the track task callback function.
cookie A user-defined pointer that is passed to the callback function.
The SetTrackTaskCallback function installs a callback function that is called once per frame after a mouse down event has occurred inside a viewport widget and before a mouse up event occurs. The callback parameter should point to a function having the following prototype.

typedef void TrackTaskCallback(const Point2D&, ViewportWidget *, void *);

The first parameter passed to the callback function is the mouse position in local viewport coordinates, 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 track task callback function is called when the viewport widget's Widget::TrackTask function is called by the Interface Manager.

If the callback parameter is nullptr, then any currently installed track task callback function is removed.
See Also