winit/src/platform_impl/macos/appkit/view.rs

29 lines
696 B
Rust
Raw Normal View History

2022-09-02 21:02:40 +02:00
use objc2::foundation::{NSObject, NSRect};
use objc2::{extern_class, extern_methods, ClassType};
2022-09-02 21:02:40 +02:00
use super::{NSCursor, NSResponder};
extern_class!(
#[derive(Debug, PartialEq, Eq, Hash)]
pub(crate) struct NSView;
unsafe impl ClassType for NSView {
#[inherits(NSObject)]
type Super = NSResponder;
}
);
2022-09-02 21:02:40 +02:00
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);
}
);