bw logo

Chapter 18. gui.xml

Table of Contents

18.1. ItemSection

The GUI XML file is used to configure World Editor's menus and toolbars.

Defined in bigworld/tools/worldeditor/resources/data, the grammar of gui.xml is illustrated below:

<GUI>
  ItemSection
</GUI>

Grammar of bigworld/tools/worldeditor/resources/data/gui.xml

18.1. ItemSection

The grammar of ItemSection is illustrated below:

*<item>
   <name>          string                       </name> 
   <type>         [ACTION|CHILD|CHOICE|EXPANDED_CHOICE|GROUP|SEPARATOR|TOGGLE] </type>
  [ItemSection]
  [<width>         integer                      </width>        ]
  [<displayName>   string                       </displayName>  ]
  [<description>   string                       </description>  ]
  [<shortcut>      string                       </shortcut>     ]
  [<updater>       string                       </updater>      ]
  [<commandID>     integer                      </commandID>    ]
  [<action>        string                       </action>       ]
  [<imageHot>      file:x_bgn,y_bgn,x_end,y_end </imageHot>     ]
  [<imageDisabled> file:x_bgn,y_bgn,x_end,y_end </imageDisabled>]
  [<imageNormal>   file:x_bgn,y_bgn,x_end,y_end </imageNormal>  ]
  [<toolMode>      string                       </toolMode>     ]
  [<transparency>  [0-255],[0-255],[0-255]      </transparency> ]
 </item>

Grammar of ItemSection

The list below describes the tags in ItemSection:

  • action

    C++ function, Python method, or expression updating value of a tag in options.xml to be called when the item is fired (i.e., pressed, selected, etc...) — options.xml is located in bigworld/tools/worldeditor; for details on the file's grammar, see World Editor.

    The possible values for this tag are described below:

    • Type: C++ function

      Defined in the tool's source code.

      Example: newSpace (in MainMenuFileCreateNewSpace)

    • Type: Python method

      Defined in any Python script located in bigworld\tools\worldeditor\resources\scripts.

      Example: doQuickSave (in MainMenuFileQuickSave)

      Please note that if the method is defined in UIExt.py, then the method need not be appended by the module name. For example, to declare UIAdapter.py's method updateSelectionFilter as the updater, you would have to specify the value UIAdapter.updateSelectionFilter.

    • Expression updating value of a tag in options.xml

      Defined inline (using C syntax)

      Example: render/terrain/wireFrame = 1 (in MainToolBarTerrainWireframeShowTerrainWireframe.

  • commandID

    ID required by some UI item, like sub-menus or toolbar buttons.

    Usually GUIManager can generate the command ID automatically, but sometimes a specific command ID might be needed for an UI item.

  • description

    Text to be displayed in the item's tooltip.

  • displayName

    Text to be displayed in the menu or menu item.

  • imageDisabled

    Image to be displayed for the toolbar button when it is disabled.

  • imageHot

    Image to be displayed for the toolbar button when the mouse hovers it.

  • imageNormal

    Image to be displayed for the toolbar button.

  • name

    Name of the item being configured (menu, menu item, toolbar group, or toolbar button).

  • shortcut

    Keyboard shortcut to activate the item.

  • toolMode

    Tool mode activated by the respective item.

    For the list of available tool modes and their description, see the document Content Tools Reference Guide's section World Editor Panel summary.

  • transparency

    RGB value of the transparent color in the toolbar button images.

  • type

    Type of the item being configured.

    The list below describes the available options

    • ACTION

      Indicates that the item has an action associated with it.

      It must then define action tag.

      Examples: File New Space and File Open Space menu items, Save and Undo toolbar buttons.

    • CHILD

      Indicates a sub-item of items of type CHOICE, EXPANDED_CHOICE, or TOGGLE.

      Examples: Tool mode toolbar buttonsA (this toolbar group has type value of CHOICE), and View Status Bar menu item's ON and OFF definitions (this menu item has a type value of TOGGLE).

    • CHOICE

      Indicates that the only one of the sub-itemsB defined for this item may be active at any one time (i.e., the sub-items will act as option buttons).

      Examples: Tool mode toolbar buttonsA, and Camera Speed toolbar buttons.

    • EXPANDED_CHOICE

      Indicates that the sub-itemsB defined for this items will be displayed as entries in a drop-down list box.

    • GROUP

      For menu items, indicates that the item has a sub-menu associated with it.

      For toolbar items, indicates that the item defines other groups or toolbar buttons.

      Examples: File menu, File Recent Files menu item, and Edit toolbar group (with Undo and Redo buttons).

    • SEPARATOR

      For menu items, draws a horizontal line.

      For toolbar items, draws a vertical line.

    • TOGGLE

      Indicates that the item will have an ON/OFF value associated to it (i.e., the item will act as a check box).

      It must define 2 sub-items: the first one specifying action and updater for when the item is ON, and the second one specifying action for when the item is OFF.

      Examples: View Status Bar and View Show Panels menu items, and Orthographic View and Player Preview Mode toolbar buttons.

    A — For the list of available tool modes and their description, see the document Content Tools Reference Guide's section World Editor Panel summary.

    B — Sub-items are defined as having type tag set to CHILD.

  • updater

    Name of a C++ function, Python method, or expression enquiring value of a tag in options.xml that returns an integer value — if 0 is returned, then the item will be disabled, otherwise it will be enabled (for CHILD items of CHOICE items, if 0 is returned, then the item is cleared/unchecked, otherwise it is selected/checked).

    options.xml is located in bigworld/tools/worldeditor — for details on this file's grammar, see World Editor)

    The possible values for this tag are described below:

    • Type: C++ function

      Defined in the tool's source code.

      Example: updateUndo (in MainMenuEditUndo)

    • Type: Python method

      Defined in any Python script located in bigworld\tools\ worldeditor\resources\scripts.

      Please note that if the method is defined in UIExt.py, then the method need not be appended by the module name. For example, to declare UIAdapter.py's method updateSelectionFilter as the updater, you would have to specify the value UIAdapter.updateSelectionFilter.

    • Type: Expression enquiring value of a tag in options.xml

      Defined inline (using C syntax)

      Example: camera/ortho == 0 (in MainToolBarEditViewOrthoShowOrthoMode)