GtkMenuItem {RGtk2} | R Documentation

## GtkMenuItem

### Description

The widget used for item in menus

### Methods and Functions

`gtkMenuItemNew(show = TRUE)`
`gtkMenuItemNewWithLabel(label, show = TRUE)`
`gtkMenuItemNewWithMnemonic(label, show = TRUE)`
`gtkMenuItemSetRightJustified(object, right.justified)`
`gtkMenuItemGetRightJustified(object)`
`gtkMenuItemGetLabel(object)`
`gtkMenuItemSetLabel(object, label)`
`gtkMenuItemGetUseUnderline(object)`
`gtkMenuItemSetUseUnderline(object, setting)`
`gtkMenuItemSetSubmenu(object, submenu)`
`gtkMenuItemGetSubmenu(object)`
`gtkMenuItemRemoveSubmenu(object)`
`gtkMenuItemSetAccelPath(object, accel.path)`
`gtkMenuItemGetAccelPath(object)`
`gtkMenuItemSelect(object)`
`gtkMenuItemDeselect(object)`
`gtkMenuItemActivate(object)`
`gtkMenuItemToggleSizeRequest(object, requisition)`
`gtkMenuItemToggleSizeAllocate(object, allocation)`
`gtkMenuItem(label, show = TRUE)`

### Hierarchy

    GObject
       +----GInitiallyUnowned
             +----GtkObject
                   +----GtkWidget
                         +----GtkContainer
                               +----GtkBin
                                     +----GtkItem
                                           +----GtkMenuItem
                                                 +----GtkCheckMenuItem
                                                 +----GtkImageMenuItem
                                                 +----GtkSeparatorMenuItem
                                                 +----GtkTearoffMenuItem

### Interfaces

GtkMenuItem implements AtkImplementorIface, `GtkBuildable` and `GtkActivatable`.

### Detailed Description

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

As it derives from `GtkBin` it can hold any valid child widget, altough only a few are really useful.

### GtkMenuItem as GtkBuildable

The GtkMenuItem implementation of the GtkBuildable interface supports adding a submenu by specifying "submenu" as the "type" attribute of a <child> element.

A UI definition fragment with submenus

    <object class="GtkMenuItem">
      <child type="submenu">
        <object class="GtkMenu"/>
      </child>
    </object>

### Structures

`GtkMenuItem`

  undocumented

### Convenient Construction

`gtkMenuItem` is the result of collapsing the constructors of `GtkMenuItem` (`gtkMenuItemNew`, `gtkMenuItemNewWithLabel`, `gtkMenuItemNewWithMnemonic`) and accepts a subset of its arguments matching the required arguments of one of its delegate constructors.

### Signals

`activate(menuitem, user.data)`

  Emitted when the item is activated.

  `menuitem`

    the object which received the signal.

  `user.data`

    user data set when the signal handler was connected.

`activate-item(menuitem, user.data)`

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

  `menuitem`

    the object which received the signal.

  `user.data`

    user data set when the signal handler was connected.

`toggle-size-allocate(menuitem, user.data)`

  undocumented

  `menuitem`

    the object which received the signal.

  `user.data`

    user data set when the signal handler was connected.

`toggle-size-request(menuitem, user.data)`

  undocumented

  `menuitem`

    the object which received the signal.

  `user.data`

    user data set when the signal handler was connected.

### Properties

`accel-path` [character : * : Read / Write]

  Sets the accelerator path of the menu item, through which runtime changes of the menu item's accelerator caused by the user can be identified and saved to persistant storage. Default value: NULL Since 2.14

`label` [character : * : Read / Write]

  The text for the child label. Default value: "" Since 2.16

`right-justified` [logical : Read / Write]

  Sets whether the menu item appears justified at the right side of a menu bar. Default value: FALSE Since 2.14

`submenu` [`GtkMenu` : * : Read / Write]

  The submenu attached to the menu item, or NULL if it has none. Since 2.12

`use-underline` [logical : Read / Write]

  `TRUE` if underlines in the text indicate mnemonics Default value: FALSE Since 2.16

### Style Properties

`arrow-scaling` [numeric : Read]

  Amount of space used up by arrow, relative to the menu item's font size. Allowed values: [0,2] Default value: 0.8

`arrow-spacing` [integer : Read]

  Space between label and arrow. Allowed values: >= 0 Default value: 10

`horizontal-padding` [integer : Read]

  Padding to left and right of the menu item. Allowed values: >= 0 Default value: 3

`selected-shadow-type` [`GtkShadowType` : Read]

  Shadow type when item is selected. Default value: GTK_SHADOW_NONE

`toggle-spacing` [integer : Read]

  Space between icon and label. Allowed values: >= 0 Default value: 5

`width-chars` [integer : Read]

  The minimum desired width of the menu item in characters. Allowed values: >= 0 Default value: 12 Since 2.14

### Author(s)

Derived by RGtkGen from GTK+ documentation

### References

https://developer.gnome.org/gtk2/stable/GtkMenuItem.html

[Package RGtk2 version 2.20.36.3 Index]