Architecture:Gui Module

From Adonthell
Revision as of 07:22, 24 November 2010 by Asipicabad (talk | contribs)
Jump to navigation Jump to search


Page Is Unavailable Due To Site Maintenance, Please Visit Reserve Copy Page


CLICK HERE


This module contains everything required to create a user interface and is derived from this initial widget implementation.

Widgets and Layouts

The classes of the GUI module are split into widgets and layouts. Widgets are single user interface elements like a label, button or text entry field, whereas layouts are containers that can be used to group multiple widgets and define their position on the screen. Toplevel windows or dialogs have to inherit from one of the layout implementations.

Decoration

The <tt>decoration</tt> class defines the look of every individual widget. For consistency, widgets of the same type should use the same decoration, but in theory, each widget can have it's own special look. A widgets decoration is described through an XML file that consists of multiple sections:

 <Data>
   <list id="Default" />
   <list id="Activated" />
   <list id="Focused" />
 </Data>

These currently supported sections 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 bg and has_border are mandatory:

  <string id="bg"></string>
  <u_int8 id="bg_alpha"></u_int8>
  <s_int8 id="highlight"></s_int8>
  <bool id="has_border"></bool>
  <string id="border_tl"></string>
  <string id="border_tr"></string>
  <string id="border_bl"></string>
  <string id="border_br"></string>
  <string id="border_top"></string>
  <string id="border_bot"></string>
  <string id="border_lft"></string>
  <string id="border_rgt"></string>

Their meaning is as follows:

  • bg The background image. Will be tiled to fill the widget size. If no size is given for the widget, it will assume the size of its background image.
  • 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 <tt>Focused</tt>.
  • 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. If set to (1), then eight border images must be given: four corner pieces, (t)op(l)eft, (t)op(r)ight, (b)ottom(l)eft and (b)ottom(r)ight as well as 4 edge pieces, (top), (bot)tom, (l)e(ft) and (r)i(g)h(t). The corner pieces are painted as is, whereas the edge pieces are tiled to fill the space between the individual corners.

Window Manager

The <tt>window_manager</tt> class keeps track of open windows and dialogs and handles focus, which is usually given to the topmost window. It also allows fading in and out of windows/dialogs as they are opened or closed.