pub struct Submenu { /* private fields */ }Implementations§
sourcepub fn new<S: AsRef<str>>(text: S, enabled: bool) -> Self
pub fn new<S: AsRef<str>>(text: S, enabled: bool) -> Self
Create a new submenu.
textcould optionally contain an&before a character to assign this character as the mnemonic for this submenu. To display a&without assigning a mnemenonic, use&&.
sourcepub fn with_id<I: Into<MenuId>, S: AsRef<str>>(
id: I,
text: S,
enabled: bool
) -> Self
pub fn with_id<I: Into<MenuId>, S: AsRef<str>>( id: I, text: S, enabled: bool ) -> Self
Create a new submenu with the specified id.
textcould optionally contain an&before a character to assign this character as the mnemonic for this submenu. To display a&without assigning a mnemenonic, use&&.
sourcepub fn with_items<S: AsRef<str>>(
text: S,
enabled: bool,
items: &[&dyn IsMenuItem]
) -> Result<Self>
pub fn with_items<S: AsRef<str>>( text: S, enabled: bool, items: &[&dyn IsMenuItem] ) -> Result<Self>
Creates a new submenu with given items. It calls Submenu::new and Submenu::append_items internally.
sourcepub fn with_id_and_items<I: Into<MenuId>, S: AsRef<str>>(
id: I,
text: S,
enabled: bool,
items: &[&dyn IsMenuItem]
) -> Result<Self>
pub fn with_id_and_items<I: Into<MenuId>, S: AsRef<str>>( id: I, text: S, enabled: bool, items: &[&dyn IsMenuItem] ) -> Result<Self>
Creates a new submenu with the specified id and given items. It calls Submenu::new and Submenu::append_items internally.
sourcepub fn append(&self, item: &dyn IsMenuItem) -> Result<()>
pub fn append(&self, item: &dyn IsMenuItem) -> Result<()>
Add a menu item to the end of this menu.
sourcepub fn append_items(&self, items: &[&dyn IsMenuItem]) -> Result<()>
pub fn append_items(&self, items: &[&dyn IsMenuItem]) -> Result<()>
Add menu items to the end of this submenu. It calls Submenu::append in a loop.
sourcepub fn prepend(&self, item: &dyn IsMenuItem) -> Result<()>
pub fn prepend(&self, item: &dyn IsMenuItem) -> Result<()>
Add a menu item to the beginning of this submenu.
sourcepub fn prepend_items(&self, items: &[&dyn IsMenuItem]) -> Result<()>
pub fn prepend_items(&self, items: &[&dyn IsMenuItem]) -> Result<()>
Add menu items to the beginning of this submenu.
It calls Menu::prepend on the first element and
passes the rest to Menu::insert_items with position of 1.
sourcepub fn insert(&self, item: &dyn IsMenuItem, position: usize) -> Result<()>
pub fn insert(&self, item: &dyn IsMenuItem, position: usize) -> Result<()>
Insert a menu item at the specified postion in the submenu.
sourcepub fn insert_items(
&self,
items: &[&dyn IsMenuItem],
position: usize
) -> Result<()>
pub fn insert_items( &self, items: &[&dyn IsMenuItem], position: usize ) -> Result<()>
Insert menu items at the specified postion in the submenu.
sourcepub fn remove(&self, item: &dyn IsMenuItem) -> Result<()>
pub fn remove(&self, item: &dyn IsMenuItem) -> Result<()>
Remove a menu item from this submenu.
sourcepub fn remove_at(&self, position: usize) -> Option<MenuItemKind>
pub fn remove_at(&self, position: usize) -> Option<MenuItemKind>
Remove the menu item at the specified position from this submenu and returns it.
sourcepub fn items(&self) -> Vec<MenuItemKind>
pub fn items(&self) -> Vec<MenuItemKind>
Returns a list of menu items that has been added to this submenu.
sourcepub fn set_text<S: AsRef<str>>(&self, text: S)
pub fn set_text<S: AsRef<str>>(&self, text: S)
Set the text for this submenu. text could optionally contain
an & before a character to assign this character as the mnemonic
for this submenu. To display a & without assigning a mnemenonic, use &&.
sourcepub fn is_enabled(&self) -> bool
pub fn is_enabled(&self) -> bool
Get whether this submenu is enabled or not.
sourcepub fn set_enabled(&self, enabled: bool)
pub fn set_enabled(&self, enabled: bool)
Enable or disable this submenu.
Trait Implementations§
gtk::Window Read more