Re: align vs expand vs grid



Hi,

On Thu, May 12, 2011 at 9:53 PM, Benjamin Otte <otte gnome org> wrote:
> Don't assign any extra space to children, use it as space on the
> right/bottom side. (This is the current behavior)

This seems screwy, unless the grid has left/top alignment set. I would
expect the grid to position the children according the alignment set
on the grid (center children as a whole if grid is aligned center,
etc.) - this should Just Work because the grid layout code should not
work with an area exceeding the children's natural size if the grid
isn't set to FILL and the children aren't expanding.

> And I think this principle is wrong. First of all every other
> container (that is not considered for deprecation) does assign extra
> space to children (in particular all subclasses of GtkBin do, such as
> GtkWindow, or GtkExpander).

GtkBin only assigns extra space to children if align=FILL on the bin, right?

This is just an attempt to interpret "scale up the widget content to
fill the area," by passing the buck down to the children of the bin.

> Second, if children should never get
> assigned extra space, why do we have the ALIGN_FILL parameter?

You'd use FILL to say that the child, once expanded, should somehow
grow its content (e.g. by scaling) rather than just centering (or
left/right-aligning) its content by adding blank space.

> Third,
> if the grid decides where to put the extra space, the align property
> does not ever make sense

The align property should determine whether the grid's layout code
even sees extra space. If it isn't FILL, then it should just be
looking at a natural-size-sized area on the start/end/center, I'd
think.

> Fourth, 2 interesting invariants hold for a Grid with one
> child: 1) It behaves identical to all bin subclasses and 2) it does
> not modify the layout at all.

If you set align=center on a Bin then say the frame in GtkFrame should
not fill extra space, it should be centered.

The only difference with GtkGrid I think is that you have an
alternative potential interpretation of FILL, which is to add spacing
amongst children, instead of passing through to children. But I do
think Grid should match Bin in that it shouldn't add space *around*
the children in order to implement FILL.

What I was arguing in
https://mail.gnome.org/archives/gtk-devel-list/2010-October/msg00072.html
I guess is that adding spacing is more useful than passing through to
the children, since you can set the children to expand if you want
pass through to children, while adding the spacing is an
otherwise-unavailable feature.

Havoc


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