Combobox

Struct Combobox 

Source
pub struct Combobox<'a> { /* private fields */ }

Implementations§

Source§

impl<'a> Combobox<'a>

Source

pub fn new() -> Self

Source

pub fn items<V: Into<Line<'a>>>( self, items: impl IntoIterator<Item = (String, V)>, ) -> Self

Button text.

Source

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

Add an item.

Source

pub fn default_value(self, default: String) -> Self

Can return to default with user interaction.

Source

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

Combined styles.

Source

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

Base style.

Source

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

Style for the down button.

Source

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

Selection in the list.

Source

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

Focused style.

Source

pub fn text_style(self, style: TextStyle) -> Self

Textstyle

Source

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

Block for the main widget.

Source

pub fn popup_alignment(self, alignment: Alignment) -> Self

Alignment of the popup.

Default Default is Left.

Source

pub fn popup_placement(self, placement: Placement) -> Self

Placement of the popup.

Default Default is BelowOrAbove.

Source

pub fn popup_boundary(self, boundary: Rect) -> Self

Outer boundary for the popup.

Source

pub fn popup_len(self, len: u16) -> Self

Override the popup length.

Default Defaults to the number of items or 5.

Source

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

Base style for the popup.

Source

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

Block for the popup.

Source

pub fn popup_scroll(self, scroll: Scroll<'a>) -> Self

Scroll for the popup.

Source

pub fn popup_offset(self, offset: (i16, i16)) -> Self

Adds an extra offset to the widget area.

This can be used to

  • place the widget under the mouse cursor.
  • align the widget not by the outer bounds but by the text content.
Source

pub fn popup_x_offset(self, offset: i16) -> Self

Sets only the x offset. See offset

Source

pub fn popup_y_offset(self, offset: i16) -> Self

Sets only the y offset. See offset

Source

pub fn behave_focus(self, focus: ChoiceFocus) -> Self

Sets the behaviour for selecting from the list.

Source

pub fn behave_select(self, select: ChoiceSelect) -> Self

Sets the behaviour for selecting from the list.

Source

pub fn behave_close(self, close: ChoiceClose) -> Self

Sets the behaviour for closing the list.

Source

pub fn width(&self) -> u16

Inherent width.

Source

pub fn height(&self) -> u16

Inherent height.

Source

pub fn into_widgets(self) -> (ComboboxWidget<'a>, ComboboxPopup<'a>)

Choice itself doesn’t render.

This builds the widgets from the parameters set for Choice.

Trait Implementations§

Source§

impl<'a> Debug for Combobox<'a>

Source§

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

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

impl Default for Combobox<'_>

Source§

fn default() -> Self

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

Auto Trait Implementations§

§

impl<'a> !Freeze for Combobox<'a>

§

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

§

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

§

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

§

impl<'a> Unpin for Combobox<'a>

§

impl<'a> !UnwindSafe for Combobox<'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.