Struct conrod::Toggle
[−]
[src]
pub struct Toggle<'a, F> { // some fields omitted }
A pressable widget for toggling the state of a bool. Like the button widget, it's reaction is triggered upon release and will return the new bool state. Note that the toggle will not mutate the bool for you, you should do this yourself within the react closure.
Methods
impl<'a, F> Toggle<'a, F>
fn new(value: bool) -> Toggle<'a, F>
Construct a new Toggle widget.
fn react(self, reaction: F) -> Self
Set the reaction for the Toggle. It will be triggered upon release of the button.
fn set<C>(self, ui_id: UiId, ui: &mut Ui<C>) where F: FnMut(bool)
After building the Toggle, use this method to set its current state into the given Ui
.
It will use this state for rendering the next time ui.draw(graphics)
is called.