SWIRLCAAGT

Root elements and menus

As has been pointed out before, the MenuBuilder uses the <root> elements in the configuration file as basis for building its components. Currently we support conversion to menu bars, popup menus and tool bars. A root element can contain the following child elements:

  • Any of the three standard button types, represented by <action>, <toggle> and <group> elements.

  • References to any of these, in the form of an <action-ref>, <toggle-ref> or <group-ref> element.

  • Zero or more <menu> elements, which will be rendered as submenus. Menus can contain the same subelements as root elements. Currently submenus are not supported in tool bars.

  • Separators, which come in two types:

    <separator type="standard"/>
    <separator type="glue"/>
                            

The standard separator, which is the default type when the type attribute is omitted, separates menu items with a horizontal line and tool bar items with a blank space of fixed size. The glue separator provides separates consecutive items with invisible spacing that grows to fill the entire menu bar or tool bar.

The following example root element is meant to be used as a menu bar. It contains a file menu of which the last item is separated from the first by a horizontal line and a help menu which will appear flush right on the menu bar, because of the added glue. The file menu also has a sub menu 'New' with two menu items.

           
<root id="menubar">
  <menu i18n="file.caption">
     <menu i18n="new.caption">
        <action-ref id="new.empty.file"/>
        <action-ref id="new.unnamed.folder"/>
     </menu>
     <action-ref id="save.file"/>
     <action-ref id="saveAs.file"/>
     <separator>
     <action-ref id="exit"/>
  </menu>
  <menu i18n="edit.caption">
     ...
  </menu>
  <separator type="glue"/>
  <menu i18n="help.caption">
     ...
  </menu>
</root>