|
From: Joe E. <jen...@fl...> - 2004-10-25 19:23:02
|
[Cc: ed to tktable-tile-dev, since this is of general interest ]
Georgios Petasis wrote:
>
> I want to ask a question regarding writting a new theme.
> Lets suppose that I want to write a new button widget. I want to
> have a custom background, border & focus ring (well, no focus ring
> at all actually).
Buttons are actually pretty complicated, since there
are so many different ways to put them together.
For a pixmap theme, you probably want to use something
like the following:
style layout TButton {
Button.button -children {
Button.focus -children {
Button.padding -children {
Button.label } } } }
This is what the XP theme uses.
The "focus", "padding", and "label" elements can be inherited
from the parent theme, and you only need to define the
"Button.button" element. There should be different
images for the "active", "pressed", and "alternate" states
(TTK_STATE_ALTERNATE is set when the widget is the default
button). If you use different images to indicate focus as well,
then leave the "Button.focus" element out (this is what the
Aqua theme does).
> I have tried to read the tile sources, and what remains unclear to
> me is the exact elements that I need to provide. For example,
> I saw that there is an element called "background", but it doesn't
> get redefined by lets say the clam button.
This has changed between 0.4 and 0.5. In 0.5, the background
element is automatically included in all layouts. The theme
engine will probably need to treat the background element
specially at some point (see earlier message on "The Background
Problem"); you probably shouldn't redefine it.
> ???
> I can see for example that in the classic theme, the following layout
> is defined:
>
> TTK_BEGIN_LAYOUT(ButtonLayout)
> TTK_GROUP("Button.highlight", TTK_FILL_BOTH,
> TTK_GROUP("Button.border", TTK_FILL_BOTH|TTK_BORDER,
> TTK_GROUP("Button.padding", TTK_FILL_BOTH,
> TTK_NODE("Button.label", TTK_FILL_BOTH))))
> TTK_END_LAYOUT
>
> This means that Button.label also supports the display of the image?
> The background/focus elements are not used ?
The classic theme uses the outer highlight ring as
a focus indicator, and the default ring is built into
the "Button.border" element. It's more conventional
to use a dashed focus ring inside the border, as in:
style layout TButton {
Button.border -children {
Button.focus -children {
Button.padding -children {
Button.label } } } }
The "label" element is a combination of "text" and "image"
elements; it handles the "-compound" and "-anchor" widget options.
--Joe English
jen...@fl...
|