Expand description

NCurses Mouse module

These functions provide an interface to mouse events from NCurses. Mouse events are represented by KeyBinding::KeyMouse pseudo-key values in the wgetch() input stream.

Structs

Enums

NCursesw mouse errors.

Constants

Functions

Once a class of mouse events has been made visible in a window, calling the wgetch() function on that window may return KeyBinding::KeyMouse as an indicator that a mouse event has been queued. To read the event data and pop the event off the queue, call getmouse(). This function will return a Ok type Result if a mouse event is actually visible in the given window, a NCurseswMouseError otherwise. When getmouse() returns Ok, the data deposited as y and x in the event structure coordinates will be screen-relative character-cell coordinates. The returned state mask will have exactly one bit set to indicate the event type. The corresponding data in the queue is marked invalid. A subsequent call to getmouse() will retrieve the next older item from the queue.

Screen function of getmouse().

The has_mouse() function returns true if the mouse driver has been successfully initialized.

Returns wether a mouse interface is available.

Screen function of has_mouse().

The mouse_trafo() function performs the same translation as wmouse_trafo(), using stdscr() for the window.

Return the NCurses mouse version.

The mouseinterval() function sets the maximum time (in thousands of a second) that can elapse between press and release events for them to be recognized as a click. Use mouseinterval(Some(time::Duration::from_millis(0))) to disable click resolution. This function returns the previous interval value. Use mouseinterval(None) to obtain the interval without altering it. The default is one sixth of a second.

Screen function of set_mouseinterval().

To make mouse events visible, use the mousemask() function. This will set the mouse events to be reported. By default, no mouse events are reported. The function will return a mask to indicate which of the specified mouse events can be reported; on complete failure it returns 0.

Screen function of mousemask().

The ungetmouse() function behaves analogously to ungetch(). It pushes a KeyBinding::KeyMouse event onto the input queue, and associates with that event the given state data and screen-relative character-cell coordinates.

Screen function of ungetmouse().

The wenclose() function tests whether a given pair of screen-relative character-cell coordinates is enclosed by a given window, returning true if it is and false otherwise. It is useful for determining what subset of the screen windows enclose the location of a mouse event.

The wmouse_trafo() function transforms a given pair of coordinates from stdscr-relative coordinates to coordinates relative to the given window or vice versa. The resulting stdscr-relative coordinates are not always identical to window-relative coordinates due to the mechanism to reserve lines on top or bottom of the screen for other purposes (see the ripoffline() and slk_init() calls, for example).

Type Definitions

Mouse event.

Mouse mask.