pub struct MenuItem {Show 13 fields
pub id: i32,
pub menu_type: MenuType,
pub label: Option<String>,
pub enabled: bool,
pub visible: bool,
pub icon_name: Option<String>,
pub icon_data: Option<Vec<u8>>,
pub shortcut: Option<Vec<Vec<String>>>,
pub toggle_type: ToggleType,
pub toggle_state: ToggleState,
pub children_display: Option<String>,
pub disposition: Disposition,
pub submenu: Vec<MenuItem>,
}
Expand description
Fields§
§id: i32
Unique numeric id
Either a standard menu item or a separator MenuType
label: Option<String>
Text of the item, except that:
- two consecutive underscore characters “__” are displayed as a single underscore,
- any remaining underscore characters are not displayed at all,
- the first of those remaining underscore characters (unless it is the last character in the string) indicates that the following character is the access key.
enabled: bool
Whether the item can be activated or not.
visible: bool
True if the item is visible in the menu.
icon_name: Option<String>
Icon name of the item, following the freedesktop.org icon spec.
icon_data: Option<Vec<u8>>
PNG data of the icon.
shortcut: Option<Vec<Vec<String>>>
The shortcut of the item. Each array represents the key press in the list of keypresses. Each list of strings contains a list of modifiers and then the key that is used. The modifier strings allowed are: “Control”, “Alt”, “Shift” and “Super”.
- A simple shortcut like Ctrl+S is represented as: [[“Control”, “S”]]
- A complex shortcut like Ctrl+Q, Alt+X is represented as: [[“Control”, “Q”], [“Alt”, “X”]]
toggle_type: ToggleType
How the menuitem feels the information it’s displaying to the
user should be presented.
See ToggleType
.
toggle_state: ToggleState
Describe the current state of a “togglable” item.
See ToggleState
.
§Note:
The implementation does not itself handle ensuring that only one item in a radio group is set to “on”, or that a group does not have “on” and “indeterminate” items simultaneously; maintaining this policy is up to the toolkit wrappers.
children_display: Option<String>
If the menu item has children this property should be set to “submenu”.
disposition: Disposition
How the menuitem feels the information it’s displaying to the
user should be presented.
See Disposition
Nested submenu items belonging to this item.