Table of Contents
| About | News | Mde's GUI | Features | Ideas | Platforms | Building | Utility Programs | Forum | Trac Wiki Help |
Editing GUI config files
File format
Mergetag format
{MT01} !{file must start with {MT01}}
!{ This is a comment. }
!{ The file contains any number of sections; each starts with {section name}. }
!{ {MT01} starts the header (the current section). }
{First section}
!{We're now in "First section".}
!{Data is entered with tags of the form: <type|name=value>; e.g.: }
<char[]|string="A string.">
< int[] | fifteen = [15, 0xF] >
<double|number = [2.1]>
!{To comment out a tag, just prefix with ! : }
!<char | hidden tag= 'h' >
!{But the formatting must still be correct (don't do: <char[]|invalid string=" (no ending quote)> )}
Header data
These tags are used in the header:
<char[]|Renderer="Renderer name">
The name of the renderer to use (currently must be "Simple").
<char[]|Design="Basic">
The section to use. Each section may specify a separate GUI "design", but only one is used.
An example
Just to give an idea what the file will normally look like:
{MT01}
<char[]|Renderer="Simple">
<char[]|Design="Basic">
{Basic}
<WidgetData|root={0:[0x21,0x90D970],1:["A string!"]}>
WidgetData tag
This is the tag you'll need most. It has the format:
<WidgetData|a widget={0:[1,2,3],1:["a","b","c"]}>
where [1,2,3] is an array of integers and ["a","b","c"] is an array of strings. Most widgets require exactly the right number of integers and strings, but some allow more to be given (but ignore them).
Each tag specifies how to create a widget. The above says widget "a widget" should be created with integers 1,2,3 and strings "a","b","c". The first widget to be created should be called "root".
More about the format: The WidgetData? type is a D struct, holding an int[] and a char[][] value. In the WidgetData? tag's data, { } deliminate a struct, and 0: and 1: point to the data for the first and second elements of the struct (so {} , {1:[]} and { 1: [], 0:[] } are all valid syntax).
The first int (always required) specifies the type of widget to create; the other ints and strings hold the data given to this widget. The following lists all widgets with the data they take, including the enumeration value used to select this widget.
Unnamed::
Ints Strings 0x0 Not a widget you can create.
FixedBlank::
Ints Strings 0x1 width height A non-resizable blank widget.
SizableBlank::
Ints Strings 0x2 A completely resizable blank widget (initial size zero).
Debug::
Ints Strings 0xF any... any... ... A debug widget. Essentially as SizableBlankWidget? but doesn't mind any amount of data and prints it.
... continue doing all this? Use Ddoc? Anyway, for now the widget codes are listed below, and documentation is in the source/ddoc.
enum WIDGET_TYPE : int { FUNCTION = 0x2000, // Function called instead of widget created (no "Widget" appended to fct name) TAKES_CONTENT = 0x4000, // Flag indicates widget's this should be passed an IContent reference. SAFE_RECURSION = 0x8000, // Safe to instantiate recursively without infinite looping. // Use widget names rather than usual capitals convention Unnamed = 0x0, // Only for use by widgets not created with createWidget // blank: 0x1 FixedBlank = 0x1, SizableBlank = 0x2, Debug = 0xF, // popup widgets: 0x10 PopupMenu = TAKES_CONTENT | 0x11, SubMenu = TAKES_CONTENT | 0x12, // labels: 0x20 ContentLabel = TAKES_CONTENT | 0x20, TextLabel = 0x21, // content functions: 0x30 editContent = FUNCTION | TAKES_CONTENT | SAFE_RECURSION | 0x30, addContent = FUNCTION | 0x31, flatMenuContent = FUNCTION | TAKES_CONTENT | SAFE_RECURSION | 0x32, subMenuContent = FUNCTION | TAKES_CONTENT | 0x33, // content widgets: 0x40 DisplayContent = TAKES_CONTENT | 0x40, BoolContent = TAKES_CONTENT | 0x41, AStringContent = TAKES_CONTENT | 0x42, ButtonContent = TAKES_CONTENT | 0x43, MenuButtonContent = TAKES_CONTENT | 0x44, GridLayout = TAKES_CONTENT | 0x100, ContentList = TAKES_CONTENT | SAFE_RECURSION | 0x110, FloatingArea = TAKES_CONTENT | 0x200, Switch = TAKES_CONTENT | 0x210, }
