rat_widget::menu

Struct PopupMenu

source
pub struct PopupMenu<'a> { /* private fields */ }
Expand description

Popup menu.

Implementations§

source§

impl<'a> PopupMenu<'a>

source

pub fn new() -> PopupMenu<'a>

New, empty.

source

pub fn item(self, item: MenuItem<'a>) -> PopupMenu<'a>

Add an item.

source

pub fn item_parsed(self, text: &'a str) -> PopupMenu<'a>

Parse the text.

See

MenuItem::new_parsed

source

pub fn item_str(self, txt: &'a str) -> PopupMenu<'a>

Add a text-item.

source

pub fn item_string(self, txt: String) -> PopupMenu<'a>

Add an owned text as item.

source

pub fn separator(self, separator: Separator) -> PopupMenu<'a>

Sets the separator for the last item added. If there is none adds this as an empty menu-item.

source

pub fn width(self, width: u16) -> PopupMenu<'a>

Fixed width for the menu. If not set it uses 1.5 times the length of the longest item.

source

pub fn width_opt(self, width: Option<u16>) -> PopupMenu<'a>

Fixed width for the menu. If not set it uses 1.5 times the length of the longest item.

source

pub fn constraint(self, placement: PopupConstraint) -> PopupMenu<'a>

Set relative placement.

source

pub fn offset(self, offset: (i16, i16)) -> PopupMenu<'a>

Adds an extra offset.

source

pub fn x_offset(self, offset: i16) -> PopupMenu<'a>

Adds an extra x offset.

source

pub fn y_offset(self, offset: i16) -> PopupMenu<'a>

Adds an extra y offset.

source

pub fn boundary(self, boundary: Rect) -> PopupMenu<'a>

Set outer bounds for the popup-menu. If not set, the Buffer::area is used as outer bounds.

source

pub fn styles(self, styles: MenuStyle) -> PopupMenu<'a>

Set a style-set.

source

pub fn style(self, style: Style) -> PopupMenu<'a>

Base style.

source

pub fn highlight_style(self, style: Style) -> PopupMenu<'a>

Highlight style.

source

pub fn highlight_style_opt(self, style: Option<Style>) -> PopupMenu<'a>

Highlight style.

source

pub fn disabled_style(self, style: Style) -> PopupMenu<'a>

Disabled item style.

source

pub fn disabled_style_opt(self, style: Option<Style>) -> PopupMenu<'a>

Disabled item style.

source

pub fn right_style(self, style: Style) -> PopupMenu<'a>

Style for the hotkey.

source

pub fn right_style_opt(self, style: Option<Style>) -> PopupMenu<'a>

Style for the hotkey.

source

pub fn focus_style(self, style: Style) -> PopupMenu<'a>

Focus/Selection style.

source

pub fn focus_style_opt(self, style: Option<Style>) -> PopupMenu<'a>

Focus/Selection style.

source

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

Block for borders.

source

pub fn block_opt(self, block: Option<Block<'a>>) -> PopupMenu<'a>

Block for borders.

source

pub fn get_block_size(&self) -> Size

Get the padding the block imposes as a Size.

Trait Implementations§

source§

impl<'a> Clone for PopupMenu<'a>

source§

fn clone(&self) -> PopupMenu<'a>

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl<'a> Debug for PopupMenu<'a>

source§

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

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

impl<'a> Default for PopupMenu<'a>

source§

fn default() -> PopupMenu<'a>

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

impl<'a> StatefulWidget for PopupMenu<'a>

source§

type State = PopupMenuState

State associated with the stateful widget. Read more
source§

fn render( self, _area: Rect, buf: &mut Buffer, state: &mut <PopupMenu<'a> as StatefulWidget>::State, )

Draws the current state of the widget in the given buffer. That is the only method required to implement a custom stateful widget.

Auto Trait Implementations§

§

impl<'a> Freeze for PopupMenu<'a>

§

impl<'a> RefUnwindSafe for PopupMenu<'a>

§

impl<'a> Send for PopupMenu<'a>

§

impl<'a> Sync for PopupMenu<'a>

§

impl<'a> Unpin for PopupMenu<'a>

§

impl<'a> UnwindSafe for PopupMenu<'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> CloneToUninit for T
where T: Clone,

source§

unsafe fn clone_to_uninit(&self, dst: *mut T)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dst. Read more
source§

impl<T> DynClone for T
where T: Clone,

source§

fn __clone_box(&self, _: Private) -> *mut ()

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> ToOwned for T
where T: Clone,

source§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. 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.