pub struct Menu<'a, 'b, T, Message, Theme = Theme>where
'b: 'a,
Theme: Catalog,{ /* private fields */ }Expand description
A list of selectable options.
Implementations§
Source§impl<'a, 'b, T, Message, Theme> Menu<'a, 'b, T, Message, Theme>
impl<'a, 'b, T, Message, Theme> Menu<'a, 'b, T, Message, Theme>
Sourcepub fn new(
state: &'a mut State,
options: &'a [T],
hovered_option: &'a mut Option<usize>,
to_string: &'a dyn Fn(&T) -> String,
on_selected: impl FnMut(T) -> Message + 'a,
on_option_hovered: Option<&'a dyn Fn(T) -> Message>,
class: &'a <Theme as Catalog>::Class<'b>,
) -> Menu<'a, 'b, T, Message, Theme>
pub fn new( state: &'a mut State, options: &'a [T], hovered_option: &'a mut Option<usize>, to_string: &'a dyn Fn(&T) -> String, on_selected: impl FnMut(T) -> Message + 'a, on_option_hovered: Option<&'a dyn Fn(T) -> Message>, class: &'a <Theme as Catalog>::Class<'b>, ) -> Menu<'a, 'b, T, Message, Theme>
Sourcepub fn height(
self,
height: impl Into<Length>,
) -> Menu<'a, 'b, T, Message, Theme>
pub fn height( self, height: impl Into<Length>, ) -> Menu<'a, 'b, T, Message, Theme>
Sets the height of the Menu.
Sourcepub fn text_size(
self,
text_size: impl Into<Pixels>,
) -> Menu<'a, 'b, T, Message, Theme>
pub fn text_size( self, text_size: impl Into<Pixels>, ) -> Menu<'a, 'b, T, Message, Theme>
Sets the text size of the Menu.
Sourcepub fn line_height(
self,
line_height: impl Into<LineHeight>,
) -> Menu<'a, 'b, T, Message, Theme>
pub fn line_height( self, line_height: impl Into<LineHeight>, ) -> Menu<'a, 'b, T, Message, Theme>
Sets the text text::LineHeight of the Menu.
Sourcepub fn shaping(self, shaping: Shaping) -> Menu<'a, 'b, T, Message, Theme>
pub fn shaping(self, shaping: Shaping) -> Menu<'a, 'b, T, Message, Theme>
Sets the text::Shaping strategy of the Menu.
Sourcepub fn ellipsis(self, ellipsis: Ellipsis) -> Menu<'a, 'b, T, Message, Theme>
pub fn ellipsis(self, ellipsis: Ellipsis) -> Menu<'a, 'b, T, Message, Theme>
Sets the text::Ellipsis strategy of the Menu.
Sourcepub fn font(self, font: impl Into<Font>) -> Menu<'a, 'b, T, Message, Theme>
pub fn font(self, font: impl Into<Font>) -> Menu<'a, 'b, T, Message, Theme>
Sets the font of the Menu.
Sourcepub fn overlay<Renderer>(
self,
renderer: &Renderer,
position: Point,
window: Size,
target_height: f32,
) -> Element<'a, Message, Theme, Renderer>where
Renderer: Renderer + 'a,
pub fn overlay<Renderer>(
self,
renderer: &Renderer,
position: Point,
window: Size,
target_height: f32,
) -> Element<'a, Message, Theme, Renderer>where
Renderer: Renderer + 'a,
Turns the Menu into an overlay::Element at the given target
position.
position is the target’s position in screen coordinates, and
window is the size of the window.
The target_height will be used to display the menu either on top
of the target or under it, depending on the screen position and the
dimensions of the Menu.
Auto Trait Implementations§
impl<'a, 'b, T, Message, Theme> Freeze for Menu<'a, 'b, T, Message, Theme>
impl<'a, 'b, T, Message, Theme = Theme> !RefUnwindSafe for Menu<'a, 'b, T, Message, Theme>
impl<'a, 'b, T, Message, Theme = Theme> !Send for Menu<'a, 'b, T, Message, Theme>
impl<'a, 'b, T, Message, Theme = Theme> !Sync for Menu<'a, 'b, T, Message, Theme>
impl<'a, 'b, T, Message, Theme> Unpin for Menu<'a, 'b, T, Message, Theme>
impl<'a, 'b, T, Message, Theme> UnsafeUnpin for Menu<'a, 'b, T, Message, Theme>
impl<'a, 'b, T, Message, Theme = Theme> !UnwindSafe for Menu<'a, 'b, T, Message, Theme>
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
§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Convert
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can
then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Convert
Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be
further downcast into Rc<ConcreteType> where ConcreteType implements Trait.§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
Convert
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
Convert
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<State, Message> IntoBoot<State, Message> for State
impl<State, Message> IntoBoot<State, Message> for State
Source§fn into_boot(self) -> (State, Task<Message>)
fn into_boot(self) -> (State, Task<Message>)
Turns some type into the initial state of some
Application.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