Skip to main content

Indicator

Struct Indicator 

Source
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

Source

pub fn dot(tone: Tone) -> Indicator

A plain dot in a tone. Give it a name: a dot alone says nothing but “something”.

Source

pub fn led(state: Led) -> Indicator

An LED: its state’s shape and tone, its state’s name.

Source

pub fn count(count: u64) -> Indicator

A count badge: 99+ past its cap, hidden at zero unless show_zero. Its name is the real count.

Source

pub fn text(text: impl Into<String>) -> Indicator

A badge with a short text (!, NEW: three characters at most read well).

Source

pub fn pip(state: Pip) -> Indicator

An activity pip.

Source

pub fn flag(flag: Flag) -> Indicator

One of egui-pop’s flags, with its shape, tone and name.

Source

pub fn flag_shape(shape: FlagShape) -> Indicator

A flag of the application’s: a shape, then a tone and a name.

Source

pub fn mark(mark: ValueMark) -> Indicator

A value’s mark (ValueMark): its shape, tone and meaning.

Source

pub fn swatch(color: Color32) -> Indicator

A colour swatch.

Source

pub fn swatch_of(swatch: Swatch) -> Indicator

A swatch saying “no colour”, or “mixed”.

Source

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).

Source

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.

Source

pub fn id(self, id: impl Into<String>) -> Self

An id, for agents and tests: recorded each pass (drawn).

Source

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.

Source

pub fn tooltip(self, text: impl Into<String>) -> Self

The tooltip; by default the meaning (passive) or the action (interactive).

Source

pub fn tone(self, tone: Tone) -> Self

Source

pub fn size(self, size: Size) -> Self

Source

pub fn cap(self, cap: u64) -> Self

A badge’s cap: cap+ past it.

Source

pub fn show_zero(self, show: bool) -> Self

Shows a count of zero (hidden by default).

Source

pub fn interactive(self, action: impl Into<String>) -> Self

Makes it a button whose accessible name is action (“Reset exposure”, “Visible” for a toggle).

Source

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.

Source

pub fn disabled(self, reason: impl Into<String>) -> Self

Disables an interactive mark, saying why on hover.

Source

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.

Source

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.

Source

pub fn overhang(self, overhang: bool) -> Self

Whether it overhangs a corner (badges and dots do by default).

Source

pub fn is_interactive(&self) -> bool

Source

pub fn tone_of(&self) -> Tone

Its tone: the one given, else its kind’s.

Source

pub fn label(&self) -> Option<String>

The text a badge shows (none for other kinds).

Source

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).

Source

pub fn describe(&self, ctx: &Context) -> Record

What agents and tests see of it (its rectangle empty: it is not drawn).

Source

pub fn measure(&self, ui: &Ui) -> Vec2

How much room the mark takes, for a caller placing it with paint_at.

Source

pub fn show(self, ui: &mut Ui) -> Response

Adds it inline and returns its response (its target when interactive): the same as ui.add.

Source

pub fn on(self, ui: &mut Ui, host: &Response, anchor: Anchor) -> Response

Paints it on a widget’s corner, edge or centre, and adds its meaning to that widget’s accessible name when passive. Returns the mark’s response (a button’s when interactive).

Source

pub fn paint_at(self, ui: &mut Ui, host: Rect, anchor: Anchor) -> Response

Paints it on a rectangle (no widget’s name to add to). Returns the mark’s response (a button’s when interactive).

Trait Implementations§

Source§

impl Clone for Indicator

Source§

fn clone(&self) -> Indicator

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for Indicator

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl PartialEq for Indicator

Source§

fn eq(&self, other: &Indicator) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl Widget for Indicator

Source§

fn ui(self, ui: &mut Ui) -> Response

Allocate space, interact, paint, and return a [Response]. Read more
§

fn boxed<'a>(self) -> Box<dyn FnOnce(&mut Ui) -> Response + 'a>
where Self: Sized + 'a,

Box this widget for dynamic dispatch.
Source§

impl StructuralPartialEq for Indicator

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts 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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts 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
§

impl<T, S> SimdFrom<T, S> for T
where S: Simd,

§

fn simd_from(_simd: S, value: T) -> T

§

impl<F, T, S> SimdInto<T, S> for F
where T: SimdFrom<F, S>, S: Simd,

§

fn simd_into(self, simd: S) -> T

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

§

impl<T> SerializableAny for T
where T: 'static + Any + Clone + for<'a> Send + Sync,