pub struct Cursor;
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
sourceimpl Cursor
impl Cursor
sourcepub fn push(cursor_type: CursorType)
pub fn push(cursor_type: CursorType)
Given a cursor type, will make it the system cursor.
The inverse of this call, which you should call when ready, is pop()
.
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
Auto Trait Implementations
impl RefUnwindSafe for Cursor
impl Send for Cursor
impl Sync for Cursor
impl Unpin for Cursor
impl UnwindSafe for Cursor
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more