Refactor macOS cursor code (#2463)
This commit is contained in:
parent
e517e468f8
commit
29419d6c38
8 changed files with 352 additions and 222 deletions
|
|
@ -1,7 +1,7 @@
|
|||
use objc2::foundation::NSObject;
|
||||
use objc2::{extern_class, ClassType};
|
||||
use objc2::foundation::{NSObject, NSRect};
|
||||
use objc2::{extern_class, extern_methods, ClassType};
|
||||
|
||||
use super::NSResponder;
|
||||
use super::{NSCursor, NSResponder};
|
||||
|
||||
extern_class!(
|
||||
#[derive(Debug, PartialEq, Eq, Hash)]
|
||||
|
|
@ -12,3 +12,17 @@ extern_class!(
|
|||
type Super = NSResponder;
|
||||
}
|
||||
);
|
||||
|
||||
extern_methods!(
|
||||
/// Getter methods
|
||||
unsafe impl NSView {
|
||||
#[sel(bounds)]
|
||||
pub fn bounds(&self) -> NSRect;
|
||||
}
|
||||
|
||||
unsafe impl NSView {
|
||||
#[sel(addCursorRect:cursor:)]
|
||||
// NSCursor safe to take by shared reference since it is already immutable
|
||||
pub fn addCursorRect(&self, rect: NSRect, cursor: &NSCursor);
|
||||
}
|
||||
);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue