pub struct Form<'a, S: Scalar, A = (), T = ()> {
pub dialog: Dialog<S>,
pub visuals: Vec<Visual<S>>,
pub focus: Option<CoordinateSystem<S>>,
pub tool: bool,
/* private fields */
}Expand description
What an operation shows for a step: its fields and what setting each
does, and what it draws. A is its arguments, T its session; a form
an editor reads (see Form::erase) has neither.
Fields§
§dialog: Dialog<S>§visuals: Vec<Visual<S>>§focus: Option<CoordinateSystem<S>>A plane to work in, its u/v plane: the viewer faces it head on,
stops orbiting, and draws a grid on it. Draggable visuals are
dragged in it.
tool: boolWhether the operation has a tool in hand — drawing a line, say — so that clicks go to it rather than select.
Implementations§
Source§impl<'a, S: Scalar, A, T> Form<'a, S, A, T>
impl<'a, S: Scalar, A, T> Form<'a, S, A, T>
pub fn new() -> Self
Sourcepub fn set(&self, key: &str, edit: Edit<'_, A, T>, value: Value)
pub fn set(&self, key: &str, edit: Edit<'_, A, T>, value: Value)
What the field key does with value: its setter’s. Nothing for a
key no field has — a field shown only to be read.
Sourcepub fn erase(self) -> Form<'a, S>
pub fn erase(self) -> Form<'a, S>
The form as an editor reads it: what it shows, without what setting its fields does.
Sourcepub fn on(
&mut self,
key: impl Into<String>,
setter: impl Fn(Edit<'_, A, T>, Value) + 'a,
)
pub fn on( &mut self, key: impl Into<String>, setter: impl Fn(Edit<'_, A, T>, Value) + 'a, )
setter for the key key: for a control already in the dialog, or
one of its items — a list’s entries each have their own 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 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 for Form::on.
Sourcepub fn actions(
&mut self,
key: &str,
actions: Vec<Action>,
run: impl Fn(Edit<'_, A, T>, &str) + 'a,
) -> &mut Self
pub fn actions( &mut self, key: &str, actions: Vec<Action>, run: impl Fn(Edit<'_, A, T>, &str) + 'a, ) -> &mut Self
Things to do or choose; pressing one runs run with its value.
pub fn checkbox( &mut self, key: &str, label: impl Into<String>, value: bool, set: impl Fn(&mut A, bool) + 'a, ) -> &mut Self
pub fn number( &mut self, key: &str, number: Number<S>, set: impl Fn(&mut A, f64) + 'a, ) -> &mut Self
Sourcepub fn select(
&mut self,
key: &str,
label: impl Into<String>,
value: impl Into<String>,
options: Vec<Choice>,
set: impl Fn(&mut A, &str) + 'a,
) -> &mut Self
pub fn select( &mut self, key: &str, label: impl Into<String>, value: impl Into<String>, options: Vec<Choice>, set: impl Fn(&mut A, &str) + 'a, ) -> &mut Self
One of options, by value.
Sourcepub fn reference(
&mut self,
key: &str,
label: impl Into<String>,
value: Vec<EntityRef>,
roles: &[Role],
scope: Option<EntityRef>,
multiple: bool,
set: impl Fn(Edit<'_, A, T>, Vec<EntityRef>) + 'a,
) -> &mut Self
pub fn reference( &mut self, key: &str, label: impl Into<String>, value: Vec<EntityRef>, roles: &[Role], scope: Option<EntityRef>, multiple: bool, set: impl Fn(Edit<'_, A, T>, Vec<EntityRef>) + 'a, ) -> &mut Self
Entities that can fill one of roles — and, with a scope, are part
of it (see Reference); set gets what the field holds now.