5. Adding a document type specific tool bar

tutorial/tutorial5.xxe_gui:

  <toolBar name="toolBar" replace="configSpecificToolBarItems" />1

  <toolBar name="configSpecificToolBar">2
    <toolBarItems name="configSpecificToolBarItems" />3
  </toolBar>

  <layout label="Document Editor" icon="docedit.png">
    <topToolBars>4
      <toolBar name="toolBar" />
      <toolBar name="configSpecificToolBar" />
      <group name="nodePathToolBar">
        <tool name="nodePathTool" stretch="1" />
        <toolBar name="selectToolBar" />
      </group>
    </topToolBars>

    <insert />5
  </layout>

1

This removes the configuration specific buttons (element toolBarItems called "configSpecificToolBarItems" found in DesktopApp.xxe_gui) from the standard tool bar (element toolBar called "toolBar" found in DesktopApp.xxe_gui).

Attribute replace in an empty element means replace by nothing, which itself means remove. It's also possible to remove or replace a range of items using attributes replace and replaceEnd. More information about attributes replace and replaceEnd in Customizing a composite part without redefining it from scratch.

2

Declare a new tool bar called "configSpecificToolBar" by using a toolBar element.

3

This new toolBar only contains the set of configuration specific buttons. This set is declared in DesktopApp.xxe_gui as the toolBarItems element called "configSpecificToolBarItems". Therefore, we just need to reference this stock part in our new tool bar.

4

Replace the stock topToolBars child in the layout element by a custom one. This child element can contain one or more horizontal toolBars.

5

Without the use of insert, the above layout would have been understood as a redefinition from scratch of the standard layout of the XML editor. Such XML editor would contain just a few tool bars.