pub struct DockWidget { /* private fields */ }Expand description
App-facing declaration of a dock widget: identity, chrome metadata, and a
lazy content factory. Collect these on DockingLayout::dock.
Implementations§
Source§impl DockWidget
impl DockWidget
Sourcepub fn new<W: Widget + 'static>(
id: DockWidgetId,
title: impl Into<LocalizedString>,
factory: impl Fn(DockWidgetId) -> W + 'static,
) -> Self
pub fn new<W: Widget + 'static>( id: DockWidgetId, title: impl Into<LocalizedString>, factory: impl Fn(DockWidgetId) -> W + 'static, ) -> Self
Declare a dock widget. factory builds its content the first time the
dock appears (and after it is closed and re-opened).
Sourcepub fn icon(self, f: impl Fn() -> IconWidget + 'static) -> Self
pub fn icon(self, f: impl Fn() -> IconWidget + 'static) -> Self
Set the dock’s tab / rail icon.
Sourcepub fn header_actions(
self,
f: impl Fn(DockWidgetId) -> Vec<ToolbarItem> + 'static,
) -> Self
pub fn header_actions( self, f: impl Fn(DockWidgetId) -> Vec<ToolbarItem> + 'static, ) -> Self
Attach a factory for the dock’s inline header actions — a flat list
of ToolbarActions shown before the ⋮ options button, the VS Code
“view actions” pattern (“New File”, “Collapse All”, …). Built on demand
each time the dock is placed into a header. The framework hosts them in a
Toolbar, so the actions gain overflow (when the header is tight,
the lowest-priority actions collapse into a
⌄ menu) and the correct axis for free — a horizontal row on leading
/ trailing sides, a vertical column on the rotated top / bottom strip. The
actions appear in any header the dock has: the multi-pane Accordion
header always, and the sole-pane (bare) header when
show_header(true) is set.
Each item is a ToolbarItem — a collapsible
ToolbarAction via
ToolbarItem::action, or a pinned arbitrary widget (a SplitButton, a
search field, …) via ToolbarItem::custom.
DockWidget::new(id, lit!("Explorer"), build).header_actions(|_| vec![
ToolbarItem::action(ToolbarAction::new(lit!("New File"), new_icon).on_activate(..)),
ToolbarItem::custom(CreateSplitButton::new(..)),
])Sourcepub fn show_header(self, show: bool) -> Self
pub fn show_header(self, show: bool) -> Self
Give a sole-pane (bare) dock its own header bar (title + actions +
⋮ options). Default false. The multi-pane Accordion header is always
present regardless; this only governs the bare case. Turn it on to get a
discoverable options button (and inline header_actions) on a dock that
is the only one on its side.
Sourcepub fn default_location(self, loc: DockOpenLocation) -> Self
pub fn default_location(self, loc: DockOpenLocation) -> Self
The location used when the dock is opened via toggle / reveal
without an explicit target.
Auto Trait Implementations§
impl !RefUnwindSafe for DockWidget
impl !Send for DockWidget
impl !Sync for DockWidget
impl !UnwindSafe for DockWidget
impl Freeze for DockWidget
impl Unpin for DockWidget
impl UnsafeUnpin for DockWidget
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
§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
§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.§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.§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.§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.impl<T> ErasedDestructor for Twhere
T: 'static,
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§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