Re: grid widget (was Re: possible removal of GtkWrapBox)



Hi,

On Sun, Oct 10, 2010 at 10:41 AM, Tristan Van Berkom
<tristanvb openismus com> wrote:
> I would only expect the expand to be distributed evenly among
> children as, thats what GtkBox does ;-)

But the whole point of the exercise is to mop up GtkBox cruft...

> I'm not sure that having all the children stop expanding
> when an expand child is added is any worse than having all
> the extra column/row spacing suddenly disappear.

The general principle I think is that if a child doesn't say it can
benefit from expand, it doesn't make sense to expand it. For example,
expanding a button just looks bad.

> Maybe a similar spreading option would be useful for the Grid ?
> (i.e. decide whether Grid children EXPAND, or line up at the START
> or END, or get spread EVEN)...

You can use widget halign/valign to do START and END right? Then Grid
never gets extra allocation.

The only case where Grid needs something "special" is if it does get
extra allocation, i.e. it is align=FILL.
In that case, if there are expand children, obviously extra allocation
should go to them.

If there are no expand children, then the two choices are to allocate
extra space evenly to the children, OR allocate extra space as spacing
between the children.

Allocating extra space "around" the children is redundant with setting
halign/valign on the grid so I think that is a pointless feature.

Allocating extra space evenly to the children I think is redundant
with setting expand=true on the children.

So the only thing that can't be done already is to allocate extra
spacing in between the children. You can then get any of the effects:

a) no expand=true children, grid align = FILL: extra allocation
becomes spacing between children
b) any expand=true children, grid align = FILL: extra allocation goes
to the expand=true children only
c) no expand=true children, grid align = START | CENTER | END: extra
allocation is spacing on one side or both sides of grid

If it works like GtkBox, then in case a) you just pretend it is case
b) with all children set to expand=true. This means:
 - there's no way to do a) anymore unless you add some special option
 - the behavior is illogical (widgets with expand=false expand anyway,
until you set one to expand=true then they don't?)

The simple obvious thing is: children expand only if they are expand=true.

Havoc


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