> GTK is a toolkit for C programs, larger and a more complicated, with a
> slightly weird (IMO) philosophy governing the layout of its widgets. A
> fairly complete manual and a tutorial is available. A designer (Glade)  is
> also available, but many of the widgets have yet to be added. You can find
> out more at http://www.gtk.org. A C++ wrapper, if you prefer to program in
> C++, should be available by now.

I like the Gtk layout method. It makes it very easy to construct forms
that look good no matter what settings the user has applied. And it also
takes out the hassle of handling form resizing.

For those in the dark, Gtk uses containers and objects just like any other
interface builder. The difference is that you cannot choose to position an
object at an arbitary position within a container (like X = 5, Y = 10).
You can ONLY have the object occupy ALL of the container.

But what use is this?

Containers aren't simple rectangular boxes. They are divided into
free-sizing sections with each section containing either one object or one
container.

The three standard types of containers available are for row-based
sections, column-based sections and matrix layout sections.

Two less frequently used containers are user-resizeable two-column or
two-row containers. This type is the easiest to identify though because of
the presence of the resize bar.

Certain objects like labels resize to occupy the least space they can.
When placed in a container, the specific section of the container adjusts
its size to match that of the object.

Other objects like listboxes also size to the minimum possible, but can be
made larger if required. Gtk adjusts the size of these objects so that
they fill up all the unused space.

This method of defining interfaces is rather similar to what Java
provides. The concept and result is the same: good looking interfaces no
matter what the platform and environment settings.

Consider this: if the user changed his font size from 10 point to 20
point, a pixel-positioned interface would start showing overlapping text.
With Gtk on the other hand, the label will grow in size and the container
will readjust itself to match. The interface looks as good as ever.


Note: Some of this description might not be entirely accurate. I don't
have much experience with Gtk+ yet, having only played around with Glade
and it's output files. I strongly recommend Glade for anyone trying to
start off with Gtk+ programming. The initial project output files it
generates contain some errors, but they can be easily fixed.

Reply via email to