Struct SplitViewController

Source
pub struct SplitViewController<Sidebar, Content, Details> {
    pub objc: ShareId<Object>,
    pub sidebar: SplitViewItem<Sidebar>,
    pub content: SplitViewItem<Content>,
    pub details: Option<SplitViewItem<Details>>,
}
Expand description

A SplitViewController manages two or more view controllers in a split-pane view.

You typically use this controller as a content view controller for a Window. With it, you can build interfaces like those found in Mail.app or Xcode. Dividers can be configured to save their positions so that users can adjust them as they please.

Note that the third pane is optional; you can opt to leave it None, in which case there’s no allocation there, or you can set a placeholder and use it as a details pane.

A note on property names: the Cocoa(Touch) controllers tend to view these as:

|sidebar|details|content|

This pattern fits things such as a the aforementioned apps (e.g, Mail). Cacao takes the position that most apps really end up doing the following, though:

|sidebar|content|details|

where details may or may not be visible (e.g, chat applications often work this way).

Fields§

§objc: ShareId<Object>

A reference to the underlying Objective-C split view controller.

§sidebar: SplitViewItem<Sidebar>

A reference to the sidebar SplitViewItem.

§content: SplitViewItem<Content>

A reference to the content SplitViewItem.

§details: Option<SplitViewItem<Details>>

An optional reference to the details SplitViewItem, if set.

Implementations§

Source§

impl<Sidebar, Content, Details> SplitViewController<Sidebar, Content, Details>
where Sidebar: ViewDelegate + 'static, Content: ViewDelegate + 'static, Details: ViewDelegate + 'static,

Source

pub fn new(sidebar: Sidebar, content: Content, details: Option<Details>) -> Self

Creates and returns a new SplitViewController.

Source§

impl<Sidebar, Content, Details> SplitViewController<Sidebar, Content, Details>

Source

pub fn toggle_sidebar(&self)

Toggles the sidebar, if it exists, with an animation. If there’s no sidebar in this split view (which is highly unlikely, unless you went out of your way to duck this) then it will do nothing.

Source

pub fn set_autosave_name(&self, name: &str)

Sets the autosave name for the underlying SplitView.

Setting this name causes the system to persist separator locations to a defaults database, and the position(s) will be restored upon the user reopening the application.

Trait Implementations§

Source§

impl<Sidebar, Content, Details> Controller for SplitViewController<Sidebar, Content, Details>

Source§

fn get_backing_node(&self) -> ShareId<Object>

Returns the underlying Objective-C object.
Source§

impl<Sidebar: Debug, Content: Debug, Details: Debug> Debug for SplitViewController<Sidebar, Content, Details>

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl<Sidebar, Content, Details> Freeze for SplitViewController<Sidebar, Content, Details>

§

impl<Sidebar, Content, Details> !RefUnwindSafe for SplitViewController<Sidebar, Content, Details>

§

impl<Sidebar, Content, Details> !Send for SplitViewController<Sidebar, Content, Details>

§

impl<Sidebar, Content, Details> !Sync for SplitViewController<Sidebar, Content, Details>

§

impl<Sidebar, Content, Details> Unpin for SplitViewController<Sidebar, Content, Details>

§

impl<Sidebar, Content, Details> !UnwindSafe for SplitViewController<Sidebar, Content, Details>

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.