Skip to main content

GtkMenuItemExt

Trait GtkMenuItemExt 

Source
pub trait GtkMenuItemExt:
    IsA<MenuItem>
    + Sealed
    + 'static {
Show 27 methods // Provided methods fn deselect(&self) { ... } fn accel_path(&self) -> Option<GString> { ... } fn label(&self) -> Option<GString> { ... } fn must_reserve_indicator(&self) -> bool { ... } fn submenu(&self) -> Option<Widget> { ... } fn uses_underline(&self) -> bool { ... } fn select(&self) { ... } fn set_accel_path(&self, accel_path: Option<&str>) { ... } fn set_label(&self, label: &str) { ... } fn set_reserve_indicator(&self, reserve: bool) { ... } fn set_submenu(&self, submenu: Option<&impl IsA<Menu>>) { ... } fn set_use_underline(&self, setting: bool) { ... } fn toggle_size_allocate(&self, allocation: i32) { ... } fn toggle_size_request(&self, requisition: &mut i32) { ... } fn is_right_justified(&self) -> bool { ... } fn set_right_justified(&self, right_justified: bool) { ... } fn connect_activate<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId { ... } fn emit_activate(&self) { ... } fn connect_activate_item<F: Fn(&Self) + 'static>( &self, f: F, ) -> SignalHandlerId { ... } fn connect_deselect<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId { ... } fn connect_select<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId { ... } fn connect_toggle_size_allocate<F: Fn(&Self, i32) + 'static>( &self, f: F, ) -> SignalHandlerId { ... } fn connect_accel_path_notify<F: Fn(&Self) + 'static>( &self, f: F, ) -> SignalHandlerId { ... } fn connect_label_notify<F: Fn(&Self) + 'static>( &self, f: F, ) -> SignalHandlerId { ... } fn connect_right_justified_notify<F: Fn(&Self) + 'static>( &self, f: F, ) -> SignalHandlerId { ... } fn connect_submenu_notify<F: Fn(&Self) + 'static>( &self, f: F, ) -> SignalHandlerId { ... } fn connect_use_underline_notify<F: Fn(&Self) + 'static>( &self, f: F, ) -> SignalHandlerId { ... }
}
Expand description

Trait containing all MenuItem methods.

§Implementors

CheckMenuItem, MenuItem, SeparatorMenuItem

Provided Methods§

Source

fn deselect(&self)

Emits the deselect signal on the given item.

Source

fn accel_path(&self) -> Option<GString>

Retrieve the accelerator path that was previously set on self.

See set_accel_path() for details.

§Returns

the accelerator path corresponding to this menu item’s functionality, or None if not set

Source

fn label(&self) -> Option<GString>

Sets text on the self label

§Returns

The text in the self label. This is the internal string used by the label, and must not be modified.

Source

fn must_reserve_indicator(&self) -> bool

Returns whether the self reserves space for the submenu indicator, regardless if it has a submenu or not.

§Returns

true if self always reserves space for the submenu indicator

Source

fn submenu(&self) -> Option<Widget>

Gets the submenu underneath this menu item, if any. See set_submenu().

§Returns

submenu for this menu item, or None if none

Source

fn uses_underline(&self) -> bool

Checks if an underline in the text indicates the next character should be used for the mnemonic accelerator key.

§Returns

true if an embedded underline in the label indicates the mnemonic accelerator key.

Source

fn select(&self)

Emits the select signal on the given item.

Source

fn set_accel_path(&self, accel_path: Option<&str>)

Set the accelerator path on self, through which runtime changes of the menu item’s accelerator caused by the user can be identified and saved to persistent storage (see gtk_accel_map_save() on this). To set up a default accelerator for this menu item, call gtk_accel_map_add_entry() with the same accel_path. See also gtk_accel_map_add_entry() on the specifics of accelerator paths, and GtkMenuExt::set_accel_path() for a more convenient variant of this function.

This function is basically a convenience wrapper that handles calling WidgetExt::set_accel_path() with the appropriate accelerator group for the menu item.

Note that you do need to set an accelerator on the parent menu with GtkMenuExt::set_accel_group() for this to work.

Note that accel_path string will be stored in a GQuark. Therefore, if you pass a static string, you can save some memory by interning it first with g_intern_static_string().

§accel_path

accelerator path, corresponding to this menu item’s functionality, or None to unset the current path.

Source

fn set_label(&self, label: &str)

Sets text on the self label

§label

the text you want to set

Source

fn set_reserve_indicator(&self, reserve: bool)

Sets whether the self should reserve space for the submenu indicator, regardless if it actually has a submenu or not.

There should be little need for applications to call this functions.

§reserve

the new value

Source

fn set_submenu(&self, submenu: Option<&impl IsA<Menu>>)

Sets or replaces the menu item’s submenu, or removes it when a None submenu is passed.

the submenu, or None

Source

fn set_use_underline(&self, setting: bool)

If true, an underline in the text indicates the next character should be used for the mnemonic accelerator key.

§setting

true if underlines in the text indicate mnemonics

Source

fn toggle_size_allocate(&self, allocation: i32)

Emits the toggle-size-allocate signal on the given item.

§allocation

the allocation to use as signal data.

Source

fn toggle_size_request(&self, requisition: &mut i32)

Emits the toggle-size-request signal on the given item.

§requisition

the requisition to use as signal data.

Source

fn is_right_justified(&self) -> bool

Sets whether the menu item appears justified at the right side of a menu bar.

Source

fn set_right_justified(&self, right_justified: bool)

Sets whether the menu item appears justified at the right side of a menu bar.

Source

fn connect_activate<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId

Emitted when the item is activated.

Source

fn emit_activate(&self)

Source

fn connect_activate_item<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId

Emitted when the item is activated, but also if the menu item has a submenu. For normal applications, the relevant signal is activate.

Source

fn connect_deselect<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId

Source

fn connect_select<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId

Source

fn connect_toggle_size_allocate<F: Fn(&Self, i32) + 'static>( &self, f: F, ) -> SignalHandlerId

Source

fn connect_accel_path_notify<F: Fn(&Self) + 'static>( &self, f: F, ) -> SignalHandlerId

Source

fn connect_label_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId

Source

fn connect_right_justified_notify<F: Fn(&Self) + 'static>( &self, f: F, ) -> SignalHandlerId

Source

fn connect_submenu_notify<F: Fn(&Self) + 'static>( &self, f: F, ) -> SignalHandlerId

Source

fn connect_use_underline_notify<F: Fn(&Self) + 'static>( &self, f: F, ) -> SignalHandlerId

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§