Re: Extended Layout Summary



Am Dienstag, den 20.11.2007, 15:41 -0500 schrieb Havoc Pennington:
> Hi,
> 
> While I haven't looked at the patches in detail, based on your writeup 
> it feels like the interfaces here will make it a little hard to 
> implement in widgets.
>
> [...]

I had your suggestion in mind all the time, when implementing the
extended layout stuff, but at least for the existing container widgets
in GTK+ calculating minimum and natural size at the same time would have
resulted in more complicated code, as many variables would have to be
duplicated: One set of variables to hold state for minimum size
calculation, one set for natural size.

So the pattern I successfully used was adding a flag to the old
size_request implementation indicating weither requested size, or
natural size is needed. In the requested size case only
gtk_widget_size_request is called for children, in the natural size case
the extended layout hints were tried first, with as fallback
gtk_widget_size_request. My implementations of
GtkWidgetClass::size_request and GtkExtendedLayoutIface::natural_size
just redirect to that function, using the correct flag.

After finding that pattern, adding natural size support to existing
container widgets was quite trivial.

> Another thing I'm not clear on from your mail is the padding stuff; 
> basically, it looks like every widget implements padding support for 
> itself. In that case, what's the point of having get_padding in the 
> generic extended layout interface?

I mainly needed it, when trying to implement baseline alignment for
GtkBin derived widgets: GtkBinClass doesn't have any padding for
additional virtual functions, so I abused the extended-layout interface
to get that information.

Guess it can be ignored for now, as I didn't manage to get baseline
alignment working - all tough using extended layout hints to add
padding to all widgets, without using GtkAlignment sounds quite
interesting. Well, and you are right: Using GtkBorder is quite wasteful
in terms of memory usage.

Ciao,
Mathias
-- 
Mathias Hasselmann <mathias hasselmann gmx de>
http://taschenorakel.de/

Attachment: signature.asc
Description: Dies ist ein digital signierter Nachrichtenteil



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