Responder

Base class of Window and View for event processing.

Header#include "nativeui/responder.h"
Namespacenamespace nu
Typeclass (RefCounted)

Methods

const char* GetClassName() const

Return the receiving responder's class name.

A class name is a string which uniquely identifies the class. It is intended to be used as a way to find out during run time if a responder can be safely casted to a specific subclass.

Return

const char*

void SetCapture()

Set mouse capture to the responder.

void ReleaseCapture()

Release mouse capture if the responder has mouse capture.

bool HasCapture() const

Return whether the responder has mouse capture.

Return

bool

NativeResponder GetNative() const

Return the native type wrapped by the responder.

Return

NativeResponder

Events

bool on_mouse_down(Responder* self, const MouseEvent& event)

Emitted when pressing mouse buttons.

Parameters

Preventable

Yes.

bool on_mouse_up(Responder* self, const MouseEvent& event)

Emitted when releasing mouse buttons.

Parameters

Preventable

Yes.

void on_mouse_move(Responder* self, const MouseEvent& event)

Emitted when user moves mouse in the responder.

Parameters

Preventable

No.

void on_mouse_enter(Responder* self, const MouseEvent& event)

Emitted when mouse enters the responder.

Parameters

Preventable

No.

void on_mouse_leave(Responder* self, const MouseEvent& event)

Emitted when mouse leaves the responder.

Parameters

Preventable

No.

bool on_key_down(Responder* self, const KeyEvent& event)

Emitted when pressing keyboard.

Parameters

Preventable

Yes.

bool on_key_up(Responder* self, const KeyEvent& event)

Emitted when releasing keyboard.

Parameters

Preventable

Yes.

void on_capture_lost(Responder* self)

Emitted when the mouse capture on responder has been released.

Parameters

Preventable

No.