pub struct Segment { /* private fields */ }Expand description
One segment descriptor: a localized label with a stable
SegmentId, an optional leading icon, a hover tooltip, and
reactive disabled / visible flags.
Implementations§
Source§impl Segment
impl Segment
Sourcepub fn id(self, id: SegmentId) -> Self
pub fn id(self, id: SegmentId) -> Self
Give this segment an app-chosen stable identity, replacing the
fresh id new allocated. Use this whenever the
selection is persisted or the segment is contributed by another
crate.
Sourcepub fn segment_id(&self) -> SegmentId
pub fn segment_id(&self) -> SegmentId
This segment’s identity.
Sourcepub fn icon(self, factory: impl Fn() -> IconWidget + 'static) -> Self
pub fn icon(self, factory: impl Fn() -> IconWidget + 'static) -> Self
Add a leading icon. The factory is invoked at build time (and on rebuild); the icon’s tint is bound reactively to the segment’s selected / focus / enabled state so it matches the label.
Sourcepub fn tooltip(self, text: impl Into<LocalizedString>) -> Self
pub fn tooltip(self, text: impl Into<LocalizedString>) -> Self
Hover tooltip — most useful for icon-only segments.
Mutually exclusive with rich_tooltip /
rich_tooltip_content /
composite_tooltip — last call wins.
Sourcepub fn rich_tooltip(self, key: impl Into<String>) -> Self
pub fn rich_tooltip(self, key: impl Into<String>) -> Self
Rich hover tooltip resolved from the app-wide registry by key.
Mutually exclusive with tooltip /
rich_tooltip_content /
composite_tooltip — last call wins.
Sourcepub fn rich_tooltip_content(self, content: TooltipContent) -> Self
pub fn rich_tooltip_content(self, content: TooltipContent) -> Self
Rich hover tooltip driven by an inline
TooltipContent entry
(no registry key needed).
Mutually exclusive with tooltip /
rich_tooltip /
composite_tooltip — last call wins.
Sourcepub fn composite_tooltip(
self,
factory: impl Fn() -> Box<dyn Widget> + 'static,
) -> Self
pub fn composite_tooltip( self, factory: impl Fn() -> Box<dyn Widget> + 'static, ) -> Self
Composite hover tooltip built by a factory closure at attach time.
The factory is called once per build() to produce the tooltip
body widget. It is stored as an Rc<dyn Fn> so that Segment
remains Clone.
Mutually exclusive with tooltip /
rich_tooltip /
rich_tooltip_content — last call wins.
Sourcepub fn disabled(self, disabled: impl Into<Prop<bool>>) -> Self
pub fn disabled(self, disabled: impl Into<Prop<bool>>) -> Self
Disable this segment: not selectable via click or keyboard, dimmed, and announced disabled to assistive tech.
Accepts a bool or a Signal<bool> — a bound signal flips the
segment live, with no rebuild, and keyboard stepping honours
the new value immediately (the flags are read at event time, not
snapshotted at build time).
Sourcepub fn visible(self, visible: impl Into<Prop<bool>>) -> Self
pub fn visible(self, visible: impl Into<Prop<bool>>) -> Self
Hide this segment entirely: it leaves the strip, the overflow menu, the keyboard order, and the accessibility tree, and it is excluded from the overflow calculation.
Distinct from overflowed — an overflowed segment is still
reachable from the chevron menu, a hidden one is not there at all.
Accepts a bool or a Signal<bool>; a bound signal re-runs the
overflow plan with no rebuild.
Trait Implementations§
Auto Trait Implementations§
impl !RefUnwindSafe for Segment
impl !Send for Segment
impl !Sync for Segment
impl !UnwindSafe for Segment
impl Freeze for Segment
impl Unpin for Segment
impl UnsafeUnpin for Segment
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