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>
impl<'a> Toolbar<'a>
pub fn new() -> Self
Add a placeholder where the collapsed buttons will be rendered.
Add a button.
- key - Hotkey text
- text - Button text
- collapsible - yes or no
Sourcepub fn checkbox(
self,
key: impl Into<Cow<'a, str>>,
text: impl Into<Cow<'a, str>>,
checked: bool,
) -> Self
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
Sourcepub fn choice<V: Into<Line<'a>>>(
self,
key: impl Into<Cow<'a, str>>,
items: impl IntoIterator<Item = V>,
selected: usize,
) -> Self
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.
Sourcepub fn styles(self, styles: ToolbarStyle) -> Self
pub fn styles(self, styles: ToolbarStyle) -> Self
Set combined styles.
Button style.
Sourcepub fn checkbox_style(self, style: CheckboxStyle) -> Self
pub fn checkbox_style(self, style: CheckboxStyle) -> Self
Checkbox style.
Sourcepub fn choice_style(self, style: ChoiceStyle) -> Self
pub fn choice_style(self, style: ChoiceStyle) -> Self
Choice style.
Sourcepub fn collapsed_style(self, style: ChoiceStyle) -> Self
pub fn collapsed_style(self, style: ChoiceStyle) -> Self
Collapsed style.
Sourcepub fn into_widgets(
self,
area: Rect,
state: &mut ToolbarState,
) -> (ToolbarWidget<'a>, ToolbarPopup<'a>)
pub fn into_widgets( self, area: Rect, state: &mut ToolbarState, ) -> (ToolbarWidget<'a>, ToolbarPopup<'a>)
Create the final widgets for rendering.
Trait Implementations§
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> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
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 moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
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