pub enum DockItem {
Split {
axis: Axis,
items: Vec<DockItem>,
sizes: Vec<Option<Pixels>>,
view: Entity<StackPanel>,
},
Tabs {
items: Vec<Arc<dyn PanelView>>,
active_ix: usize,
view: Entity<TabPanel>,
},
Panel {
view: Arc<dyn PanelView>,
},
Tiles {
items: Vec<TileItem>,
view: Entity<Tiles>,
},
}Expand description
DockItem is a tree structure that represents the layout of the dock.
Variants§
Implementations§
Source§impl DockItem
impl DockItem
Sourcepub fn split(
axis: Axis,
items: Vec<DockItem>,
dock_area: &WeakEntity<DockArea>,
window: &mut Window,
cx: &mut App,
) -> Self
pub fn split( axis: Axis, items: Vec<DockItem>, dock_area: &WeakEntity<DockArea>, window: &mut Window, cx: &mut App, ) -> Self
Create DockItem with split layout, each item of panel have equal size.
Sourcepub fn split_with_sizes(
axis: Axis,
items: Vec<DockItem>,
sizes: Vec<Option<Pixels>>,
dock_area: &WeakEntity<DockArea>,
window: &mut Window,
cx: &mut App,
) -> Self
pub fn split_with_sizes( axis: Axis, items: Vec<DockItem>, sizes: Vec<Option<Pixels>>, dock_area: &WeakEntity<DockArea>, window: &mut Window, cx: &mut App, ) -> Self
Create DockItem with split layout, each item of panel have specified size.
Please note that the items and sizes must have the same length.
Set None in sizes to make the index of panel have auto size.
Sourcepub fn tiles(
items: Vec<DockItem>,
metas: Vec<impl Into<TileMeta> + Copy>,
dock_area: &WeakEntity<DockArea>,
window: &mut Window,
cx: &mut App,
) -> Self
pub fn tiles( items: Vec<DockItem>, metas: Vec<impl Into<TileMeta> + Copy>, dock_area: &WeakEntity<DockArea>, window: &mut Window, cx: &mut App, ) -> Self
Create DockItem with tiles layout
This items and metas should have the same length.
Sourcepub fn tabs(
items: Vec<Arc<dyn PanelView>>,
active_ix: Option<usize>,
dock_area: &WeakEntity<DockArea>,
window: &mut Window,
cx: &mut App,
) -> Self
pub fn tabs( items: Vec<Arc<dyn PanelView>>, active_ix: Option<usize>, dock_area: &WeakEntity<DockArea>, window: &mut Window, cx: &mut App, ) -> Self
Create DockItem with tabs layout, items are displayed as tabs.
The active_ix is the index of the active tab, if None the first tab is active.
pub fn tab<P: Panel>( item: Entity<P>, dock_area: &WeakEntity<DockArea>, window: &mut Window, cx: &mut App, ) -> Self
Sourcepub fn find_panel(
&self,
panel: Arc<dyn PanelView>,
) -> Option<Arc<dyn PanelView>>
pub fn find_panel( &self, panel: Arc<dyn PanelView>, ) -> Option<Arc<dyn PanelView>>
Find existing panel in the dock item.
Sourcepub fn add_panel(
&mut self,
panel: Arc<dyn PanelView>,
dock_area: &WeakEntity<DockArea>,
bounds: Option<Bounds<Pixels>>,
window: &mut Window,
cx: &mut App,
)
pub fn add_panel( &mut self, panel: Arc<dyn PanelView>, dock_area: &WeakEntity<DockArea>, bounds: Option<Bounds<Pixels>>, window: &mut Window, cx: &mut App, )
Add a panel to the dock item.
Sourcepub fn remove_panel(
&self,
panel: Arc<dyn PanelView>,
window: &mut Window,
cx: &mut App,
)
pub fn remove_panel( &self, panel: Arc<dyn PanelView>, window: &mut Window, cx: &mut App, )
Remove a panel from the dock item.
pub fn set_collapsed(&self, collapsed: bool, window: &mut Window, cx: &mut App)
Trait Implementations§
Auto Trait Implementations§
impl Freeze for DockItem
impl !RefUnwindSafe for DockItem
impl Send for DockItem
impl Sync for DockItem
impl Unpin for DockItem
impl !UnwindSafe for DockItem
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
Mutably borrows from an owned value. Read more
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>
Convert
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>
Convert
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)
Convert
&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)
Convert
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.Source§impl<T> DowncastSync for T
impl<T> DowncastSync for T
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more