Enum cursive::event::Event [−][src]
pub enum Event { WindowResize, Refresh, Char(char), CtrlChar(char), AltChar(char), Key(Key), Shift(Key), Alt(Key), AltShift(Key), Ctrl(Key), CtrlShift(Key), CtrlAlt(Key), Mouse { offset: Vec2, position: Vec2, event: MouseEvent, }, Unknown(Vec<u8>), // some variants omitted }
Represents an event as seen by the application.
Variants
WindowResize
Event fired when the window is resized.
Refresh
Event fired regularly when a auto-refresh is set.
Char(char)
A character was entered (includes numbers, punctuation, ...).
CtrlChar(char)
A character was entered with the Ctrl key pressed.
AltChar(char)
A character was entered with the Alt key pressed.
Key(Key)
A non-character key was pressed.
Shift(Key)
A non-character key was pressed with the Shift key pressed.
Alt(Key)
A non-character key was pressed with the Alt key pressed.
AltShift(Key)
A non-character key was pressed with the Shift and Alt keys pressed.
Ctrl(Key)
A non-character key was pressed with the Ctrl key pressed.
CtrlShift(Key)
A non-character key was pressed with the Ctrl and Shift keys pressed.
CtrlAlt(Key)
A non-character key was pressed with the Ctrl and Alt keys pressed.
Mouse
A mouse event was sent.
Fields of Mouse
offset: Vec2 | Position of the top-left corner of the view receiving this event. |
position: Vec2 | Position of the mouse when this event was fired. |
event: MouseEvent | The mouse event itself. |
Unknown(Vec<u8>)
An unknown event was received.
Methods
impl Event
[src]
impl Event
pub fn mouse_position(&self) -> Option<Vec2>
[src]
pub fn mouse_position(&self) -> Option<Vec2>
Returns the position of the mouse, if self
is a mouse event.
pub fn mouse_position_mut(&mut self) -> Option<&mut Vec2>
[src]
pub fn mouse_position_mut(&mut self) -> Option<&mut Vec2>
Returns a mutable reference to the position of the mouse/
Returns None
if self
is not a mouse event.
pub fn relativize<V>(&mut self, top_left: V) where
V: Into<Vec2>,
[src]
pub fn relativize<V>(&mut self, top_left: V) where
V: Into<Vec2>,
Update self
with the given offset.
If self
is a mouse event, adds top_left
to its offset.
Otherwise, do nothing.
pub fn relativized<V>(&self, top_left: V) -> Self where
V: Into<Vec2>,
[src]
pub fn relativized<V>(&self, top_left: V) -> Self where
V: Into<Vec2>,
Returns a cloned, relativized event.
If self
is a mouse event, adds top_left
to its offset.
Otherwise, returns a simple clone.
Trait Implementations
impl PartialEq for Event
[src]
impl PartialEq for Event
fn eq(&self, other: &Event) -> bool
[src]
fn eq(&self, other: &Event) -> bool
This method tests for self
and other
values to be equal, and is used by ==
. Read more
fn ne(&self, other: &Event) -> bool
[src]
fn ne(&self, other: &Event) -> bool
This method tests for !=
.
impl Eq for Event
[src]
impl Eq for Event
impl Clone for Event
[src]
impl Clone for Event
fn clone(&self) -> Event
[src]
fn clone(&self) -> Event
Returns a copy of the value. Read more
fn clone_from(&mut self, source: &Self)
1.0.0[src]
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from source
. Read more
impl Hash for Event
[src]
impl Hash for Event
fn hash<__H: Hasher>(&self, state: &mut __H)
[src]
fn hash<__H: Hasher>(&self, state: &mut __H)
Feeds this value into the given [Hasher
]. Read more
fn hash_slice<H>(data: &[Self], state: &mut H) where
H: Hasher,
1.3.0[src]
fn hash_slice<H>(data: &[Self], state: &mut H) where
H: Hasher,
Feeds a slice of this type into the given [Hasher
]. Read more
impl Debug for Event
[src]
impl Debug for Event
fn fmt(&self, f: &mut Formatter) -> Result
[src]
fn fmt(&self, f: &mut Formatter) -> Result
Formats the value using the given formatter. Read more
impl From<char> for Event
[src]
impl From<char> for Event
impl From<Key> for Event
[src]
impl From<Key> for Event