pub struct Indicator { /* private fields */ }Expand description
A micro-indicator, built then added inline (ui.add) or painted on
a widget (Indicator::on, Indicator::paint_at).
Need (status): a status dot, a LED, a count badge or a flag. Need (status): a colour swatch.
Implementations§
Source§impl Indicator
impl Indicator
Sourcepub fn dot(tone: Tone) -> Indicator
pub fn dot(tone: Tone) -> Indicator
A plain dot in a tone. Give it a name: a dot
alone says nothing but “something”.
Sourcepub fn text(text: impl Into<String>) -> Indicator
pub fn text(text: impl Into<String>) -> Indicator
A badge with a short text (!, NEW: three characters at most
read well).
Sourcepub fn flag_shape(shape: FlagShape) -> Indicator
pub fn flag_shape(shape: FlagShape) -> Indicator
A flag of the application’s: a shape, then a tone and a name.
Sourcepub fn mark(mark: ValueMark) -> Indicator
pub fn mark(mark: ValueMark) -> Indicator
A value’s mark (ValueMark): its shape, tone and meaning.
Sourcepub fn icon(icon: impl Into<IconRef>) -> Indicator
pub fn icon(icon: impl Into<IconRef>) -> Indicator
An icon as a mark, by value or by name ("visible",
"phosphor:wifi-high"; an unknown name is reported and drawn as
the placeholder).
Sourcepub fn toggle(
on: bool,
when_on: impl Into<IconRef>,
when_off: impl Into<IconRef>,
) -> Indicator
pub fn toggle( on: bool, when_on: impl Into<IconRef>, when_off: impl Into<IconRef>, ) -> Indicator
One of two icons by a state (eye and eye-off, lock and unlock), each by value or by name. Made interactive, it is a check box.
Sourcepub fn id(self, id: impl Into<String>) -> Self
pub fn id(self, id: impl Into<String>) -> Self
An id, for agents and tests: recorded each pass (drawn).
Sourcepub fn name(self, name: impl Into<String>) -> Self
pub fn name(self, name: impl Into<String>) -> Self
What the mark means, read with its host’s name (passive) or as its description (interactive). LEDs, flags, pips, swatches and counts have one by default.
Sourcepub fn tooltip(self, text: impl Into<String>) -> Self
pub fn tooltip(self, text: impl Into<String>) -> Self
The tooltip; by default the meaning (passive) or the action (interactive).
pub fn tone(self, tone: Tone) -> Self
pub fn size(self, size: Size) -> Self
Sourcepub fn interactive(self, action: impl Into<String>) -> Self
pub fn interactive(self, action: impl Into<String>) -> Self
Makes it a button whose accessible name is action (“Reset
exposure”, “Visible” for a toggle).
Sourcepub fn command(self, command: CommandId) -> Self
pub fn command(self, command: CommandId) -> Self
The command an activation runs (an interactive mark): the application runs it before the next frame, so it is a step.
Sourcepub fn disabled(self, reason: impl Into<String>) -> Self
pub fn disabled(self, reason: impl Into<String>) -> Self
Disables an interactive mark, saying why on hover.
Sourcepub fn attention(self, since: f64) -> Self
pub fn attention(self, since: f64) -> Self
Calls attention: pulses indicator.pulse.count times from
since (motion clock seconds, motion::now), then stays
still. A still ring under reduced motion, for as long.
Sourcepub fn delayed(self, id: Id, since: f64, busy: bool) -> Self
pub fn delayed(self, id: Id, since: f64, busy: bool) -> Self
A busy pip shown only after motion.spinner.delay of work, then
at least motion.spinner.min (motion::Busy); id keeps its
state, since is when the work started.
Sourcepub fn overhang(self, overhang: bool) -> Self
pub fn overhang(self, overhang: bool) -> Self
Whether it overhangs a corner (badges and dots do by default).
pub fn is_interactive(&self) -> bool
Sourcepub fn meaning(&self, ctx: &Context) -> Option<String>
pub fn meaning(&self, ctx: &Context) -> Option<String>
What it means, in the current language: the name given, else its kind’s (an LED’s state, a flag, a pip, a swatch’s colour, a count).
Sourcepub fn describe(&self, ctx: &Context) -> Record
pub fn describe(&self, ctx: &Context) -> Record
What agents and tests see of it (its rectangle empty: it is not drawn).
Sourcepub fn measure(&self, ui: &Ui) -> Vec2
pub fn measure(&self, ui: &Ui) -> Vec2
How much room the mark takes, for a caller placing it with
paint_at.
Sourcepub fn show(self, ui: &mut Ui) -> Response
pub fn show(self, ui: &mut Ui) -> Response
Adds it inline and returns its response (its target when
interactive): the same as ui.add.
Trait Implementations§
impl StructuralPartialEq for Indicator
Auto Trait Implementations§
impl Freeze for Indicator
impl RefUnwindSafe for Indicator
impl Send for Indicator
impl Sync for Indicator
impl Unpin for Indicator
impl UnsafeUnpin for Indicator
impl UnwindSafe for Indicator
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> 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