Skip to main content

DockWorkspaceState

Struct DockWorkspaceState 

Source
pub struct DockWorkspaceState { /* private fields */ }
Expand description

Cloneable observable state for DockWorkspace.

Implementations§

Source§

impl DockWorkspaceState

Source

pub fn new(snapshot: DockWorkspaceSnapshot) -> Result<Self, DockLayoutError>

Source

pub fn empty() -> Self

Source

pub fn snapshot(&self) -> DockWorkspaceSnapshot

Source

pub fn apply_snapshot( &self, snapshot: DockWorkspaceSnapshot, ) -> Result<bool, DockLayoutError>

Applies a structurally valid dock graph.

Panel widgets are registered by DockWorkspace, not by this state object, so this method cannot reject otherwise-valid snapshots that reference an unregistered panel ID. Prefer DockWorkspace::apply_snapshot when restoring application-owned settings after the panel registry has been assembled.

Source

pub fn dock( &self, panel: DockPanelId, target: DockPanelId, zone: DockZone, ) -> Result<bool, DockLayoutError>

Source

pub fn dock_to_root( &self, panel: DockPanelId, zone: DockZone, ) -> Result<bool, DockLayoutError>

Source

pub fn float_panel( &self, panel: DockPanelId, bounds: Rect, ) -> Result<u64, DockLayoutError>

Source

pub fn hide(&self, panel: DockPanelId) -> Result<bool, DockLayoutError>

Source

pub fn show(&self, panel: DockPanelId) -> Result<bool, DockLayoutError>

Source

pub fn activate(&self, panel: DockPanelId) -> Result<bool, DockLayoutError>

Source

pub fn set_floating_bounds( &self, group_id: u64, bounds: Rect, ) -> Result<bool, DockLayoutError>

Source

pub fn bring_floating_to_front( &self, group_id: u64, ) -> Result<bool, DockLayoutError>

Source

pub fn dock_tab( &self, panel: DockPanelId, anchor: DockPanelId, after: bool, ) -> Result<bool, DockLayoutError>

Moves panel into the tab group that contains anchor, immediately before or after the anchor’s tab, and activates it.

Use it to reorder tabs within a group as well as to insert a tab at a chosen position in another group.

Source

pub fn add_panel( &self, id: DockPanelId, options: impl Into<DockPanelOptions>, placement: DockPlacement, ) -> Result<(), DockLayoutError>

Registers a panel while the workspace is mounted and places it.

The workspace creates the panel’s widget on its next measure pass by calling its DockWorkspace::panel_builder with id. The ID must not belong to a panel that is already registered.

Source

pub fn remove_panel(&self, id: DockPanelId) -> Result<bool, DockLayoutError>

Removes a panel from the layout and drops its widget.

Returns whether the panel was registered. Unlike Self::hide, the panel’s widget-local state is discarded and its ID may be reused.

Source

pub fn update_panel( &self, id: DockPanelId, update: impl FnOnce(&mut DockPanelOptions) + Send + 'static, ) -> Result<(), DockLayoutError>

Changes a registered panel’s tab options, such as its title or its unsaved-changes marker.

Source

pub fn is_registered(&self, id: DockPanelId) -> bool

Whether a panel widget is registered or queued for registration.

Trait Implementations§

Source§

impl Clone for DockWorkspaceState

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for DockWorkspaceState

Source§

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

Formats the value using the given formatter. Read more
Source§

impl Default for DockWorkspaceState

Source§

fn default() -> Self

Returns the “default value” for a type. Read more

Auto Trait Implementations§

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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. 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> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

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

Source§

type Error = !

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

fn try_from(value: U) -> Result<T, !>

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.