The dialog description language is a simple XML like language capable to denote any complex dialog box containing widgets and boxes.
Widgets are simple GUI elements such as buttons, entry fields, lists, etc. Widget can have attributes, states and actions (*note Actions::).
The widgets are grouped together with containers (*note Containers::), horizontal and vertical boxes or frames. Every widget should placed in one of the containers, no widgets can be alone for it is dangerous outside.
Label is a static text widget created with '<text></text>' tag.
The text in a static label, can be set with the '<label>STRING</label>' or the '<input file>FILENAME</input>' expression.
The pushbutton is a clickable widget defined with the '<button></button>' tags.
The '<label>STRING</label>' directive sets the text label of the pushbutton. If no label and pixmap is given for the button, gtkdialog will use OK as default.
When creating buttons, the '<input file>FILENAME</input>' tag can be used to insert a pixmap into the button. The FILENAME must be a pixmap file. Gtkdialog will find this file with the 'locate' utility if necessary.
The pushbuttons can contain a label and a pixmap simultaneously. For this you have to use the '<label></label>' and the '<input file></input>' as the next example shows:
<button> <input file>/usr/share/GUIcompletion/button_save.xpm</input> <label>The label</label> </button>
The '<action>COMMAND</action>' directive tells the gtkdialog what to do, when the button is pressed. If the action is not given explicitly the gtkdialog uses the default action, which is to exit the program. In this case the printed variable list will contain a variable named EXIT, with the label of the activated button as value.
The buttons can handle more than one actions simultaneously. If there are more '<action></action>' directive for the given button, they will be executed one by one, in the right order.
Gtkdialog supports a few pre-defined pushbuttons for simplify the creation of dialog boxes. The pre-defined buttons can be used the same manner the normal pushbuttons, but they have a default text, pixmap and output variable. Here is the list of available pre-defined pushbuttons:
The entry widget is a simple text input field, which can be used to get a string from the user.
The '<default>STRING</default>' directive sets the default content of the entry.
The '<visible>VISIBILITY</visible>' sets the initial state of the entry widget. The VISIBILITY can be 'enabled', which means the entry can be used, 'disabled', which means the content of the entry can not be altered or 'password'.
The entry widgets with the visibility set to 'password' are editable, but unreadable as it is common with entries holding password style information.
The checkbox is a simple widget with a label and a check mark which can be turned on and off by the user. Checkboxes are made with the '<checkbox></checkbox>' directive.
The label is the text shown beside the check mark. Every checkbox should have a label.
The initial state of the checkbox can be set by the '<default>STATE</default>' directive, where the STATE can be either 'yes' or 'no'.
The '<action></action>' directive tells the gtkdialog what to do, when the state of the checkbox is changed. As every widgets, the checkbox can hold multiply actions which are executed serially in the order they are written.
Actions of checkboxes can be written as conditional instructions with 'if true' and 'if false' prefixes as in the next example:
<checkbox> <label>This is a checkbox...</label> <variable>CHECKBOX</variable> <action>echo Checkbox is $CHECKBOX now.</action> <action>if true enable:ENTRY</action> <action>if false disable:ENTRY</action> </checkbox>
The '<visible>STATE</visible>' specify the initial visibility of the checkbox. The STATE can be either 'enabled' or 'disabled'. When a checkbox is disabled, it is shaded and its state can not be altered anyway.
The '<pixmap></pixmap>' defines a static pixmap widget.
The widget must have an input file defined with the '<input file>FILENAME</input>' tags. The FILENAME is the graphic image file for the pixmap. Gtkdialog will load this file if it can be opened for read, or will try to find a file with similar name (using the 'locate' utility program) if the file is unreadable.
The next example defines a static pixmap:
<pixmap> <input file>help.png</input> </pixmap>
The '<menubar></menubar>' defines menu bar which can be placed as any other screen elements. In the menubar widget you have to create menus with the '<menu></menu>' tag, and inside the menu must be at least one menu item created by the '<menuitem></menuitem>' tag.
The next example shows how to create a simple menubar with only one menu:
<menubar> <menu> <menuitem> <label>gtk-open</label> </menuitem> <menuitem> <label>gtk-save</label> </menuitem> <menuitem> <label>gtk-quit</label> <action>EXIT="quit"</action> </menuitem> <label>File</label> </menu> </menubar>
OK, it is not complete, but the next example seems to be just fine.
<vbox> <tree> <label>Device |Directory |File </label> <item>Hard drive |/usr/ |letter.tex </item> <item>Hard drive |/etc/ |inittab </item> <item>Hard drive |/etc/ |fstab </item> <item>Network |alpha:/home |quota.user </item> <item>Network |alpha:/home |quota.group </item> <item>Network |beta:/home/pipas |tmp </item> <item>Network |beta:/home/pipas |latexfiles </item> <item>Network |beta:/home/pipas |book </item> <item>Network |beta:/home/pipas |bin </item> <item>Network |beta:/home/pipas |documentation </item> </tree> <button ok></button> </vbox>