-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
150 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
use crate::{arc, define_cls, define_obj_type, ns, objc, ui}; | ||
|
||
define_obj_type!( | ||
pub Scene(ui::Responder) | ||
); | ||
|
||
impl Scene { | ||
define_cls!(UI_SCENE); | ||
|
||
#[objc::msg_send(delegate)] | ||
pub fn delegate(&self) -> Option<&AnySceneDelegate>; | ||
|
||
#[objc::msg_send(setDelegate:)] | ||
pub fn set_delegate<D: SceneDelegate>(&mut self, val: Option<&D>); | ||
} | ||
|
||
#[objc::protocol(UISceneDelegate)] | ||
pub trait SceneDelegate: objc::Obj { | ||
#[objc::optional] | ||
#[objc::msg_send(scene:willConnectToSession:options:)] | ||
fn scene_will_connect_to_session( | ||
&mut self, | ||
scene: &Scene, | ||
session: &ui::SceneSession, | ||
options: &ui::SceneConnectionOpts, | ||
); | ||
} | ||
|
||
define_obj_type!( | ||
pub AnySceneDelegate(ns::Id) | ||
); | ||
|
||
impl SceneDelegate for AnySceneDelegate {} | ||
|
||
#[link(name = "ui", kind = "static")] | ||
extern "C" { | ||
static UI_SCENE: &'static objc::Class<Scene>; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
use crate::{define_obj_type, ns}; | ||
|
||
define_obj_type!( | ||
#[doc(alias = "UISceneSessionRole")] | ||
pub SceneSessionRole(ns::String) | ||
); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
use crate::{define_obj_type, ns}; | ||
|
||
define_obj_type!( | ||
pub SceneConnectionOpts(ns::Id) | ||
); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
use crate::{arc, define_cls, define_obj_type, ns, objc, ui}; | ||
|
||
define_obj_type!( | ||
#[doc(alias = "UISceneConfiguration")] | ||
pub SceneCfg(ns::Id) | ||
); | ||
|
||
impl arc::A<SceneCfg> { | ||
#[objc::msg_send(initWithName:sessionRole:)] | ||
pub fn init_with_name_role( | ||
self, | ||
name: Option<&ns::String>, | ||
session_role: ui::SceneSessionRole, | ||
) -> arc::R<SceneCfg>; | ||
} | ||
|
||
impl SceneCfg { | ||
define_cls!(UI_SCENE_CONFIGURATION); | ||
|
||
pub fn with_name_role( | ||
name: Option<&ns::String>, | ||
session_role: ui::SceneSessionRole, | ||
) -> arc::R<Self> { | ||
Self::alloc().init_with_name_role(name, session_role) | ||
} | ||
|
||
#[objc::msg_send(name)] | ||
pub fn name(&self) -> Option<&ns::String>; | ||
|
||
#[objc::msg_send(setName:)] | ||
pub fn set_name(&mut self, val: Option<&ns::String>); | ||
|
||
#[objc::msg_send(role)] | ||
pub fn role(&self) -> &ui::SceneSessionRole; | ||
|
||
#[objc::msg_send(delegateClass)] | ||
pub fn delegate_class(&self) -> Option<&ns::Class<ns::Id>>; | ||
|
||
#[objc::msg_send(setDelegateClass:)] | ||
pub fn set_delegate_class(&mut self, val: Option<&ns::Class<ns::Id>>); | ||
|
||
#[objc::msg_send(userInfo)] | ||
pub fn user_info(&self) -> Option<&ns::Dictionary<ns::String, ns::Id>>; | ||
} | ||
|
||
define_obj_type!( | ||
pub SceneSession(ns::Id) | ||
); | ||
|
||
impl SceneSession { | ||
#[objc::msg_send(scene)] | ||
pub fn scene(&self) -> Option<&ui::Scene>; | ||
} | ||
|
||
extern "C" { | ||
static UI_SCENE_CONFIGURATION: &'static objc::Class<SceneCfg>; | ||
} |