[Y-devel] Widget size negotiation
Chris Amshey ychris at amshey.net
Wed Feb 25 03:22:54 GMT 2004
On Tue, Feb 24, 2004 at 08:29:52PM -0500, Lincoln Quirk wrote:
> First, each widget should have no maximum size: it should be able to
> look reasonably correct with any amount of extra space that it's given.
This is in direct contradiction to the original design, which said that
a widget could have a maximum size, and if it did, a layout would simply
pad it. I prefer that model, as it has only one practical difference, which
is that the layout does the padding in some situations, rather than the
widget doing the padding. In the end, this will reduce calculations for
the same effect.
A layout widget should probably never have a maximum size, however,
as it should be doing the padding, and any layout widget should be able
to be the top layout widget.
> Here's my vision of negotiation: When a 'top-level' widget (that is, one
> that doesn't have a negotiated size) changes size, it asks its
> subwidgets for their minimum and preferred sizes. It first tries to give
> each subwidget its preferred size. There are a few things that can
> happen at this point:
I think here, this should be when the window changes size, or the
client requests a renegotiate, or a widget is added to the
layout.
> The problem with this approach, as I see it, is that there's no
> automatic way to change the sizes of widgets in a configuration that is
> already negotiated. That is, if there's a text box, and it decides to
> change its minimum size for whatever reason, it's hard to automatically
> do that and have it propagate upwards.
Renegotiation on widget preference changes will lead to horrible interface
difficulties, with buttons and such shifting around all the time...
I think, renegotiate only on client request.
Food for thought:
Should layouts even be widgets?
Looking over what I'm saying - widgets can have a maximum size, layouts
never should. Changes to widgets should not cause renegotiation, but
changes to a layout should. Layouts can contain layouts or widgets, but
can non-layout widgets contain anything?
OTOH, from an application programmer's point of view, the more functionality
group in the same fundamental type, the easier the learning curve. Ie, if
it doesn't gain us anything real in performance or capabability, we should
not make arbitrary distinctions that make the application programmer's job
harder.
--Chris
More information about the Y-devel mailing list
2026 © www.Y-Windows.Org - All Rights Reserved