pub struct Submenu { /* private fields */ }
Implementations§
Sourcepub fn new<S>(text: S, enabled: bool) -> Submenu
pub fn new<S>(text: S, enabled: bool) -> Submenu
Create a new 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 with_id<I, S>(id: I, text: S, enabled: bool) -> Submenu
pub fn with_id<I, S>(id: I, text: S, enabled: bool) -> Submenu
Create a new submenu with the specified id.
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 with_items<S>(
text: S,
enabled: bool,
items: &[&dyn IsMenuItem],
) -> Result<Submenu, Error>
pub fn with_items<S>( text: S, enabled: bool, items: &[&dyn IsMenuItem], ) -> Result<Submenu, Error>
Creates a new submenu with given items
. It calls Submenu::new
and Submenu::append_items
internally.
Sourcepub fn with_id_and_items<I, S>(
id: I,
text: S,
enabled: bool,
items: &[&dyn IsMenuItem],
) -> Result<Submenu, Error>
pub fn with_id_and_items<I, S>( id: I, text: S, enabled: bool, items: &[&dyn IsMenuItem], ) -> Result<Submenu, Error>
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<(), Error>
pub fn append(&self, item: &dyn IsMenuItem) -> Result<(), Error>
Add a menu item to the end of this menu.
Sourcepub fn append_items(&self, items: &[&dyn IsMenuItem]) -> Result<(), Error>
pub fn append_items(&self, items: &[&dyn IsMenuItem]) -> Result<(), Error>
Add menu items to the end of this submenu. It calls Submenu::append
in a loop.
Sourcepub fn prepend(&self, item: &dyn IsMenuItem) -> Result<(), Error>
pub fn prepend(&self, item: &dyn IsMenuItem) -> Result<(), Error>
Add a menu item to the beginning of this submenu.
Sourcepub fn prepend_items(&self, items: &[&dyn IsMenuItem]) -> Result<(), Error>
pub fn prepend_items(&self, items: &[&dyn IsMenuItem]) -> Result<(), Error>
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<(), Error>
pub fn insert( &self, item: &dyn IsMenuItem, position: usize, ) -> Result<(), Error>
Insert a menu item at the specified postion
in the submenu.
Sourcepub fn insert_items(
&self,
items: &[&dyn IsMenuItem],
position: usize,
) -> Result<(), Error>
pub fn insert_items( &self, items: &[&dyn IsMenuItem], position: usize, ) -> Result<(), Error>
Insert menu items at the specified postion
in the submenu.
Sourcepub fn remove(&self, item: &dyn IsMenuItem) -> Result<(), Error>
pub fn remove(&self, item: &dyn IsMenuItem) -> Result<(), Error>
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>(&self, text: S)
pub fn set_text<S>(&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