Skip to main content

ButtonBuilder

Struct ButtonBuilder 

Source
pub struct ButtonBuilder<'a> { /* private fields */ }
Expand description

Chainable button. Terminal call is ButtonBuilder::build.

Implementations§

Source§

impl<'a> ButtonBuilder<'a>

Source

pub fn build_response<'c, C: ContentCx<'c>>(self, cx: &mut C) -> Response

build, then report like the other kit pieces.

Source§

impl<'a> ButtonBuilder<'a>

Source

pub fn text(self, t: &'a str) -> Self

Label.

Source

pub fn icon(self, i: &'a IconId) -> Self

Icon drawn left of the label.

Source

pub fn active(self, on: bool) -> Self

Drawn as active (accent fill) when not hovered or pressed.

Source

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

Disabled colours; clicks are ignored.

Source

pub fn active_border(self, b: Option<bool>) -> Self

Per-instance active-border override.

Source

pub fn hover_chevron(self, c: HoverChevronSpec) -> Self

Hover-revealed trailing chevron.

Source

pub fn settings(self, s: ButtonSettings) -> Self

Full settings. Wins over the token-derived default.

Source

pub fn on_click(self, f: impl FnOnce() + 'a) -> Self

Invoked when this id was clicked and the button is not disabled.

Source

pub fn bind_count(self, n: &'a mut u32) -> Self

Incremented on each click (ignored when disabled).

Source

pub fn build<'c, C: ContentCx<'c>>(self, cx: &mut C)

Register and draw into cx.

Auto Trait Implementations§

§

impl<'a> !RefUnwindSafe for ButtonBuilder<'a>

§

impl<'a> !Send for ButtonBuilder<'a>

§

impl<'a> !Sync for ButtonBuilder<'a>

§

impl<'a> !UnwindSafe for ButtonBuilder<'a>

§

impl<'a> Forget for ButtonBuilder<'a>

§

impl<'a> Freeze for ButtonBuilder<'a>

§

impl<'a> Move for ButtonBuilder<'a>

§

impl<'a> Unpin for ButtonBuilder<'a>

§

impl<'a> UnsafeUnpin for ButtonBuilder<'a>

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> 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, 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.