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

Set button color (chain style)

Trait Implementations

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

Formats the value using the given formatter. Read more

Type of message returned by this widget Read more

Generic handler: translate presses to activations Read more

Handle an event and return a user-defined message Read more

Generic handler: focus rect on key navigation Read more

Get text by reference

Get text as a String

Get size rules for the given axis Read more

Apply a given rect to self Read more

Draw a widget and its children Read more

Get translation of a child Read more

Navigation in spatial order Read more

Find a widget by coordinate Read more

Send an event Read more

Set accel string

Set text Read more

Get the first identifier of self or any children Read more

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

Configure widget Read more

Is this widget navigable via Tab key? Read more

Does this widget have hover-state highlighting? Read more

Configure self and children Read more

Which cursor icon should be used on hover? Read more

Get self as type Any

Get self as type Any (mutable)

Get direct access to the CoreData providing property storage.

Get the name of the widget struct

Erase type

Erase type

Get the widget’s numeric identifier

Get whether the widget is disabled

Set the disabled state of a widget Read more

Set disabled state (chaining) Read more

Get the widget’s region, relative to its parent.

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Cast from Self to T

Try converting from Self to T

Cast to integer, truncating Read more

Cast to the nearest integer Read more

Cast the floor to an integer Read more

Cast the ceiling to an integer Read more

Try converting to integer with truncation Read more

Try converting to the nearest integer Read more

Try converting the floor to an integer Read more

Try convert the ceiling to an integer Read more

Convert from T to Self

Try converting from T to Self

Returns true if the given item matches this filter

Performs the conversion.

Performs the conversion.

The alignment of pointer.

The type for initializers.

Initializes a with the given initializer. Read more

Dereferences the given pointer. Read more

Mutably dereferences the given pointer. Read more

Drops the object pointed to by the given pointer. Read more

The resulting type after obtaining ownership.

Creates owned data from borrowed data, usually by cloning. Read more

🔬 This is a nightly-only experimental API. (toowned_clone_into)

recently added

Uses borrowed data to replace owned data, usually by cloning. Read more

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.