#[repr(C)]pub struct Menu {
pub items: MenuItemVec,
pub position: MenuPopupPosition,
pub context_mouse_btn: ContextMenuMouseButton,
}Expand description
Represents a menu (context menu, dropdown menu, or application menu).
A menu consists of a list of items that can be displayed as a popup or attached to a window’s menu bar. Modeled after the Windows API for cross-platform consistency.
§Fields
items- The menu items to displayposition- Where the menu should appear (for popups)context_mouse_btn- Which mouse button triggers the context menu
Fields§
§items: MenuItemVec§position: MenuPopupPosition§context_mouse_btn: ContextMenuMouseButtonImplementations§
Source§impl Menu
impl Menu
Sourcepub fn create(items: MenuItemVec) -> Self
pub fn create(items: MenuItemVec) -> Self
Creates a new menu with the given items.
Uses default position (AutoCursor) and right mouse button for context menus.
Sourcepub fn with_position(self, position: MenuPopupPosition) -> Self
pub fn with_position(self, position: MenuPopupPosition) -> Self
Builder method to set the popup position.
Trait Implementations§
Source§impl Ord for Menu
impl Ord for Menu
1.21.0 (const: unstable) · Source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
Compares and returns the maximum of two values. Read more
Source§impl PartialOrd for Menu
impl PartialOrd for Menu
impl Eq for Menu
impl StructuralPartialEq for Menu
Auto Trait Implementations§
impl Freeze for Menu
impl RefUnwindSafe for Menu
impl Send for Menu
impl Sync for Menu
impl Unpin for Menu
impl UnsafeUnpin 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