pub enum DockItem {
Split {
axis: Axis,
size: Option<Pixels>,
items: Vec<DockItem>,
sizes: Vec<Option<Pixels>>,
view: Entity<StackPanel>,
},
Tabs {
size: Option<Pixels>,
items: Vec<Arc<dyn PanelView>>,
active_ix: usize,
view: Entity<TabPanel>,
},
Panel {
size: Option<Pixels>,
view: Arc<dyn PanelView>,
},
Tiles {
size: Option<Pixels>,
items: Vec<TileItem>,
view: Entity<Tiles>,
},
}Expand description
DockItem is a tree structure that represents the layout of the dock.
Variants§
Split
Split layout
Fields
view: Entity<StackPanel>Tabs
Tab layout
Fields
Panel
Panel layout
Tiles
Tiles layout
Implementations§
Source§impl DockItem
impl DockItem
Sourcepub fn active_index(self, new_active_ix: usize) -> Self
pub fn active_index(self, new_active_ix: usize) -> Self
Set active index for the DockItem, only valid for DockItem::Tabs.
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::Split with given split layout.
Sourcepub fn v_split(
items: Vec<DockItem>,
dock_area: &WeakEntity<DockArea>,
window: &mut Window,
cx: &mut App,
) -> Self
pub fn v_split( items: Vec<DockItem>, dock_area: &WeakEntity<DockArea>, window: &mut Window, cx: &mut App, ) -> Self
Create DockItem with vertical split layout.
Sourcepub fn h_split(
items: Vec<DockItem>,
dock_area: &WeakEntity<DockArea>,
window: &mut Window,
cx: &mut App,
) -> Self
pub fn h_split( items: Vec<DockItem>, dock_area: &WeakEntity<DockArea>, window: &mut Window, cx: &mut App, ) -> Self
Create DockItem with horizontal split layout.
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>>,
dock_area: &WeakEntity<DockArea>,
window: &mut Window,
cx: &mut App,
) -> Self
pub fn tabs( items: Vec<Arc<dyn PanelView>>, 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
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.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>
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>
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