Toolbar

Struct Toolbar 

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

A toolbar with Buttons, Checkboxes and Choics.

As an extra it can collapse a number of buttons into a Choice if there is not enough space available.

Implementations§

Source§

impl<'a> Toolbar<'a>

Source

pub fn new() -> Self

Source

pub fn spacing(self, sp: u16) -> Self

Spacing between tools.

Source

pub fn collapsed_buttons(self, text: impl Into<Cow<'a, str>>) -> Self

Add a placeholder where the collapsed buttons will be rendered.

Source

pub fn button( self, key: impl Into<Cow<'a, str>>, text: impl Into<Cow<'a, str>>, collapsible: bool, ) -> Self

Add a button.

  • key - Hotkey text
  • text - Button text
  • collapsible - yes or no
Source

pub fn checkbox( self, key: impl Into<Cow<'a, str>>, text: impl Into<Cow<'a, str>>, checked: bool, ) -> Self

Add a checkbox.

  • key - hotkey
  • text - text
  • checked
Source

pub fn choice<V: Into<Line<'a>>>( self, key: impl Into<Cow<'a, str>>, items: impl IntoIterator<Item = V>, selected: usize, ) -> Self

Add a choice.

Source

pub fn text(self, text: impl Into<Line<'a>>) -> Self

Add some text to the toolbar.

Source

pub fn styles(self, styles: ToolbarStyle) -> Self

Set combined styles.

Source

pub fn style(self, style: Style) -> Self

Base style.

Source

pub fn block(self, block: Block<'a>) -> Self

Block for the main widget.

Source

pub fn key_style(self, style: Style) -> Self

Keyboard short-cut style.

Source

pub fn button_style(self, style: ButtonStyle) -> Self

Button style.

Source

pub fn checkbox_style(self, style: CheckboxStyle) -> Self

Checkbox style.

Source

pub fn choice_style(self, style: ChoiceStyle) -> Self

Choice style.

Source

pub fn collapsed_style(self, style: ChoiceStyle) -> Self

Collapsed style.

Source

pub fn into_widgets( self, area: Rect, state: &mut ToolbarState, ) -> (ToolbarWidget<'a>, ToolbarPopup<'a>)

Create the final widgets for rendering.

Trait Implementations§

Source§

impl<'a> Debug for Toolbar<'a>

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<'a> Default for Toolbar<'a>

Source§

fn default() -> Self

Returns the “default value” for a type. Read more

Auto Trait Implementations§

§

impl<'a> Freeze for Toolbar<'a>

§

impl<'a> RefUnwindSafe for Toolbar<'a>

§

impl<'a> Send for Toolbar<'a>

§

impl<'a> Sync for Toolbar<'a>

§

impl<'a> Unpin for Toolbar<'a>

§

impl<'a> UnwindSafe for Toolbar<'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> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

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

Source§

type Error = Infallible

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

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

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.