Changes relevant to Winit: - `icrate` has been deprecated in favour of separate crates per framework, in our case `objc2-foundation` and `objc2-app-kit` (and in the future `objc2-ui-kit` on iOS). - Moved `MainThreadMarker::run_on_main` to free-standing function `run_on_main`. - Changed how features work, this should result in less code that we need to compile. - Enums are now real structs instead of type-aliases and free constants.
36 lines
917 B
Rust
36 lines
917 B
Rust
use objc2::rc::Id;
|
|
use objc2::{extern_class, extern_methods, msg_send_id, mutability, ClassType};
|
|
use objc2_foundation::NSObject;
|
|
|
|
use super::{UIResponder, UIScreen, UIView};
|
|
|
|
extern_class!(
|
|
#[derive(Debug, PartialEq, Eq, Hash)]
|
|
pub(crate) struct UIWindow;
|
|
|
|
unsafe impl ClassType for UIWindow {
|
|
#[inherits(UIResponder, NSObject)]
|
|
type Super = UIView;
|
|
type Mutability = mutability::InteriorMutable;
|
|
}
|
|
);
|
|
|
|
extern_methods!(
|
|
unsafe impl UIWindow {
|
|
pub fn screen(&self) -> Id<UIScreen> {
|
|
unsafe { msg_send_id![self, screen] }
|
|
}
|
|
|
|
#[method(setScreen:)]
|
|
pub fn setScreen(&self, screen: &UIScreen);
|
|
|
|
#[method(setHidden:)]
|
|
pub fn setHidden(&self, flag: bool);
|
|
|
|
#[method(makeKeyAndVisible)]
|
|
pub fn makeKeyAndVisible(&self);
|
|
|
|
#[method(isKeyWindow)]
|
|
pub fn isKeyWindow(&self) -> bool;
|
|
}
|
|
);
|