pub struct Dialog(pub Vec<Field>);Expand description
The fields an operation shows for a step, in order: an ordered
dictionary from key to control, serialized as a list, so a UI renders it
with one map and keys each element by it. Keys are unique.
Tuple Fields§
§0: Vec<Field>Implementations§
Source§impl Dialog
impl Dialog
pub fn new() -> Self
Sourcepub fn push(&mut self, key: impl Into<String>, control: Control) -> &mut Self
pub fn push(&mut self, key: impl Into<String>, control: Control) -> &mut Self
Appends control under key.
pub fn heading(&mut self, key: &str, text: impl Into<String>) -> &mut Self
pub fn text( &mut self, key: &str, text: impl Into<String>, tone: Tone, ) -> &mut Self
Sourcepub fn input(
&mut self,
key: &str,
label: impl Into<String>,
value: impl Into<String>,
placeholder: Option<&str>,
) -> &mut Self
pub fn input( &mut self, key: &str, label: impl Into<String>, value: impl Into<String>, placeholder: Option<&str>, ) -> &mut Self
Text typed: a name, a title (see Control::Input).
Sourcepub fn table(&mut self, key: &str, table: Table) -> &mut Self
pub fn table(&mut self, key: &str, table: Table) -> &mut Self
A table edited in place (see Table).
Sourcepub fn list(
&mut self,
key: &str,
items: Vec<ListItem>,
empty: impl Into<String>,
) -> &mut Self
pub fn list( &mut self, key: &str, items: Vec<ListItem>, empty: impl Into<String>, ) -> &mut Self
A list of entries, each with a key of its own.
Sourcepub fn download(
&mut self,
key: &str,
exporter: &str,
formats: Vec<Choice>,
) -> &mut Self
pub fn download( &mut self, key: &str, exporter: &str, formats: Vec<Choice>, ) -> &mut Self
Files the step can be saved as by the exporter exporter, one
button per format in formats (see Control::Download).
Sourcepub fn actions(&mut self, key: &str, actions: Vec<Action>) -> &mut Self
pub fn actions(&mut self, key: &str, actions: Vec<Action>) -> &mut Self
Things to do or choose: pressing one sends its value as
super::Value::Choice.
pub fn checkbox( &mut self, key: &str, label: impl Into<String>, value: bool, ) -> &mut Self
pub fn number(&mut self, key: &str, number: Number) -> &mut Self
Sourcepub fn select(
&mut self,
key: &str,
label: impl Into<String>,
value: impl Into<String>,
options: Vec<Choice>,
searchable: bool,
) -> &mut Self
pub fn select( &mut self, key: &str, label: impl Into<String>, value: impl Into<String>, options: Vec<Choice>, searchable: bool, ) -> &mut Self
One of options, by value — found by typing, if searchable.
Sourcepub fn file(
&mut self,
key: &str,
label: impl Into<String>,
value: impl Into<String>,
files: Vec<FileEntry>,
upload: &[&str],
) -> &mut Self
pub fn file( &mut self, key: &str, label: impl Into<String>, value: impl Into<String>, files: Vec<FileEntry>, upload: &[&str], ) -> &mut Self
A file the program reads or places, by its path relative to the
program: one of files it takes, or one the user adds from
elsewhere of the kinds upload, extensions without the dot (see
Control::File).
Sourcepub fn color(
&mut self,
key: &str,
label: impl Into<String>,
value: impl Into<String>,
) -> &mut Self
pub fn color( &mut self, key: &str, label: impl Into<String>, value: impl Into<String>, ) -> &mut Self
A colour, #rrggbb.
Sourcepub fn pick<P: Selectable>(
&mut self,
key: &str,
label: impl Into<String>,
reader: &Reader<'_>,
value: &[P],
multiple: bool,
) -> &mut Self
pub fn pick<P: Selectable>( &mut self, key: &str, label: impl Into<String>, reader: &Reader<'_>, value: &[P], multiple: bool, ) -> &mut Self
Values picked, holding value, each selected by a click as P says
(see Selectable) in the part reader reads. What a field so made
is sent back, crate::selectable::selected turns into values. Required: see Dialog::optional.
Sourcepub fn reference(
&mut self,
key: &str,
label: impl Into<String>,
value: Vec<Picked>,
accepts: &[&str],
multiple: bool,
preview: Preview,
) -> &mut Self
pub fn reference( &mut self, key: &str, label: impl Into<String>, value: Vec<Picked>, accepts: &[&str], multiple: bool, preview: Preview, ) -> &mut Self
Elements of the kinds accepts (see Reference), holding value,
what a click would pick drawn as preview says. Required: see
Dialog::optional.
Sourcepub fn optional(&mut self, key: &str) -> &mut Self
pub fn optional(&mut self, key: &str) -> &mut Self
Makes the reference field key optional: the step builds without
it, and it is only picked for when pressed (see
Reference::required).
Sourcepub fn references(&self) -> impl Iterator<Item = (&str, &Reference)>
pub fn references(&self) -> impl Iterator<Item = (&str, &Reference)>
Every reference field, by key.
Sourcepub fn references_mut(&mut self) -> impl Iterator<Item = (&str, &mut Reference)>
pub fn references_mut(&mut self) -> impl Iterator<Item = (&str, &mut Reference)>
Every reference field, by key, to change.
Sourcepub fn previewed(
&self,
reader: &Reader<'_>,
key: &str,
element: &PickedElement,
) -> Option<Picked>
pub fn previewed( &self, reader: &Reader<'_>, key: &str, element: &PickedElement, ) -> Option<Picked>
What a click on element would pick for the reference field
key, in the part reader reads: as it would be held, to light
and draw while the pointer is over it (see Preview).
Sourcepub fn shown(&self, hovered: Option<&Picked>) -> Vec<Visual>
pub fn shown(&self, hovered: Option<&Picked>) -> Vec<Visual>
What an editor draws of every value its reference fields hold
besides lighting it (see Picked::visuals), drawn as selected —
and of hovered, what a click would pick now, drawn as hovered.
Sourcepub fn concerning(&mut self, key: &str, error: &str) -> bool
pub fn concerning(&mut self, key: &str, error: &str) -> bool
What an editor draws of every element its reference fields hold:
what the step builds on, to light.
Says error beside the field key, if it has one: whether it did.