pub struct MouseEvent {
pub position: Point,
pub buttons: MouseButtons,
pub wheel: MouseWheel,
pub flags: MouseEventFlags,
pub modifiers: KeyModifiers,
}Expand description
A mouse event record: cursor position, buttons down, wheel direction, click/move flags, and keyboard modifiers held at event time.
Carried by every mouse Event variant. Construct one with struct-update
syntax; all fields Default to safe zeros:
use tvision_rs::event::{MouseEvent, MouseButtons};
let ev = MouseEvent {
buttons: MouseButtons { left: true, ..Default::default() },
..Default::default()
};
assert!(ev.buttons.left);§Turbo Vision heritage
Ports MouseEventType (system.h). The where field (a Rust keyword)
becomes position; the mb*/me* bit-words become struct-of-bools / enums
and controlKeyState reuses KeyModifiers.
Fields§
§position: PointCursor position in absolute screen coordinates at the time of the event.
Coordinates are in the root (screen) space; subtract the view’s global
origin to convert to view-local coordinates before hit-testing. The
position is always set, even for events that don’t logically have one
(e.g. MouseAuto repeats carry the last known position).
The C++ field was named where (a Rust keyword), renamed to position.
§Turbo Vision heritage
Ports the C++ global MouseWhere: TPoint (drivers.cpp), which held the
last known mouse position globally. In tvision-rs the position is carried
per-event in MouseEvent::position; there is no mutable global.
Which buttons are currently down at the time of the event.
wheel: MouseWheelWheel direction for Event::MouseWheel; MouseWheel::None for all
other event classes.
flags: MouseEventFlagsDouble/triple-click and mouse-moved flags for this event.
modifiers: KeyModifiersKeyboard modifiers held during the event (shift, ctrl, alt). Reuses
KeyModifiers — the same struct used for key-down events.
Trait Implementations§
Source§impl Clone for MouseEvent
impl Clone for MouseEvent
Source§fn clone(&self) -> MouseEvent
fn clone(&self) -> MouseEvent
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreimpl Copy for MouseEvent
Source§impl Debug for MouseEvent
impl Debug for MouseEvent
Source§impl Default for MouseEvent
impl Default for MouseEvent
Source§fn default() -> MouseEvent
fn default() -> MouseEvent
impl Eq for MouseEvent
Source§impl PartialEq for MouseEvent
impl PartialEq for MouseEvent
impl StructuralPartialEq for MouseEvent
Auto Trait Implementations§
impl Freeze for MouseEvent
impl RefUnwindSafe for MouseEvent
impl Send for MouseEvent
impl Sync for MouseEvent
impl Unpin for MouseEvent
impl UnsafeUnpin for MouseEvent
impl UnwindSafe for MouseEvent
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can
then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be
further downcast into Rc<ConcreteType> where ConcreteType implements Trait.§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.§impl<T> DowncastSync for T
impl<T> DowncastSync for T
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.