Type Alias libnotcurses_sys::NcInput

source ·
pub type NcInput = ncinput;
Expand description

Reads and decodes input events.

Reads from stdin and decodes the input to stdout, including synthesized events and mouse events. Notcurses provides input from keyboards and mice.

Single Unicode codepoints are received from the keyboard, directly encoded as u32.

All events carry an NcInput structure with them.

For mouse events, the x and y coordinates are reported within this struct. For all events, modifiers (e.g. “Alt”) are carried as bools in this struct.

Aliased Type§

struct NcInput {
    pub id: u32,
    pub y: i32,
    pub x: i32,
    pub utf8: [i8; 5],
    pub alt: bool,
    pub shift: bool,
    pub ctrl: bool,
    pub evtype: u32,
    pub modifiers: u32,
    pub ypx: i32,
    pub xpx: i32,
}

Fields§

§id: u32

Unicode codepoint or synthesized NCKEY event

§y: i32

y/x cell coordinate of event, -1 for undefined

§x: i32

y/x cell coordinate of event, -1 for undefined

§utf8: [i8; 5]

utf8 representation, if one exists

§alt: bool

was alt held?

§shift: bool

was shift held?

§ctrl: bool

was ctrl held?

§evtype: u32

END DEPRECATION

§modifiers: u32

bitmask over NCKEY_MOD_*

§ypx: i32

pixel offsets within cell, -1 for undefined

§xpx: i32

pixel offsets within cell, -1 for undefined

Implementations§

source§

impl NcInput

§Constructors

source

pub fn new_empty() -> NcInput

New empty NcInput.

source

pub fn new(id: char) -> NcInput

New NcInput.

source

pub fn with_alt(id: char) -> NcInput

New NcInput with alt key.

source

pub fn with_shift(id: char) -> NcInput

New NcInput with shift key.

source

pub fn with_ctrl(id: char) -> NcInput

New NcInput with ctrl key.

source

pub fn with_all_args( id: char, x: Option<u32>, y: Option<u32>, modifiers: NcKeyMod, evtype: NcInputType ) -> NcInput

New NcInput, expecting all the arguments (except utf8).

source§

impl NcInput

§Methods

source

pub fn char(&self) -> Option<char>

Returns the char from the utf8 representation of the input.

source

pub fn nomod_p(&self) -> bool

Returns true if there are no modifiers present.

C style function: ncinput_nomod_p().

source

pub fn shift_p(&self) -> bool

Returns true if the Shift modifier is present.

C style function: ncinput_shift_p().

source

pub fn alt_p(&self) -> bool

Returns true if the Alt modifier is present.

C style function: ncinput_alt_p().

source

pub fn ctrl_p(&self) -> bool

Returns true if the Ctrl modifier is present.

C style function: ncinput_ctrl_p().

source

pub fn meta_p(&self) -> bool

Returns true if the Meta modifier is present.

C style function: ncinput_meta_p().

source

pub fn super_p(&self) -> bool

Returns true if the Super modifier is present.

C style function: ncinput_super_p().

source

pub fn hyper_p(&self) -> bool

Returns true if the Hyper modifier is present.

C style function: ncinput_hyper_p().

source

pub fn capslock_p(&self) -> bool

Returns true if the CapsLock modifier is present.

C style function: ncinput_capslock_p().

source

pub fn numlock_p(&self) -> bool

Returns true if the NumLock modifier is present.

C style function: ncinput_numlock_p().

source

pub fn equal_p(&self, other: &NcInput) -> bool

Returns true if both NcInputs are equal.

C style function: ncinput_equal_p().

Trait Implementations§

source§

impl PartialEq for NcInput

source§

fn eq(&self, other: &Self) -> bool

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.