Skip to main content

ICursorFactory

Trait ICursorFactory 

Source
pub trait ICursorFactory {
    // Required method
    fn get_cursor(&self, cursor_type: StandardCursorType) -> Rc<dyn ICursorImpl>;

    // Provided method
    fn create_cursor(
        &self,
        cursor: &Bitmap,
        hot_spot: PixelPoint,
    ) -> Rc<dyn ICursorImpl> { ... }
}
Expand description

Creates the platform implementations of mouse cursors.

This is an implementation detail of the platform backends.

Required Methods§

Source

fn get_cursor(&self, cursor_type: StandardCursorType) -> Rc<dyn ICursorImpl>

Gets the platform cursor for a standard cursor type.

Provided Methods§

Source

fn create_cursor( &self, cursor: &Bitmap, hot_spot: PixelPoint, ) -> Rc<dyn ICursorImpl>

Creates a platform cursor from a bitmap. hot_spot is the position within the bitmap that is the position of the pointer.

Every backend is expected to implement this. The default exists so that a backend written before bitmap cursors were part of the contract keeps building.

§Panics

The default implementation panics: the backend does not support bitmap cursors.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§