pub struct RadioGroup<T> { /* private fields */ }
Expand description
Group to coordinate multiple radio buttons.
A RadioGroup
is used to create and manage RadioButton
s.
A RadioGroup
can be cloned; it will keep pointing to the same group.
Implementations§
Source§impl<T> RadioGroup<T>
impl<T> RadioGroup<T>
Sourcepub fn new() -> RadioGroup<T>
pub fn new() -> RadioGroup<T>
Creates an empty group for radio buttons.
Sourcepub fn global<S>(key: S) -> RadioGroup<T>
pub fn global<S>(key: S) -> RadioGroup<T>
Get a global group based on a key and T
type.
Sourcepub fn with_global<F, R, S>(key: S, f: F) -> R
pub fn with_global<F, R, S>(key: S, f: F) -> R
Run a closure on a radio group from a global pool.
If none exist with the given type T
and key
, a new one will be created.
Adds a new button to the group.
The button will display label
next to it, and will embed value
.
Sourcepub fn selected_id(&self) -> usize
pub fn selected_id(&self) -> usize
Returns the id of the selected button.
Buttons are indexed in the order they are created, starting from 0.
Sourcepub fn set_on_change<F>(&mut self, on_change: F)
pub fn set_on_change<F>(&mut self, on_change: F)
Sets a callback to be used when the selection changes.
Source§impl RadioGroup<String>
impl RadioGroup<String>
Adds a button, using the label itself as value.
Trait Implementations§
Source§impl<T> Clone for RadioGroup<T>
impl<T> Clone for RadioGroup<T>
Source§fn clone(&self) -> RadioGroup<T>
fn clone(&self) -> RadioGroup<T>
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moreSource§impl<T> Default for RadioGroup<T>
impl<T> Default for RadioGroup<T>
Source§fn default() -> RadioGroup<T>
fn default() -> RadioGroup<T>
Returns the “default value” for a type. Read more
Source§impl Resolvable for RadioGroup<String>
impl Resolvable for RadioGroup<String>
Auto Trait Implementations§
impl<T> Freeze for RadioGroup<T>
impl<T> RefUnwindSafe for RadioGroup<T>
impl<T> Send for RadioGroup<T>
impl<T> Sync for RadioGroup<T>
impl<T> Unpin for RadioGroup<T>
impl<T> UnwindSafe for RadioGroup<T>
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more