[Explain what themes are.]
[People often think of them in terms of Qt and/or Gtk+` implementations.]
[Explain how BLT supports themes now]
Tk_Theme provides background themes. There is a version that only works with X and a version that is script based (new). The new scripted version works with standard geometry managers and uses the canvas. Here is a screenshot of a Tk demo that was modified to use it:
FB -- Quick glossary (in no special order):
There are at least 6 types of windows that one may have in an application:
Each window type can have a variety of frame states, and each state tends to have a way of displaying the frame pieces and window buttons that make up the widget. This is known as a style. These states include:
The frame pieces include:
Some of the buttons that window managers frequently decorate include
Whatever happened to the 'theme' TIP#48 [L1 ] ? Is that in limbo or actually going to happen?
PT writes: let's answer this on Tk Style Support, where the finalized TIP, as integrated into Tk 8.5, is discussed.
FB -- Qt [L2 ] and GTK+ [L3 ] both support styles in their current versions. Styles seem to be implemented in a similar fashion by both toolkits: they define a set of common elements (arrows, checkmarks...) and associate each with one or several API calls.
Qt defines a generic QStyle class [L4 ] which is the base class for all styles (Windows, Motif...). QStyle-derived classes implement a number of virtual member methods, each being used to draw or compute the geometry of the many elements. Thanks to polymorphism, widgets can then use any style derived from this base class.
GTK+ seems to work in a similar fashion, if I understand clearly their so-called online documentation ([L5 ] for GTK+ 1.2 and [L6 ] for GTK+ 2.0). IMHO it seems incredibly poor for such a widely used toolkit. A bare collection of uncommented forward declarations. If I were in a bad mood I'd say it sucks so much it could lift steel plates, but I digress ;-) (If I've missed the real doc, someone please point me to the right place)
Contrary to the C++ -based Qt that defines a class gathering all style-related methods, GTK+ is C-based and defines individual procedures (eg. gtk_draw_slider). But overall, both use the same model: a predefined (albeit potentially extensible) set of elements, and associated overloadable methods/procs.
FB -- My feeling is that themes support is implemented in a very monolithic way by both Qt and GTK+. Only predefined elements can be themed, and widgets can't define their own new elements. Furthermore, any change to the core (eg. adding a new element) implies:
Anyway, both methods aren't easily extensible without a break in binary compatibility, let alone dynamic script-level extensibility.
So we have two options here for extending Tk. Either we follow the Qt and GTK+ path and implement a monolithic system with predefined elements, or we define a novel, modular system that allows for new elements to be implemented (and even dynamically by loadable extensions).
The first option would be quite fast (and even easy) to implement, and may be sufficient. After all new widgets aren't implemented every day. And it seems to work fine for Qt and GTK, but I'm not sure it would fit the Tcl/Tk model.
Second option would take more time & effort, but IMHO better follows The Tcl Way better. Plus, it could make writing new widgets easier, and we know Tk is often criticized for the amount of effort needed to implement new widgets, and the lack of many widgets thereof. Most Tclers are convinced that the right way to build complex GUIs and widgets is at the script level, but that's not an excuse for making it harder at the C level ;-) Besides, we still don't have a good built-in megawidget framework.
What: grdb Where: http://missoula.bigsky.net/shunter/grdb.html Description: Tries to apply your gtk theme colors to Xt/Motif/Tk applications by setting variables based on the current them and piping them along with some other default files into an xrdb -merge command. Currently at version 0.2.4. Updated: 02/2000 Contact: mailto:[email protected]
What: Oroborus Theme Changer Where: http://www.edazzle.net/#oroborus Description: Tcl/Tk app for changing themes in the Oroborus window manager. Currently at version 1.2. Updated: 05/2002 Contact: mailto:[email protected]
What: themeleme Where: http://mitglied.tripod.de/loppo/ Description: Shell script for WindowMaker theme makers that eases the packaging of themes. Now comes with a Tcl/Tk GUI. Updated: 09/1999 Contact: mailto:[email protected]
Recently on comp.lang.tcl someone referenced the KDE theme engine called mosfet [L7 ].