Struct kas_widgets::TextButton [−][src]
pub struct TextButton<M: 'static> { /* fields omitted */ }
Expand description
A push-button with a text label
This is a specialised variant of Button
supporting key shortcuts from an
AccelString
label and using a custom text class (and thus theme colour).
Default alignment of the button is to stretch horizontally and centre vertically. The text label is always centred (irrespective of alignment parameters).
Implementations
Construct a button with given label
Set event handler f
On activation (through user input events or Event::Activate
) the
closure f
is called. The result of f
is converted to
Response::Msg
or Response::None
and returned to the parent.
Construct a button with a given label
and event handler f
On activation (through user input events or Event::Activate
) the
closure f
is called. The result of f
is converted to
Response::Msg
or Response::None
and returned to the parent.
Construct a button with a given label
and payload msg
On activation (through user input events or Event::Activate
) a clone
of msg
is returned to the parent widget. Click actions must be
implemented through a handler on the parent widget (or other ancestor).
Add accelerator keys (chain style)
These keys are added to those inferred from the label via &
marks.
Set button color (chain style)
Trait Implementations
Set accel string
Get the number of child widgets
Get a reference to a child widget by index, or None
if the index is
out of bounds. Read more
Mutable variant of get Read more
Record first identifier Read more
Check whether id
is a descendant Read more
Find the child which is an ancestor of this id
, if any Read more
Find the leaf (lowest descendant) with this id
, if any Read more
Find the leaf (lowest descendant) with this id
, if any Read more
Walk through all widgets, calling f
once on each. Read more
Walk through all widgets, calling f
once on each. Read more
Get self as type Any
(mutable)
Get the name of the widget struct
Erase type
Erase type
Get whether the widget is disabled
Set the disabled state of a widget Read more
Set disabled state (chaining) Read more
Construct InputState
Read more
Auto Trait Implementations
impl<M> !RefUnwindSafe for TextButton<M>
impl<M> !Send for TextButton<M>
impl<M> !Sync for TextButton<M>
impl<M> Unpin for TextButton<M>
impl<M> !UnwindSafe for TextButton<M>
Blanket Implementations
Mutably borrows from an owned value. Read more
pub fn cast_trunc(self) -> T
pub fn cast_trunc(self) -> T
Cast to integer, truncating Read more
pub fn cast_nearest(self) -> T
pub fn cast_nearest(self) -> T
Cast to the nearest integer Read more
pub fn cast_floor(self) -> T
pub fn cast_floor(self) -> T
Cast the floor to an integer Read more
pub fn try_cast_trunc(self) -> Result<T, Error>
pub fn try_cast_trunc(self) -> Result<T, Error>
Try converting to integer with truncation Read more
pub fn try_cast_nearest(self) -> Result<T, Error>
pub fn try_cast_nearest(self) -> Result<T, Error>
Try converting to the nearest integer Read more
pub fn try_cast_floor(self) -> Result<T, Error>
pub fn try_cast_floor(self) -> Result<T, Error>
Try converting the floor to an integer Read more
pub fn try_cast_ceil(self) -> Result<T, Error>
pub fn try_cast_ceil(self) -> Result<T, Error>
Try convert the ceiling to an integer Read more