pub struct Cursor;
Available on crate feature appkit only.
Expand description

A wrapper around NSCursor.

You use then when you need to control how the cursor (pointer) should appear. Like NSCursor, this is stack based - you push, and you pop. You are responsible for ensuring that this is correctly popped!

For a very abbreviated example:

use cacao::appkit::Cursor;
use cacao::appkit::CursorType;
use cacao::dragdrop::DragInfo;
use cacao::dragdrop::DragOperation;
use cacao::view::ViewDelegate;
struct MyView;
impl ViewDelegate for MyView {
    const NAME: &'static str = "RootView";
    fn dragging_entered(&self, _info: DragInfo) -> DragOperation {
        Cursor::push(CursorType::DragCopy);
        DragOperation::Copy
    }

    fn dragging_exited(&self, _info: DragInfo) {
        Cursor::pop();
    }
}

This will show the “add files +” indicator when the user has entered the dragging threshold with some items that trigger it, and undo the cursor when the user leaves (regardless of drop status).

Implementations

Given a cursor type, will make it the system cursor. The inverse of this call, which you should call when ready, is pop().

Pops the current cursor off the cursor-stack. The inverse of push.

Hides the cursor. Part of a balanced call stack.

Un-hides the cursor. Part of a balanced call stack.

Sets the cursor to hidden, but will reveal it if the user moves the mouse.

Potentially useful for games and other immersive experiences.

If you use this, do not use unhide - just call this with the inverted boolean value. Trying to invert this with unhide will result in undefined system behavior.

Trait Implementations

Formats the value using the given formatter. Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

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

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.