mirror of
https://github.com/rust-windowing/winit.git
synced 2026-06-26 22:53:15 -04:00
* Upgrade to objc2 v0.4.0 and icrate v0.0.3 * Fix `touchBar` method * Use ClassType::alloc * Use #[method_id(...)] functionality in declare_class!
32 lines
885 B
Rust
32 lines
885 B
Rust
use icrate::Foundation::{CGRect, MainThreadMarker, NSArray, NSObject};
|
|
use objc2::rc::Id;
|
|
use objc2::{extern_class, extern_methods, msg_send_id, mutability, ClassType};
|
|
|
|
use super::{UIResponder, UIWindow};
|
|
|
|
extern_class!(
|
|
#[derive(Debug, PartialEq, Eq, Hash)]
|
|
pub(crate) struct UIApplication;
|
|
|
|
unsafe impl ClassType for UIApplication {
|
|
#[inherits(NSObject)]
|
|
type Super = UIResponder;
|
|
type Mutability = mutability::InteriorMutable;
|
|
}
|
|
);
|
|
|
|
extern_methods!(
|
|
unsafe impl UIApplication {
|
|
pub fn shared(_mtm: MainThreadMarker) -> Option<Id<Self>> {
|
|
unsafe { msg_send_id![Self::class(), sharedApplication] }
|
|
}
|
|
|
|
pub fn windows(&self) -> Id<NSArray<UIWindow>> {
|
|
unsafe { msg_send_id![self, windows] }
|
|
}
|
|
|
|
#[method(statusBarFrame)]
|
|
pub fn statusBarFrame(&self) -> CGRect;
|
|
}
|
|
);
|