pub struct Menu {
pub items: Vec<MenuItem>,
pub open: bool,
pub trigger: MenuTrigger,
pub width: f32,
pub background_color: Color,
pub hover_color: Color,
pub text_color: Color,
pub disabled_color: Color,
/* private fields */
}Expand description
Menu widget for dropdown actions.
Fields§
§items: Vec<MenuItem>Menu items
open: boolWhether menu is open
trigger: MenuTriggerTrigger mode
width: f32Menu width
background_color: ColorBackground color
hover_color: ColorHover color
text_color: ColorText color
disabled_color: ColorDisabled text color
Implementations§
Source§impl Menu
impl Menu
Sourcepub const fn trigger(self, trigger: MenuTrigger) -> Self
pub const fn trigger(self, trigger: MenuTrigger) -> Self
Set trigger mode.
Sourcepub const fn background_color(self, color: Color) -> Self
pub const fn background_color(self, color: Color) -> Self
Set background color.
Sourcepub const fn hover_color(self, color: Color) -> Self
pub const fn hover_color(self, color: Color) -> Self
Set hover color.
Sourcepub const fn text_color(self, color: Color) -> Self
pub const fn text_color(self, color: Color) -> Self
Set text color.
Sourcepub fn trigger_widget(self, widget: impl Widget + 'static) -> Self
pub fn trigger_widget(self, widget: impl Widget + 'static) -> Self
Set the trigger widget.
Sourcepub fn with_test_id(self, id: impl Into<String>) -> Self
pub fn with_test_id(self, id: impl Into<String>) -> Self
Set test ID.
Sourcepub const fn highlighted_index(&self) -> Option<usize>
pub const fn highlighted_index(&self) -> Option<usize>
Get highlighted index.
Trait Implementations§
Source§impl<'de> Deserialize<'de> for Menu
impl<'de> Deserialize<'de> for Menu
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl Widget for Menu
impl Widget for Menu
Source§fn measure(&self, constraints: Constraints) -> Size
fn measure(&self, constraints: Constraints) -> Size
Compute intrinsic size constraints. Read more
Source§fn layout(&mut self, bounds: Rect) -> LayoutResult
fn layout(&mut self, bounds: Rect) -> LayoutResult
Position children within allocated bounds. Read more
Source§fn event(&mut self, event: &Event) -> Option<Box<dyn Any + Send>>
fn event(&mut self, event: &Event) -> Option<Box<dyn Any + Send>>
Handle input events. Read more
Source§fn children_mut(&mut self) -> &mut [Box<dyn Widget>]
fn children_mut(&mut self) -> &mut [Box<dyn Widget>]
Get mutable child widgets.
Source§fn is_focusable(&self) -> bool
fn is_focusable(&self) -> bool
Check if this widget can receive keyboard focus.
Source§fn is_interactive(&self) -> bool
fn is_interactive(&self) -> bool
Check if this widget is interactive (can receive focus/events).
Source§fn accessible_name(&self) -> Option<&str>
fn accessible_name(&self) -> Option<&str>
Get the accessible name for screen readers.
Source§fn accessible_role(&self) -> AccessibleRole
fn accessible_role(&self) -> AccessibleRole
Get the accessible role.
Auto Trait Implementations§
impl Freeze for Menu
impl !RefUnwindSafe for Menu
impl Send for Menu
impl Sync for Menu
impl Unpin for Menu
impl !UnwindSafe for Menu
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