pub struct DockWorkspaceState { /* private fields */ }Expand description
Cloneable observable state for DockWorkspace.
Implementations§
Source§impl DockWorkspaceState
impl DockWorkspaceState
pub fn new(snapshot: DockWorkspaceSnapshot) -> Result<Self, DockLayoutError>
pub fn empty() -> Self
pub fn snapshot(&self) -> DockWorkspaceSnapshot
Sourcepub fn apply_snapshot(
&self,
snapshot: DockWorkspaceSnapshot,
) -> Result<bool, DockLayoutError>
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.
pub fn dock( &self, panel: DockPanelId, target: DockPanelId, zone: DockZone, ) -> Result<bool, DockLayoutError>
pub fn dock_to_root( &self, panel: DockPanelId, zone: DockZone, ) -> Result<bool, DockLayoutError>
pub fn float_panel( &self, panel: DockPanelId, bounds: Rect, ) -> Result<u64, DockLayoutError>
pub fn hide(&self, panel: DockPanelId) -> Result<bool, DockLayoutError>
pub fn show(&self, panel: DockPanelId) -> Result<bool, DockLayoutError>
pub fn activate(&self, panel: DockPanelId) -> Result<bool, DockLayoutError>
pub fn set_floating_bounds( &self, group_id: u64, bounds: Rect, ) -> Result<bool, DockLayoutError>
pub fn bring_floating_to_front( &self, group_id: u64, ) -> Result<bool, DockLayoutError>
Sourcepub fn dock_tab(
&self,
panel: DockPanelId,
anchor: DockPanelId,
after: bool,
) -> Result<bool, DockLayoutError>
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.
Sourcepub fn add_panel(
&self,
id: DockPanelId,
options: impl Into<DockPanelOptions>,
placement: DockPlacement,
) -> Result<(), DockLayoutError>
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.
Sourcepub fn remove_panel(&self, id: DockPanelId) -> Result<bool, DockLayoutError>
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.
Sourcepub fn update_panel(
&self,
id: DockPanelId,
update: impl FnOnce(&mut DockPanelOptions) + Send + 'static,
) -> Result<(), DockLayoutError>
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.
Sourcepub fn is_registered(&self, id: DockPanelId) -> bool
pub fn is_registered(&self, id: DockPanelId) -> bool
Whether a panel widget is registered or queued for registration.