Thoughts on align

Charles Goodwin <[email protected]> Sat, 03 Apr 2004 01:25:50 +0000
Newsgroups gmane.comp.java.xwt.core
Organization XWT Foundation
Message-ID <[email protected]>
I really think that child boxen should determine their own alignment
within a parent box.

1) Parent specifies align

If you have a parent box with several child boxen of varying sizes, they
(theoretically, although not with the current implementation) will be
aligned according to the parents align attribute.

If you wanted to vary the alignment of said child boxen, you could wrap
each one in another box with a different align.  This, though, falls
flat if you want to align a clipped box within the parent as once the
child box gets larger than the parent, it will be the same size as it's
wrapping box which is then in turn aligned accordint to the parents
align setting.

2) Child specifies align

On the other hand, if boxes determine their own alignment, this all gets
very simple and requires very little intervention in terms of additional
boxes.

The only case for such intervention would be when the combined mass of
child boxen is smaller than the parent.  In this case, I say it should
just be aligned centrally and if one desires different alignment, they
can wrap the child boxen in a shrunken box whose alignment you can
adjust.  This would be a very uncommon situation, far less common than
boxen needing to specify alignment irrespective of siblings.

3) Align in widget code

There was talk of doing alignment using Ibex code - ie in the widgets.
I don't believe this is practical for in the example of a child boxen
being larger than it's parent and being clipped, the only way you could
use Ibex code to align the child is to offset it using it's x/y values
compared to the difference of it's size and the size of it's _parent_.
This violates a principle of Ibex/XWT, that a box assumes no knowledge
of it's ascendency, direct parent or otherwise.

I also think that it'd be a similar case as with grid; it might be
possible in widget code but the result would be so much more complex
than if you were to keep it in the core that we wouldn't be gaining
ground, rather losing ground by doing it this way.

My preference is obvious (2).  Any counter arguments?
-- 
- Charlie

Charles Goodwin <[email protected]>
Online @ http://www.charlietech.com