Baseline alignment WIP



I just pushed the wip/baseline branch to git. It contains the initial
steps towards adding baseline alignment in gtk+, by extending the
size request and size allocation framework with:
* A way to report a baselines corresponding to the minimum and
  natural heights
* A way to allocate the baseline of a child widget in a baseline
   aware container
* A way to flag widgets that they want to be baseline aligned

It also contains baseline support for label, button, alignment and
horizontal boxes which works well enough for this test:

 http://people.gnome.org/~alexl/baseline.png

I started working on the vertical box implementation, where we would
align the baseline to the baseline of the first child that had
GTK_ALIGN_BASELINE valign. This is useful for e.g. layouts like this:

+-----------+------------------+
|           |           [IMG]  |
|           |           [IMG]  |
|  Label....|...[Entry] [IMG]  |
|           |                  |
|           +------------------+
|           |                  |
.........

Where we want the label in the left to align with the first text in
the vbox on the right side.

Conceptually this doesn't seem very hard, and i got the size request
part done easily. However, the size_allocate() implementation for the
case where a particular child widget is supposed to be on a specific
position is very complicated due to all the complexity of boxes (pack
start/end, homogenous, natural distribution of height, etc) so I gave
up for now.

However, I think implementing baseline support for things like
entries, rows-in-GtkGrid, GtkButtonBox, etc should be pretty easy and
might be an interesting excercise for other people who try out this
branch.

             



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