mirror of
https://github.com/FliegendeWurst/cursive.git
synced 2024-11-12 20:23:35 +00:00
Add Event::grabs_focus
This commit is contained in:
parent
f02dda5a0a
commit
0bb1fb4b2a
12
src/event.rs
12
src/event.rs
@ -243,6 +243,18 @@ impl MouseEvent {
|
|||||||
_ => None,
|
_ => None,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Returns `true` if `self` is an event that can grab focus.
|
||||||
|
///
|
||||||
|
/// This includes `Press`, `WheelUp` and `WheelDown`.
|
||||||
|
pub fn grabs_focus(self) -> bool {
|
||||||
|
match self {
|
||||||
|
MouseEvent::Press(_) |
|
||||||
|
MouseEvent::WheelUp |
|
||||||
|
MouseEvent::WheelDown => true,
|
||||||
|
_ => false,
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Represents an event as seen by the application.
|
/// Represents an event as seen by the application.
|
||||||
|
Loading…
Reference in New Issue
Block a user