RFC: boxes

So, next idea. I'm pretty sure about this one actually and have talked
to it with people on IRC a lot. Again I have no idea how it will look
in detai, but I know I want to get there.

This one is all about layouting complex widgets. It again has nothing
to do with the public API or ABI of GTK and is all about structuring
our internal code. Well, it is about theming.

The thing you want to have read or at least have heard about are these 2:
box model: http://www.w3.org/TR/CSS21/box.html
visual formatting: http://www.w3.org/TR/CSS21/visuren.html
In particular the first.

If we want to allow people to really style widgets with CSS, the
widgets need to behave like CSS boxes. Currently none of them do. So
what do I mean by that? For example:
- Every widget needs to respect padding, border and margin.
Some respect border, even fewer respect padding and almost none
respect margin. None at all respect collapsing of margins.
- Every widget needs to draw background and border.
Very few widgets draw a background, even fewer draw a border. Some
widgets only draw them based on certain widget states.

But for complex widgets, that's not enough. If you want to do overlap
on notebook tabs or merge adjacent selected cells in iconviews, you
need the box model inside widgets. (you also need awesome css-fu, but
that's left as an excercise). What that means, is that we need to
break down all of our GTK widgets according to the CSS visual
formatting rules and box model, so we need to define what boxes exist
per widget and how they layer. This is a work that needs to be done
While we're at it, we also need to get rid of all the old style
properties we had and make sure they can be sanely replaced by CSS we

To give you an example of what I'm talking about: Look at a scrollbar,
it looks kinda like this:
|⇦|          |* * *|     |⇨|
So how many boxes is this? Should this be like this:
||⇦||          ||* * *||     ||⇨||
Or more like this:
|| ||          ┌-----┐     || ||
||⇦||          |* * *|     ||⇨||
|| ||          └-----┘     || ||
And then of course, the scrollbar needs to make sure that margins,
padding backgrounds and borders get properly applied to the boxes.
This of course includes shadows, repeat-modes, gradients and other
such things that the CSS guys invented.

And last but not least, we hopefully end up with an interface that is
easy to export as public API so other people can tune these widgets or
write their own easily.


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