The #GtkMenuItem 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 GtkMenuItem derives from #GtkBin it can hold any valid child widget,
although only a few are really useful.
By default, a GtkMenuItem sets a #GtkAccelLabel as its child.
GtkMenuItem has direct functions to set the label and its mnemonic.
For more advanced label settings, you can fetch the child widget from the GtkBin.
An example for setting markup and accelerator on a MenuItem:
The GtkMenuItem implementation of the #GtkBuildable interface supports
adding a submenu by specifying “submenu” as the “type” attribute of
a <child> element.
An example of UI definition fragment with submenus:
GtkMenuItem 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.
The #GtkMenuItem 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 GtkMenuItem derives from #GtkBin it can hold any valid child widget, although only a few are really useful.
By default, a GtkMenuItem sets a #GtkAccelLabel as its child. GtkMenuItem has direct functions to set the label and its mnemonic. For more advanced label settings, you can fetch the child widget from the GtkBin.
An example for setting markup and accelerator on a MenuItem:
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.
An example of UI definition fragment with submenus:
CSS nodes
GtkMenuItem 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.