-
Notifications
You must be signed in to change notification settings - Fork 145
Description
During various passes, widgets that want to signal a semantically meaningful event from the UI (eg a button that was clicked) can emit actions.
Actions are a centralized queue of messages intended for the root application, mostly for the app driver (eg Xilem) to handle. They are inspired by Facebook's Flux architecture.
Actions are currently under-designed. Right now, they only store the emitter's id, plus a payload among a small set of types with Box<dyn Any>
as a wildcard:
pub enum Action {
/// A button was pressed.
///
/// Some presses are triggered without a pointer button;
/// for example, a touch screen does not exercise buttons.
/// In these cases, `None` will be the value here.
ButtonPressed(Option<PointerButton>),
/// Text changed.
TextChanged(String),
/// Text entered.
TextEntered(String),
/// A checkbox was toggled.
CheckboxToggled(bool),
// FIXME - This is a huge hack
/// Other.
Other(Box<dyn Any + Send>),
}
Ideally, we'd want each widget to have its own action variants, so the Widget
trait should have an Action
associated type.
This associated type be bound of Self: Sized
so that the trait remains dyn-safe.
Metadata
Metadata
Assignees
Labels
No labels