[−][src]Struct native_windows_gui::MenuItem
A windows menu item. Can be added to a menubar or another menu.
Requires the menu
feature.
Builder parameters:
- text: The text of the menu item
- disabled: If the item can be selected by the user
- check: If the item should have a check mark next to it.
- parent: A top level window or a menu. With a top level window, the menu item is added to the menu bar.
Control events:
- OnMenuItemSelected: When a menu item is selected. This can be done by clicking or using the hot-key.
- OnMenuHover: When the user hovers the menu
Menu Access Keys
Just like Menus, menu items can have access keys. An access key is an underlined letter in the text of a menu item. When a menu is active, the user can select a menu item by pressing the key that corresponds to the item's underlined letter. The user makes the menu bar active by pressing the ALT key to highlight the first item on the menu bar. A menu is active when it is displayed.
To create an access key for a menu item, precede any character in the item's text string with an ampersand. For example, the text string "&Move" causes the system to underline the letter "M".
use native_windows_gui as nwg; fn menu_item(item: &mut nwg::MenuItem, menu: &nwg::Menu) -> Result<(), nwg::NwgError> { nwg::MenuItem::builder() .text("&Hello") .disabled(true) .parent(menu) .build(item) }
Fields
handle: ControlHandle
Implementations
impl MenuItem
[src]
pub fn builder<'a>() -> MenuItemBuilder<'a>
[src]
pub fn enabled(&self) -> bool
[src]
Return true if the control user can interact with the control, return false otherwise
pub fn set_enabled(&self, v: bool)
[src]
Enable or disable the control
pub fn set_checked(&self, check: bool)
[src]
Sets the check state of a menu item
pub fn checked(&self) -> bool
[src]
Returns the check state of a menu item
Trait Implementations
impl Debug for MenuItem
[src]
impl Default for MenuItem
[src]
impl Eq for MenuItem
[src]
impl<'_> From<&'_ MenuItem> for ControlHandle
[src]
impl PartialEq<ControlHandle> for MenuItem
[src]
fn eq(&self, other: &ControlHandle) -> bool
[src]
#[must_use]fn ne(&self, other: &Rhs) -> bool
1.0.0[src]
impl PartialEq<MenuItem> for MenuItem
[src]
impl PartialEq<MenuItem> for ControlHandle
[src]
impl StructuralEq for MenuItem
[src]
impl StructuralPartialEq for MenuItem
[src]
Auto Trait Implementations
impl RefUnwindSafe for MenuItem
impl !Send for MenuItem
impl !Sync for MenuItem
impl Unpin for MenuItem
impl UnwindSafe for MenuItem
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,