Struct Cursor

Source
pub struct Cursor {
    pub handle: HANDLE,
    /* private fields */
}
Expand description

A wrapper over a cursor file (*.cur)

Cursor resources can be used with the cursor feature

Example:

use native_windows_gui as nwg;

fn load_cursor() -> nwg::Cursor {
    nwg::Cursor::from_file("Hello.cur", true).unwrap()
}

fn load_cursor_builder() -> nwg::Cursor {
    let mut cursor = nwg::Cursor::default();

    nwg::Cursor::builder()
        .source_file(Some("Hello.cur"))
        .strict(true)
        .build(&mut cursor)
        .unwrap();

    cursor
}

Fields§

§handle: HANDLE

Implementations§

Source§

impl Cursor

Source

pub fn builder<'a>() -> CursorBuilder<'a>

Source

pub fn from_system(cursor: OemCursor) -> Cursor

Source

pub fn from_file(path: &str, strict: bool) -> Result<Cursor, NwgError>

Single line helper function over the cursor builder api.

Use a file resource.

Source

pub fn from_embed( embed: &EmbedResource, embed_id: Option<usize>, embed_str: Option<&str>, ) -> Result<Cursor, NwgError>

Single line helper function over the cursor builder api.

Use an embedded resource. Either embed_id or embed_str must be defined, not both.

Requires the embed-resource feature.

Trait Implementations§

Source§

impl Default for Cursor

Source§

fn default() -> Cursor

Returns the “default value” for a type. Read more
Source§

impl Drop for Cursor

Source§

fn drop(&mut self)

Executes the destructor for this type. Read more
Source§

impl PartialEq for Cursor

Source§

fn eq(&self, other: &Self) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.

Auto Trait Implementations§

§

impl Freeze for Cursor

§

impl RefUnwindSafe for Cursor

§

impl !Send for Cursor

§

impl !Sync for Cursor

§

impl Unpin for Cursor

§

impl UnwindSafe for Cursor

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<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, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

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

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

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.