MouseEventHandlerclass encapsulates a mouse event handler callback function.
class MouseEventHandler : public ListElement<MouseEventHandler>
MouseEventHandler(HandlerCallback *callback, void *cookie = nullptr);
||The callback function to invoke when a mouse event occurs.|
||The cookie that is passed to the event handler as its last parameter.|
MouseEventHandlerclass encapsulates a callback function that is invoked when a mouse event occurs. Once an instance of the
MouseEventHandlerclass has been constructed, it can be installed by calling the
When a mouse event occurs, the callback functions corresponding to all installed mouse event handlers are invoked. The
HandlerCallbacktype is defined as follows.
typedef bool HandlerCallback(const MouseEventData *eventData, void *cookie);
eventTypefield of the
MouseEventDatastructure specifies what type of mouse event occurred and can be one of the following constants.
||The left mouse button was pressed.|
||The left mouse button was released.|
||The right mouse button was pressed.|
||The right mouse button was released.|
||The middle mouse button was pressed.|
||The middle mouse button was released.|
||The mouse location was moved.|
||The mouse wheel was moved.|
mousePositionfield of the
MouseEventDatastructure specifies the screen coordinates at which the mouse event occurred. For the
wheelDeltamember specifies how far the wheel was moved in the
ydirections. (Currently, the
xdelta is always zero.)
cookieparameter is the value passed to the
The value returned by the callback function specifies whether the mouse event was successfully handled. If the callback function returns
true, then the mouse event is considered handled, and no further mouse event handlers will be called for the same event. If the callback function returns
false, then the event is passed to the next mouse event handler.
A mouse event handler is uninstalled by destroying its associated class instance.
||Used internally to store all instances of |