Gtk.MenuItem

const Gtk = imports.gi.Gtk;

let menu_item = new Gtk.MenuItem({
    accel_path: value,
    label: value,
    right_justified: value,
    submenu: value,
    use_underline: value,
});
  

The Gtk.MenuItem 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 Gtk.Bin it can hold any valid child widget, altough only a few are really useful.

<refsect2 id="GtkMenuItem-BUILDER-UI"> <title>GtkMenuItem as GtkBuildable</title> The GtkMenuItem implementation of the GtkBuildable interface supports adding a submenu by specifying "submenu" as the "type" attribute of a &lt;child&gt; element. <example> <title>A UI definition fragment with submenus</title> <programlisting><![CDATA[ <object class="GtkMenuItem"> <child type="submenu"> <object class="GtkMenu"/> </child> </object> ]]></programlisting> </example> </refsect2>

Hierarchy

  • GObject.Object
    • GObject.InitiallyUnowned
      • Gtk.Widget
        • Gtk.Container
          • Gtk.Bin
            • Gtk.MenuItem