Architecture:Widget Decoration Format
Overview
The look of the GUI is determined by XML files, which describes the graphical elements a widget is composed of, depending on its current state. The overall structure of that file is as follows:
<list id="Default" /> <list id="Activated" /> <list id="Focused" />
These currently supported sections/states are:
- Default The standard look of a widget.
- Activated A widget that has been activated, like a button that is pressed or a checkbox that has been checked.
- Focused An overlay to indicate that the widget has the input focus. Applied over the default or activated look of the widget.
Each section can contain the following elements, of which has_border is mandatory:
<u_int8 id="bg_alpha"></u_int8> <s_int8 id="highlight"></s_int8> <bool id="has_border"></bool>
Their meaning is as follows:
- bg_alpha Background translucency from 0 (totally opaque) to 255 (completely transparent).
- highlight Brightness adjustment from -127 (very dark) to 127 (very bright). Only valid for section Focused.
- has_border Whether the widget has a border (1) or not (0). The border is considered part of the widget and will not add to its size.
In addition, the actual graphical elements used to render the widget must be defined in each section. Which elements those are depends on the widget in question. Border elements only need to be present if has_ border is set to 1. For further details, refer to the GUI graphics documentation.
Example
Below is the decoration file for a simple toplevel window.
<list id="Default"> <string id="bg">window_bg.png</string> <u_int8 id="bg_alpha">127</u_int8> <bool id="has_border">1</bool> <string id="border_tl">window_corner.png</string> <string id="border_tr">window_corner.png</string> <string id="border_bl">window_corner.png</string> <string id="border_br">window_corner.png</string> <string id="border_top">window_border_top.png</string> <string id="border_bot">window_border_bot.png</string> <string id="border_lft">window_border_lft.png</string> <string id="border_rgt">window_border_rgt.png</string> </list>