Struct kas_widgets::RadioBox
source · pub struct RadioBox { /* private fields */ }
Expand description
A bare radio box (no label)
See also RadioButton
which includes a label.
Implementations§
source§impl RadioBox
impl RadioBox
sourcepub fn new(group: RadioGroup) -> Self
pub fn new(group: RadioGroup) -> Self
Construct a radio box
All instances of RadioBox
and RadioButton
constructed over the
same group
will be considered part of a single group.
sourcepub fn on_select<F>(self, f: F) -> RadioBoxwhere
F: Fn(&mut EventMgr<'_>) + 'static,
pub fn on_select<F>(self, f: F) -> RadioBoxwhere F: Fn(&mut EventMgr<'_>) + 'static,
Set event handler f
When the radio box is selected, the closure f
is called.
No handler is called on deselection.
sourcepub fn new_on<F>(group: RadioGroup, f: F) -> Selfwhere
F: Fn(&mut EventMgr<'_>) + 'static,
pub fn new_on<F>(group: RadioGroup, f: F) -> Selfwhere F: Fn(&mut EventMgr<'_>) + 'static,
Construct a radio box with given group
and event handler f
All instances of RadioBox
and RadioButton
constructed over the
same group
will be considered part of a single group.
When the radio box is selected, the closure f
is called.
No handler is called on deselection.
sourcepub fn with_state(self, state: bool) -> Self
pub fn with_state(self, state: bool) -> Self
Set the initial state of the radio box.
sourcepub fn select(&mut self, mgr: &mut EventMgr<'_>) -> bool
pub fn select(&mut self, mgr: &mut EventMgr<'_>) -> bool
Select this radio box from the group
This radio box will be set true while all others from the group will be set false. Returns true if newly selected, false if already selected.
This does not call the event handler set by Self::on_select
or Self::new_on
.
Trait Implementations§
source§impl Layout for RadioBox
impl Layout for RadioBox
source§impl Widget for RadioBox
impl Widget for RadioBox
source§fn translation(&self) -> Offset
fn translation(&self) -> Offset
source§fn steal_event(
&mut self,
mgr: &mut EventMgr<'_>,
id: &WidgetId,
event: &Event
) -> Response
fn steal_event( &mut self, mgr: &mut EventMgr<'_>, id: &WidgetId, event: &Event ) -> Response
source§fn handle_unused(&mut self, mgr: &mut EventMgr<'_>, event: Event) -> Response
fn handle_unused(&mut self, mgr: &mut EventMgr<'_>, event: Event) -> Response
index
but left unhandled Read moresource§fn handle_message(&mut self, mgr: &mut EventMgr<'_>)
fn handle_message(&mut self, mgr: &mut EventMgr<'_>)
source§impl WidgetChildren for RadioBox
impl WidgetChildren for RadioBox
source§fn num_children(&self) -> usize
fn num_children(&self) -> usize
source§fn get_child(&self, _index: usize) -> Option<&dyn Widget>
fn get_child(&self, _index: usize) -> Option<&dyn Widget>
None
if the index is
out of bounds. Read moresource§fn get_child_mut(&mut self, _index: usize) -> Option<&mut dyn Widget>
fn get_child_mut(&mut self, _index: usize) -> Option<&mut dyn Widget>
source§impl WidgetCore for RadioBox
impl WidgetCore for RadioBox
source§fn widget_name(&self) -> &'static str
fn widget_name(&self) -> &'static str
source§fn as_widget_mut(&mut self) -> &mut dyn Widget
fn as_widget_mut(&mut self) -> &mut dyn Widget
Auto Trait Implementations§
impl !RefUnwindSafe for RadioBox
impl !Send for RadioBox
impl !Sync for RadioBox
impl Unpin for RadioBox
impl !UnwindSafe for RadioBox
Blanket Implementations§
§impl<S, T> Cast<T> for Swhere
T: Conv<S>,
impl<S, T> Cast<T> for Swhere T: Conv<S>,
§impl<S, T> CastApprox<T> for Swhere
T: ConvApprox<S>,
impl<S, T> CastApprox<T> for Swhere T: ConvApprox<S>,
§fn try_cast_approx(self) -> Result<T, Error>
fn try_cast_approx(self) -> Result<T, Error>
§fn cast_approx(self) -> T
fn cast_approx(self) -> T
§impl<S, T> CastFloat<T> for Swhere
T: ConvFloat<S>,
impl<S, T> CastFloat<T> for Swhere T: ConvFloat<S>,
§fn cast_trunc(self) -> T
fn cast_trunc(self) -> T
§fn cast_nearest(self) -> T
fn cast_nearest(self) -> T
§fn cast_floor(self) -> T
fn cast_floor(self) -> T
§fn try_cast_trunc(self) -> Result<T, Error>
fn try_cast_trunc(self) -> Result<T, Error>
§fn try_cast_nearest(self) -> Result<T, Error>
fn try_cast_nearest(self) -> Result<T, Error>
§fn try_cast_floor(self) -> Result<T, Error>
fn try_cast_floor(self) -> Result<T, Error>
§fn try_cast_ceil(self) -> Result<T, Error>
fn try_cast_ceil(self) -> Result<T, Error>
source§impl<W> WidgetExt for Wwhere
W: Widget + ?Sized,
impl<W> WidgetExt for Wwhere W: Widget + ?Sized,
source§fn eq_id<T>(&self, rhs: T) -> boolwhere
WidgetId: PartialEq<T>,
fn eq_id<T>(&self, rhs: T) -> boolwhere WidgetId: PartialEq<T>,
source§fn identify(&self) -> IdentifyWidget
fn identify(&self) -> IdentifyWidget
source§fn is_ancestor_of(&self, id: &WidgetId) -> bool
fn is_ancestor_of(&self, id: &WidgetId) -> bool
id
is self or a descendant Read moresource§fn is_strict_ancestor_of(&self, id: &WidgetId) -> bool
fn is_strict_ancestor_of(&self, id: &WidgetId) -> bool
id
is not self and is a descendant Read more