Skip to main content

Button

Struct Button 

Source
pub struct Button<A: UiAction> { /* private fields */ }
Expand description

A button being configured. Add it to a parent view, which builds it.

Implementations§

Source§

impl<A: UiAction> Button<A>

Source

pub fn fill(self, face: Color) -> Self

Face colour. Defaults to the palette’s cream.

Source

pub fn text_fill(self, fill: Color) -> Self

Caption colour. Defaults to the palette’s ink.

Source

pub fn disabled(self, disabled: bool) -> Self

A disabled button keeps its place but takes neither pointer nor keyboard activation.

Source

pub fn group(self, group: GroupId) -> Self

Put this control in a focus group, so traversal cannot leave the panel it belongs to.

Source

pub fn keyed(self, key: impl Into<String>) -> Self

Identify this control to focus memory.

The default identity is the caption (or the glyph), which is unique inside a panel in every template game. Two controls that share a caption inside one composition scope — two “OK” buttons in one dialog — must be given distinct keys, or they share one remembered focus target.

Source

pub fn view(self) -> View

Build the view.

Trait Implementations§

Auto Trait Implementations§

§

impl<A> !RefUnwindSafe for Button<A>

§

impl<A> !Send for Button<A>

§

impl<A> !Sync for Button<A>

§

impl<A> !UnwindSafe for Button<A>

§

impl<A> Freeze for Button<A>
where Kit<A>: Freeze, A: Freeze,

§

impl<A> Unpin for Button<A>
where Kit<A>: Unpin, A: Unpin,

§

impl<A> UnsafeUnpin for Button<A>
where Kit<A>: UnsafeUnpin, A: UnsafeUnpin,

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> Downcast for T
where T: Any,

Source§

fn into_any(self: Box<T>) -> Box<dyn Any>

Converts Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>, which can then be downcast into Box<dyn ConcreteType> where ConcreteType implements Trait.
Source§

fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>

Converts Rc<Trait> (where Trait: Downcast) to Rc<Any>, which can then be further downcast into Rc<ConcreteType> where ConcreteType implements Trait.
Source§

fn as_any(&self) -> &(dyn Any + 'static)

Converts &Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot generate &Any’s vtable from &Trait’s.
Source§

fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)

Converts &mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot generate &mut Any’s vtable from &mut Trait’s.
Source§

impl<T> ErasedDestructor for T
where T: 'static,

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoResult<T> for T

Source§

fn into_result(self) -> Result<T, RunSystemError>

Converts this type into the system output type.
Source§

impl<A> Is for A
where A: Any,

Source§

fn is<T>() -> bool
where T: Any,

Checks if the current type “is” another type, using a TypeId equality comparison. This is most useful in the context of generic logic. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.