[Y-devel] Widget size negotiation
Thomas spiralman at softhome.net
Wed Feb 25 02:29:10 GMT 2004
On Tuesday 24 February 2004 08:29, Lincoln Quirk wrote:
> Within each level of widget containment there should probably be an
> automatic sizing method with propagation. This way, you can resize
> windows, and everything inside the window will behave optimally in terms
> of the sizes.
In my opinion, you should be able to choose whether you want this behavior or
not. This is already implemented to a certain extent in GridLayout, and I
like this method. If you want your window to resize widgets, use a layout
that resizes, if not (for whatever reason) you can use something like a Panel
which would just let you place objects at locations and specify their size
statically.
> - There isn't enough space for all the widgets. In this case it reduces
> the size of some of them. I think that for each widget in the dimension
> in question, shrink it by an equal amount of pixels, until it reaches
> its minimum.
>
> - There's too much space. We have to decide which widgets to grow. I
> would grow whichever widget has the greatest preferred size (widgets
> with 'no preferred size' are considered greater than any other; also, if
> there are multiple widgets with the same greatest preferred size, grow
> them all equally).
>
My favorite way to do this is by specifying a stretch factor, where the
highest (or lowest) value gets the most space. ie, sort by stretch factor,
give the first widget its prefered size, then, if you need to, lower the size
of the next, etc.
this gives the programmer the most control over what gets space when if he/she
needs it, otherwise, they can ignore the option (by setting everything to the
same (defaulted?) stretch factor).
Thomas Stephens
spiralman at softhome.net
More information about the Y-devel mailing list
2026 © www.Y-Windows.Org - All Rights Reserved