adonthell-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Adonthell-devel] GUI border and background


From: Kai Sterker
Subject: [Adonthell-devel] GUI border and background
Date: Sat, 7 Aug 2010 17:48:20 +0200

Started with that work, and came up with the following concept:

We create a "decoration" class that is initialized from a data file.
The decoration class can then create a widget/container background
with an optional border (and a scrollbar in the future). All these
elements are painted onto a surface the size of the widget/container
and can then be used as a rubber stamp whenever the widget/container
needs to be redrawn. If the container/widget is resized, we'll
recreate the surface.

The data file would look as follows:

<list>
  <list id="default">
    <string id="bg">background.png</string>
    <u_int8 id="bg_alpha">128</u_int8>
    <bool id="has_border">true</bool>
    <!-- optional set of border images -->
    <string id="border_tl">...
    <string id="border_tr">...
    <string id="border_bl">...
    <string id="border_br">...
    <string id="border_top">...
    <string id="border_bot">...
    <string id="border_lft">...
    <string id="border_rgt">...
  </list>
  <list id="activated">...</list>
  <list id="disabled">...</list>
</list>

Background and border would be tiled to fit the widget
size/width/height, the corner pieces would be painted as is. You could
specify the same image for all four corners, or have specific images.
Same for top/bottom and left/right part of the border. We also would
allow for several sets of graphics:

* default: is the standard look of the widget
* activated: is for widgets like a checkbox, or to give brief visual
feedback, like when a button has been pressed
* disabled: is for widgets that cannot receive the focus

I'm not sure how to handle focus, though. Either it needs to be an
additional layer so it can be applied to both default and active
widgets, or something that's done automatically, like a change in
brightness or color.

With such a per widget decoration, we could implement a number of
different UI elements with the widgets we have currently implemented,
just by providing a matching set of graphics. A toggle button can also
be a checkbox. A basic layout could be a toplevel window or a
selection list. We could have differently styled buttons (green "ok",
red "cancel") and so on. I'd assume we'd have a default hard coded
into each widget, but allow to override with a custom decoration where
we actually assemble the user interface. Should be simple to use, but
quite flexible that way.

What we wouldn't have, are different themes. But I don't think we
really made use of that feature in v0.3. And if we really wanted to
allow for that, we could just add an extra level in the directory
structure and extend the decoration class to either read from this or
that directory.


Suggestions and other ideas welcome.

Kai



reply via email to

[Prev in Thread] Current Thread [Next in Thread]