Blades of Exile Documentation {#mainpage} ============================= This is the documentation for parts of the Blades of Exile source code. Currently it covers only the dialog engine. Defining a Dialog ================= Creating a new dialog consists of two basic steps: first, you have to create the XML dialog definition, and then you need to write the code to set it up and implement all the required callbacks. The format of the XML dialog files is defined by the schema in _rsrc/schemas/dialog.xsd_, but this document will cover what you need to know in a more readable manner. A dialog definition consists of a `` tag containing any number of tags representing various dialog controls. Each tag will be documented in some detail below. Common Attributes ----------------- The following attributes are allowed on all or most elements: * `top`, `left`, `width`, `height` - Specifies the location and bounding rect of the control within the dialog. All non-container controls support these attributes, and in fact the `top` and `left` attributes are required. Some controls may ignore the `width` and `height` attributes. All of these must be non-negative integers. * `relative` - Specifies how the location is computed; defaults to `"abs"`. Must be one or two (space-separated) of the following; if two are specified, they represent the mode used for calculating x and y respectively: * `abs` - Computed in global dialog space, relative to the top left corner. * `pos` - Computed relative to the reference widget's bottom right corner. * `pos-in` - Computed relative to the reference widget's top left corner. * `neg` - Computed relative to the reference widget's top left corner, with the axes inverted (as if top and left were negative). As a special case, if this is used with no reference widget, the widget's size does not contribute to computation of the dialog's size, and the widget is positioned relative to the dialog's bottom right corner. * `neg-in` - Computed relative to the reference widget's bottom right corner, with the axes inverted. * `anchor` - Specifies the `name` of the reference widget for this widget's location. * `rel-anchor` - Set to `prev` or `next` to use the previous or next element in the XML ordering as the reference widget for this widget's location. This currently does not work for widgets in containers. Mutually exclusive with `anchor`. * `def-key` - Specifies the default keyboard shortcut for the control. See **Keyboard Shortcuts** below for more information on the format of this attribute. * `font`, `size`, `color`, `colour` - Specifies text attributes of the control. See **Text Formatting** below for details on accepted values. * `name` - Give the control a unique identifier which you can use to refer to it from the code. If omitted, the code will generate a random identifier. All controls support this attribute. * `fromlist` - Currently unused, but the intended use is to look up the control's text value in a string list (in _rsrc/strings_) * `framed` - Specifies whether the control should be drawn with a frame around it, and what type of frame. Can be either `true` or `false` * `outline` - Sets the type of frame to use for this control. Must be one of `solid`, `inset`, `outset`, `double`. It defaults to `inset` and is meaningless if `framed` is `false`. The `` tag ------------------ The `` tag accepts the following attributes: * `skin` - Specify the dialog's background pattern. Currently only accepts `dark` or `light`. If omitted, a default is used which depends on whether the dialog is used in the game or the scenario editor. As such, this attribute should be omitted for most dialogs. * `debug` - This attribute is completely ignored by the game, but if set to `true`, the XSL stylesheet will draw the bounding rects of LEDs and other debug information. * `fore` - The default text colour. Generally this shouldn't be needed. * `defbtn` - The ID (`name` attribute) of the default button. This is an IDREF, so it must exist in the dialog. The `` tag ---------------- The `` tag can be used either for a non-editable text message or for a frame to group elements. Within a `` tag, you can use a `
` tag to insert a line break. See **Whitespace** for an explanation of the intended whitespace collapsing behaviour. The `` tag accepts the following attributes: * `framed` - See **Common Attributes** above. Defaults to `false`. * `outline` - See **Common Attributes** above. * `underline` - If true, the text will be underlined. * `fromlist`, `font`, `size`, `color`, `colour`, `def-key` - See **Common Attributes** above. The `