2020-03-13 12:18:32 +11:00
|
|
|
//! Various traits related to controllers opting in to autolayout routines and support for view
|
|
|
|
//! heirarchies.
|
|
|
|
|
|
|
|
use objc::runtime::Object;
|
|
|
|
use objc_id::ShareId;
|
|
|
|
|
|
|
|
/// A trait that view wrappers must conform to. Enables managing the subview tree.
|
|
|
|
pub trait Layout {
|
|
|
|
/// Returns a reference to the backing Objective-C layer. This is optional, as we try to keep
|
|
|
|
/// the general lazy-loading approach Cocoa has. This may change in the future, and in general
|
|
|
|
/// this shouldn't affect your code too much (if at all).
|
2020-03-20 14:07:44 +11:00
|
|
|
fn get_backing_node(&self) -> ShareId<Object>;
|
2020-03-13 12:18:32 +11:00
|
|
|
|
|
|
|
/// This trait should implement adding a view to the subview tree for a given view.
|
|
|
|
fn add_subview<V: Layout>(&self, _view: &V);
|
|
|
|
}
|