[]Struct gtk::MenuItem

pub struct MenuItem(_, _);

The MenuItem widget and the derived widgets are the only valid children for menus. Their function is to correctly handle highlighting, alignment, events and submenus.

As a MenuItem derives from Bin it can hold any valid child widget, although only a few are really useful.

By default, a MenuItem sets a AccelLabel as its child. MenuItem has direct functions to set the label and its mnemonic. For more advanced label settings, you can fetch the child widget from the Bin.

An example for setting markup and accelerator on a MenuItem:

GtkWidget *menu_item = gtk_menu_item_new_with_label ("Example Menu Item");

GtkWidget *child = gtk_bin_get_child (GTK_BIN (menu_item));
gtk_label_set_markup (GTK_LABEL (child), "<i>new label</i> with <b>markup</b>");
gtk_accel_label_set_accel (GTK_ACCEL_LABEL (child), GDK_KEY_1, 0);

MenuItem as Buildable

The MenuItem implementation of the Buildable interface supports adding a submenu by specifying “submenu” as the “type” attribute of a <child> element.

An example of UI definition fragment with submenus:

menuitem
├── <child>
╰── [arrow.right]

MenuItem has a single CSS node with name menuitem. If the menuitem has a submenu, it gets another CSS node with name arrow, which has the .left or .right style class.

Implements

GtkMenuItemExt, BinExt, ContainerExt, WidgetExt, glib::object::ObjectExt, BuildableExt, ActionableExt, WidgetExtManual, BuildableExtManual

Implementations

impl MenuItem[src]

pub fn new() -> MenuItem[src]

Creates a new MenuItem.

Returns

the newly created MenuItem

pub fn with_label(label: &str) -> MenuItem[src]

pub fn with_mnemonic(label: &str) -> MenuItem[src]

Trait Implementations

impl Clone for MenuItem

impl Debug for MenuItem

impl Default for MenuItem[src]

impl Display for MenuItem[src]

impl Eq for MenuItem

impl Hash for MenuItem

impl IsA<Actionable> for MenuItem

impl IsA<Bin> for MenuItem

impl IsA<Buildable> for MenuItem

impl IsA<Container> for MenuItem

impl IsA<MenuItem> for CheckMenuItem

impl IsA<MenuItem> for RadioMenuItem

impl IsA<MenuItem> for SeparatorMenuItem

impl IsA<Widget> for MenuItem

impl Ord for MenuItem

impl<T: ObjectType> PartialEq<T> for MenuItem

impl<T: ObjectType> PartialOrd<T> for MenuItem

impl StaticType for MenuItem

Auto Trait Implementations

impl RefUnwindSafe for MenuItem

impl !Send for MenuItem

impl !Sync for MenuItem

impl Unpin for MenuItem

impl UnwindSafe for MenuItem

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<Super, Sub> CanDowncast<Sub> for Super where
    Sub: IsA<Super>,
    Super: IsA<Super>, 

impl<T> Cast for T where
    T: ObjectType, 

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> ObjectExt for T where
    T: ObjectType, 

impl<'a, T> ToGlibContainerFromSlice<'a, *const GList> for T where
    T: GlibPtrDefault + ToGlibPtr<'a, <T as GlibPtrDefault>::GlibType>, 

type Storage = (Option<List>, Vec<Stash<'a, <T as GlibPtrDefault>::GlibType, T>>)

impl<'a, T> ToGlibContainerFromSlice<'a, *const GPtrArray> for T where
    T: GlibPtrDefault + ToGlibPtr<'a, <T as GlibPtrDefault>::GlibType>, 

type Storage = (Option<PtrArray>, Vec<Stash<'a, <T as GlibPtrDefault>::GlibType, T>>)

impl<'a, T> ToGlibContainerFromSlice<'a, *mut GArray> for T where
    T: GlibPtrDefault + ToGlibPtr<'a, <T as GlibPtrDefault>::GlibType>, 

type Storage = (Option<Array>, Vec<Stash<'a, <T as GlibPtrDefault>::GlibType, T>>)

impl<'a, T> ToGlibContainerFromSlice<'a, *mut GList> for T where
    T: GlibPtrDefault + ToGlibPtr<'a, <T as GlibPtrDefault>::GlibType>, 

type Storage = (Option<List>, Vec<Stash<'a, <T as GlibPtrDefault>::GlibType, T>>)

impl<'a, T> ToGlibContainerFromSlice<'a, *mut GPtrArray> for T where
    T: GlibPtrDefault + ToGlibPtr<'a, <T as GlibPtrDefault>::GlibType>, 

type Storage = (Option<PtrArray>, Vec<Stash<'a, <T as GlibPtrDefault>::GlibType, T>>)

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T> ToString for T where
    T: Display + ?Sized
[src]

impl<T> ToValue for T where
    T: SetValue + ?Sized

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.