Re: Baseline alignment ideas



On Tue, 2013-02-26 at 17:03 -0500, Owen Taylor wrote:
On Tue, 2013-02-26 at 15:30 +0100, Alexander Larsson wrote:
I don't really see any way to solve this generically. But maybe we can
somehow limit our baseline support so that this works? For instance,
we could always request the naural size for baseline aligned widgets
and never grow them? Would that be enough in practical use? I dunno...

This is my suggestion - do something that handles the case of
single-line labels and buttons packed into a horizontal box or grid row
and don't add a single bit of complexity where we don't have a very
strong justification.

I agree!, we should start with a simple implementation in GtkBox/GtkGrid
and if time proves its not enough we can always add the new
functionality or even make a new container.

So... what I would do is calculate the size request of children as usual
and before making the actual allocation ask for the baselines and use
that info to offset the allocation so that baselines are aligned.

I think this would work for most cases, children wont get extra space
but they would be aligned, and if you really want to allocate that extra
space then I guess it would be wise to consider a set_baseline() api so
that before allocating the extra space you set the baseline you got in
the first place.

As a quick hack, we could even use margin-top/margin-bottom properties
to implement this.

Greets

Juan Pablo



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