This section describes the declarative syntax used by rules that define menus / toolbars.<h2>Syntax</h2> <pre> <i>menu-rule:</i> <i>menu-decl</i> <i>menu-decl</i> <i>menu-rule</i> <i>menu-decl:</i> <i>menu-tag</i> <i>menu-clause</i> <i>menu-clause:</i> <i>append-tag</i> <i>insert-tag</i> <i>remove-tag</i> <i>clear-tag</i> </pre> <h2>&lt;menu&gt; tag</h2> Defines a new menu. All standard menu attributes are supported (see <q ref="core.env:KitMenubars!MENU_BAR">MENU_BAR</q> for details). <pre> <i>menu-tag</i>: &lt;menu <i>menu-attributes</i>&gt; <i>menu-clause</i><sub>many</sub> &lt;/menu&gt; </pre> <h2>&lt;item&gt; tag</h2> Defines a menu item. This is an inner tag that can only be used inside menu &lt;append&gt; or &lt;insert&gt; clauses. <pre> <i>item-tag</i>: &lt;item <i>item-attributes...</i>/&gt; </pre> <div class="INSET"> <p> All standard menu item attributes are supported (see <q ref="core.env:KitMenubars!MENU_ITEM">MENU_ITEM</q> for details). A special 'class' attribute is also provided as a shortcut for creating menu items based on class metadata. An empty item tag (i.e., without attributes) represents a menu separator. </p><p> Menus items can be nested to create sub-menus. This nesting can continue to any number of levels. Sub-menus that are defined by nested menu items are local to the containing menu and cannot be extended. </p><p> Alternatively, a sub-menu can be defined by using the 'menu' attribute on the item to reference a global menu definition. Sub-menus defined in this way are extensible, since the global menus on which they are based can be extended. </p> </div> <h2>&lt;append&gt; tag</h2> Appends one or more items to the end of a menu, where the menu is either the enclosing <i>menu-tag</i> or the specified <i>menuId</i> attribute. <pre> <i>append-tag</i>: &lt;append <i>menu="menuId"</i>&gt; <i>item-tag</i><sub>many</sub> &lt;/append&gt; </pre> <h2>&lt;insert&gt; tag</h2> Inserts one or more items before / after a specified menu item, where the menu is either the enclosing <i>menu-tag</i> or the specified <i>menuId</i> attribute. <pre> <i>insert-tag</i>:<sub>one of</sub> &lt;insert before="itemId" <i>menu="menuId"</i>&gt; <i>item-tag</i><sub>many</sub> &lt;/insert&gt; &lt;insert after="itemId" <i>menu="menuId"</i>&gt; <i>item-tag</i><sub>many</sub> &lt;/insert&gt; </pre> <h2>&lt;remove&gt; tag</h2> Removes a specified menu item, where the menu is either the enclosing <i>menu-tag</i> or the specified <i>menuId</i> attribute. <pre> <i>remove-tag</i>: &lt;remove item="itemId" <i>menu="menuId"</i>/&gt; </pre> <h2>&lt;clear&gt; tag</h2> Clears an entire menu, where the menu is either the enclosing <i>menu-tag</i> or the specified <i>menuId</i> attribute. <pre> <i>clear-tag</i>: &lt;clear <i>menu="menuId"</i> /&gt; </pre> <h2>Example (popup menu)</h2> <pre> &lt;extend rule="defineContextMenu"&gt; &lt;constraint&gt;(board isa svg:ZDrawing) and (element isa gml2:Unit)&lt;/constraint&gt; &lt;comments&gt; Annotate | Actual Size, Fit Window, Print...&lt;/comments&gt; &lt;append&gt; &lt;item command="EDIT_ANNOTATE" signal="BOARD-&gt;annotate(&#64;pos)"/&gt; &lt;item /&gt; &lt;item command="VIEW_ACTUAL_SIZE"/&gt; &lt;item command="VIEW_FIT_WINDOW"/&gt; &lt;item command="FILE_PRINT"/&gt; &lt;/append&gt; &lt;/extend&gt; </pre> <h2>Example (toolbar)</h2> <pre> &lt;extend rule="defineToolbars"&gt; &lt;constraint&gt;model isa gml2:Model&lt;/constraint&gt; &lt;comments&gt;Standard drawing toolbars&lt;/comments&gt; &lt;menu id="DSG_TOOLBAR" category="DRAWING" description="Drawing" editable="true"&gt; &lt;append&gt; &lt;item command="VIEW_ZOOM_IN"/&gt; &lt;item command="VIEW_ZOOM_OUT"/&gt; &lt;item /&gt; &lt;item command="DRAW_FLIP_X"/&gt; &lt;item command="DRAW_FLIP_Y"/&gt; &lt;item command="DRAW_ROTATE_RIGHT"/&gt; &lt;item command="DRAW_ROTATE_LEFT"/&gt; &lt;item /&gt; &lt;item command="TOOLS_OPTIONS"/&gt; &lt;/append&gt; &lt;/menu&gt; &lt;insert before="SEARCH_HOME" menu="MAIN_TOOLBAR"&gt; &lt;item command="VIEW_ZOOM_IN"/&gt; &lt;item command="VIEW_ZOOM_OUT"/&gt; &lt;item /&gt; &lt;/insert&gt; &lt;/extend&gt; </pre> <h2>Example (sub-menu)</h2> <pre> &lt;extend rule="defineMainmenu"&gt; &lt;constraint&gt;model isa gml2:Model&lt;/constraint&gt; &lt;comments&gt; Standard tools menu&lt;/comments&gt; &lt;append&gt; &lt;item command="TOOLS_KITCONFIG"/&gt; &lt;item command="TOOLS_DOCUMENTATION"/&gt; &lt;item text="SDK Tools"&gt; &lt;item command="SDK_RELOAD_KITS"/&gt; &lt;item command="SDK_RELOAD_RULES"/&gt; &lt;item command="SDK_RELOAD_BOARD"/&gt; &lt;/item&gt; &lt;item /&gt; &lt;item command="TOOLS_CUSTOMIZE"/&gt; &lt;item command="TOOLS_OPTIONS"/&gt; &lt;/append&gt; &lt;/extend&gt; </pre>(c) SAP AG 2003-2006. All rights reserved.