Trait gtk::prelude::GtkMenuItemExt
source · [−]pub trait GtkMenuItemExt: 'static {
Show 27 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
Required Methods
fn accel_path(&self) -> Option<GString>
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
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.
fn must_reserve_indicator(&self) -> bool
fn must_reserve_indicator(&self) -> bool
Gets the submenu underneath this menu item, if any.
See set_submenu()
.
Returns
submenu for this menu item, or None
if none
fn uses_underline(&self) -> bool
fn uses_underline(&self) -> bool
fn set_accel_path(&self, accel_path: Option<&str>)
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.
fn set_reserve_indicator(&self, reserve: bool)
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
fn set_use_underline(&self, setting: bool)
fn set_use_underline(&self, setting: bool)
fn toggle_size_allocate(&self, allocation: i32)
fn toggle_size_allocate(&self, allocation: i32)
Emits the signal::MenuItem::toggle-size-allocate
signal on the given item.
allocation
the allocation to use as signal data.
fn toggle_size_request(&self, requisition: &mut i32)
fn toggle_size_request(&self, requisition: &mut i32)
Emits the signal::MenuItem::toggle-size-request
signal on the given item.
requisition
the requisition to use as signal data.
fn is_right_justified(&self) -> bool
fn is_right_justified(&self) -> bool
Sets whether the menu item appears justified at the right side of a menu bar.
fn set_right_justified(&self, right_justified: bool)
fn set_right_justified(&self, right_justified: bool)
Sets whether the menu item appears justified at the right side of a menu bar.
fn connect_activate<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId
fn connect_activate<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId
Emitted when the item is activated.
fn emit_activate(&self)
fn connect_activate_item<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId
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
signal::MenuItem::activate
.