Responder

Base class of Window and View for event processing.

Modulerequire("gui")
TypeClass

Methods

setCapture()

Set mouse capture to the responder.

releaseCapture()

Release mouse capture if the responder has mouse capture.

hasCapture()

Return whether the responder has mouse capture.

Return

Boolean

getNative() Linux macOS

Return a Node.js Buffer containing the pointer of underlying native widget wrapped by the responder.

On Linux the C++ type of the pointer is GtkWidget*, and on macOS it is NSResponder*. The actual subclass type depends on which type this responder is, for example for Window you can expect the native type to be GtkWindow* on Linux and NSWindow* on macOS, and for View it would be GtkWidget* on Linux and NSView* on macOS.

However for subclasses of View, the native type is not specified, you may find out the information by looking into the source code, but the type might be changed in future updates. For example, the native type of TextEdit is currently a GtkScrolledWindow* with a GtkTextView* in it, but we may want to replace it with a custom widget when adding more features in future.

Return

Buffer

Events

onMouseDown(self, event)

Emitted when pressing mouse buttons.

Parameters

Preventable

Yes.

onMouseUp(self, event)

Emitted when releasing mouse buttons.

Parameters

Preventable

Yes.

onMouseMove(self, event)

Emitted when user moves mouse in the responder.

Parameters

Preventable

No.

onMouseEnter(self, event)

Emitted when mouse enters the responder.

Parameters

Preventable

No.

onMouseLeave(self, event)

Emitted when mouse leaves the responder.

Parameters

Preventable

No.

onKeyDown(self, event)

Emitted when pressing keyboard.

Parameters

Preventable

Yes.

onKeyUp(self, event)

Emitted when releasing keyboard.

Parameters

Preventable

Yes.

onCaptureLost(self)

Emitted when the mouse capture on responder has been released.

Parameters

Preventable

No.