pub struct RadioButton<T> { /* private fields */ }
Expand description
Variant of Checkbox
arranged in group.
RadioButton
s are managed by a RadioGroup
. A single group can contain
several radio buttons, but only one button per group can be active at a
time.
RadioButton
s are not created directly, but through
RadioGroup::button
.
Implementations§
Source§impl RadioButton<String>
impl RadioButton<String>
Sourcepub fn global_str<S>(key: &str, text: S) -> RadioButton<String>
pub fn global_str<S>(key: &str, text: S) -> RadioButton<String>
Create a new button on the global group pool.
Uses the label itself as value.
If no group exist for the given key
and type T
, one will be created.
Source§impl<T> RadioButton<T>
impl<T> RadioButton<T>
Sourcepub fn disabled(self) -> RadioButton<T>
pub fn disabled(self) -> RadioButton<T>
Disables this view.
Chainable variant.
Sourcepub fn set_enabled(&mut self, enabled: bool)
pub fn set_enabled(&mut self, enabled: bool)
Enable or disable this view.
Sourcepub fn with_enabled(self, is_enabled: bool) -> RadioButton<T>
pub fn with_enabled(self, is_enabled: bool) -> RadioButton<T>
Enable or disable this view.
Chainable variant.
Sourcepub fn is_enabled(&self) -> bool
pub fn is_enabled(&self) -> bool
Returns true
if this view is enabled.
Sourcepub fn global<S>(key: &str, value: T, label: S) -> RadioButton<T>
pub fn global<S>(key: &str, value: T, label: S) -> RadioButton<T>
Create a new button on the global group pool.
If no group exist for the given key
and type T
, one will be created.
Sourcepub fn is_selected(&self) -> bool
pub fn is_selected(&self) -> bool
Returns true
if this button is selected.
Sourcepub fn select(&mut self) -> EventResult
pub fn select(&mut self) -> EventResult
Selects this button, un-selecting any other in the same group.
Sourcepub fn selected(self) -> RadioButton<T>
pub fn selected(self) -> RadioButton<T>
Selects this button, un-selecting any other in the same group.
Chainable variant.
Sourcepub fn from_group<S>(
group: &mut RadioGroup<T>,
value: T,
label: S,
) -> RadioButton<T>
pub fn from_group<S>( group: &mut RadioGroup<T>, value: T, label: S, ) -> RadioButton<T>
Build a button from a radio group.
Equivalent to group.button(value, label)
Source§impl RadioButton<String>
impl RadioButton<String>
Sourcepub fn from_group_str<S>(
group: &mut RadioGroup<String>,
label: S,
) -> RadioButton<String>
pub fn from_group_str<S>( group: &mut RadioGroup<String>, label: S, ) -> RadioButton<String>
Build a button from a radio group.
Equivalent to group.button_str(label)
Trait Implementations§
Source§impl<T> View for RadioButton<T>
impl<T> View for RadioButton<T>
Source§fn required_size(&mut self, _: XY<usize>) -> XY<usize>
fn required_size(&mut self, _: XY<usize>) -> XY<usize>
Source§fn take_focus(&mut self, _: Direction) -> Result<EventResult, CannotFocus>
fn take_focus(&mut self, _: Direction) -> Result<EventResult, CannotFocus>
Source§fn draw(&self, printer: &Printer<'_, '_>)
fn draw(&self, printer: &Printer<'_, '_>)
Source§fn on_event(&mut self, event: Event) -> EventResult
fn on_event(&mut self, event: Event) -> EventResult
Source§fn layout(&mut self, _: XY<usize>)
fn layout(&mut self, _: XY<usize>)
Source§fn needs_relayout(&self) -> bool
fn needs_relayout(&self) -> bool
Source§fn call_on_any(
&mut self,
_: &Selector<'_>,
_: &mut dyn FnMut(&mut (dyn View + 'static)),
)
fn call_on_any( &mut self, _: &Selector<'_>, _: &mut dyn FnMut(&mut (dyn View + 'static)), )
Source§fn focus_view(&mut self, _: &Selector<'_>) -> Result<EventResult, ViewNotFound>
fn focus_view(&mut self, _: &Selector<'_>) -> Result<EventResult, ViewNotFound>
Auto Trait Implementations§
impl<T> Freeze for RadioButton<T>
impl<T> RefUnwindSafe for RadioButton<T>
impl<T> Send for RadioButton<T>
impl<T> Sync for RadioButton<T>
impl<T> Unpin for RadioButton<T>
impl<T> UnwindSafe for RadioButton<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
Source§impl<T> Finder for Twhere
T: View,
impl<T> Finder for Twhere
T: View,
Source§fn call_on_all<V, F>(&mut self, sel: &Selector<'_>, callback: F)
fn call_on_all<V, F>(&mut self, sel: &Selector<'_>, callback: F)
sel
. Read moreSource§fn call_on<V, F, R>(&mut self, sel: &Selector<'_>, callback: F) -> Option<R>
fn call_on<V, F, R>(&mut self, sel: &Selector<'_>, callback: F) -> Option<R>
sel
. Read moreSource§fn call_on_name<V, F, R>(&mut self, name: &str, callback: F) -> Option<R>
fn call_on_name<V, F, R>(&mut self, name: &str, callback: F) -> Option<R>
call_on
with a view::Selector::Name
.Source§impl<T> IntoBoxedView for Twhere
T: View,
impl<T> IntoBoxedView for Twhere
T: View,
Source§fn into_boxed_view(self) -> Box<dyn View>
fn into_boxed_view(self) -> Box<dyn View>
Box<View>
.Source§impl<T> Resizable for Twhere
T: View,
impl<T> Resizable for Twhere
T: View,
Source§fn resized(
self,
width: SizeConstraint,
height: SizeConstraint,
) -> ResizedView<Self>
fn resized( self, width: SizeConstraint, height: SizeConstraint, ) -> ResizedView<Self>
self
in a ResizedView
with the given size constraints.Source§fn fixed_size<S>(self, size: S) -> ResizedView<Self>
fn fixed_size<S>(self, size: S) -> ResizedView<Self>
self
into a fixed-size ResizedView
.Source§fn fixed_width(self, width: usize) -> ResizedView<Self>
fn fixed_width(self, width: usize) -> ResizedView<Self>
self
into a fixed-width ResizedView
.Source§fn fixed_height(self, height: usize) -> ResizedView<Self>
fn fixed_height(self, height: usize) -> ResizedView<Self>
self
into a fixed-width ResizedView
.Source§fn full_screen(self) -> ResizedView<Self>
fn full_screen(self) -> ResizedView<Self>
self
into a full-screen ResizedView
.Source§fn full_width(self) -> ResizedView<Self>
fn full_width(self) -> ResizedView<Self>
self
into a full-width ResizedView
.Source§fn full_height(self) -> ResizedView<Self>
fn full_height(self) -> ResizedView<Self>
self
into a full-height ResizedView
.Source§fn max_size<S>(self, size: S) -> ResizedView<Self>
fn max_size<S>(self, size: S) -> ResizedView<Self>
self
into a limited-size ResizedView
.Source§fn max_width(self, max_width: usize) -> ResizedView<Self>
fn max_width(self, max_width: usize) -> ResizedView<Self>
self
into a limited-width ResizedView
.Source§fn max_height(self, max_height: usize) -> ResizedView<Self>
fn max_height(self, max_height: usize) -> ResizedView<Self>
self
into a limited-height ResizedView
.Source§fn min_size<S>(self, size: S) -> ResizedView<Self>
fn min_size<S>(self, size: S) -> ResizedView<Self>
self
into a ResizedView
at least sized size
.Source§fn min_width(self, min_width: usize) -> ResizedView<Self>
fn min_width(self, min_width: usize) -> ResizedView<Self>
self
in a ResizedView
at least min_width
wide.Source§fn min_height(self, min_height: usize) -> ResizedView<Self>
fn min_height(self, min_height: usize) -> ResizedView<Self>
self
in a ResizedView
at least min_height
tall.Source§impl<T> Scrollable for Twhere
T: View,
impl<T> Scrollable for Twhere
T: View,
Source§fn scrollable(self) -> ScrollView<Self>
fn scrollable(self) -> ScrollView<Self>
self
in a ScrollView
.