Skip to main content

MouseCursorManager

Struct MouseCursorManager 

Source
pub struct MouseCursorManager {
    pub fallback_mouse_cursor: MouseCursorRef,
    /* private fields */
}
Expand description

Maintains the state of mouse cursors and manages how cursors are searched for.

This is typically created as a global singleton and owned by MouseTracker.

Fields§

§fallback_mouse_cursor: MouseCursorRef

The mouse cursor to use if all cursor candidates choose to defer.

See also:

  • MouseCursor.defer, the mouse cursor object to use to defer.

Implementations§

Source§

impl MouseCursorManager

Source

pub fn new(fallback_mouse_cursor: MouseCursorRef) -> MouseCursorManager

Create a MouseCursorManager by specifying the fallback cursor.

The fallback_mouse_cursor must not be MouseCursor.defer.

Source

pub fn debug_device_active_cursor(&self, device: i64) -> Option<MouseCursorRef>

Returns the active mouse cursor of a device.

The return value is the last MouseCursor activated onto this device, even if the activation failed.

This function is only active in debug mode: in release it returns None.

Source

pub fn handle_device_cursor_update( &mut self, platform: &dyn Platform, view: ViewId, device: i64, triggering_event: Option<&PointerEvent>, cursor_candidates: impl IntoIterator<Item = MouseCursorRef>, )

Handles the changes that cause a pointer device to have a new list of mouse cursor candidates.

This change can be caused by a pointer event, in which case triggering_event should not be None, or by other changes, such as when a widget has moved under a still mouse, which is detected after the current frame is complete. In either case, cursor_candidates should be the list of cursors at the location of the mouse in hit-test order.

view is the one the device is on, from its latest event: the cursor is that view’s host’s to show, and the session asks it.

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<T> Downcast<T> for T

Source§

fn downcast(&self) -> &T

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> Upcast<T> for T

Source§

fn upcast(&self) -> Option<&T>