pub struct DockWorkspaceState { /* private fields */ }Expand description
Cloneable observable state for DockWorkspace.
Implementations§
Source§impl DockWorkspaceState
impl DockWorkspaceState
pub fn new( snapshot: DockWorkspaceSnapshot, ) -> Result<DockWorkspaceState, DockLayoutError>
pub fn empty() -> DockWorkspaceState
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.
Trait Implementations§
Source§impl Clone for DockWorkspaceState
impl Clone for DockWorkspaceState
Source§fn clone(&self) -> DockWorkspaceState
fn clone(&self) -> DockWorkspaceState
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for DockWorkspaceState
impl Debug for DockWorkspaceState
Source§impl Default for DockWorkspaceState
impl Default for DockWorkspaceState
Source§fn default() -> DockWorkspaceState
fn default() -> DockWorkspaceState
Auto Trait Implementations§
impl Forget for DockWorkspaceState
impl Freeze for DockWorkspaceState
impl Move for DockWorkspaceState
impl RefUnwindSafe for DockWorkspaceState
impl Send for DockWorkspaceState
impl Sync for DockWorkspaceState
impl Unpin for DockWorkspaceState
impl UnsafeUnpin for DockWorkspaceState
impl UnwindSafe for DockWorkspaceState
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can
then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.Source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be
further downcast into Rc<ConcreteType> where ConcreteType implements Trait.Source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.Source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.