pub struct DockAction { /* private fields */ }Expand description
A dockless command button in the activity rail: it looks and behaves like an activity item, but opens no panel — activating it just runs a closure.
Declared on DockRail::action, so (like the rail’s slots) it is per-view
app config, reconstructed each run. A rail action is deliberately more
restricted than a real activity: it is never draggable, never hidable, has
no “Move to” menu, and is never overflow-parked — it is reserved space. That
matches every surveyed precedent (VS Code’s fixed Accounts / Manage cluster;
IntelliJ’s stripe, whose only non-tool-window button is IDE-owned chrome).
DockRail::new(DockSide::Leading).action(
DockAction::new(
DockActionId::named("app.settings"),
lit!("Settings"),
|| IconWidget::gear(),
|ctx| ctx.send_intent(Intent::new("app.settings")),
)
.placement(DockActionPlacement::Pinned),
)Implementations§
Source§impl DockAction
impl DockAction
Sourcepub fn new(
id: DockActionId,
label: impl Into<LocalizedString>,
icon: impl Fn() -> IconWidget + 'static,
on_activate: impl Fn(&mut EventContext<'_>) + 'static,
) -> Self
pub fn new( id: DockActionId, label: impl Into<LocalizedString>, icon: impl Fn() -> IconWidget + 'static, on_activate: impl Fn(&mut EventContext<'_>) + 'static, ) -> Self
Declare a rail action. Defaults to DockActionPlacement::End,
enabled, untoggled, with the label as its hover tooltip.
Sourcepub fn placement(self, placement: DockActionPlacement) -> Self
pub fn placement(self, placement: DockActionPlacement) -> Self
Where the action sits along the rail. See DockActionPlacement.
Sourcepub fn tooltip(self, tooltip: impl Into<LocalizedString>) -> Self
pub fn tooltip(self, tooltip: impl Into<LocalizedString>) -> Self
Override the hover tooltip (defaults to the label). Ignored in
Icon + Label rail mode, which paints the label inline instead.
Sourcepub fn enabled(self, enabled: impl Into<Prop<bool>>) -> Self
pub fn enabled(self, enabled: impl Into<Prop<bool>>) -> Self
Enable / disable the action. Accepts a bool or a Signal<bool>.
Sourcepub fn toggled(self, state: Signal<bool>) -> Self
pub fn toggled(self, state: Signal<bool>) -> Self
Paint the selected surface while state is true — the same
highlight an open activity gets. Reflect-only: activating the
action does not write state; on_activate must.
Sourcepub fn id(&self) -> DockActionId
pub fn id(&self) -> DockActionId
The action’s id.
Trait Implementations§
Source§impl Clone for DockAction
impl Clone for DockAction
Source§fn clone(&self) -> DockAction
fn clone(&self) -> DockAction
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreAuto Trait Implementations§
impl !RefUnwindSafe for DockAction
impl !Send for DockAction
impl !Sync for DockAction
impl !UnwindSafe for DockAction
impl Freeze for DockAction
impl Unpin for DockAction
impl UnsafeUnpin for DockAction
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,
§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