Re: stretch factors in GTK+ 2.0



On Sun, Dec 01, 2002 at 02:08:32AM -0500, John K Luebs wrote: 
The reason I need this (although I think it might be nice to have in
general) is that I want to have an HBox with three items where the
middle item is always centered within the entire box. By setting the
stretch factor of the first and last items to 1 the middle item will
always be centered because the two side items will be EXPANDED to the
same size.


There are probably several ways, someone already suggested the table,
another way to do it is to use GtkSizeGroup to force the two side
items to be the same size.

It'd probably be simple as well to write a GtkBox subclass that takes
stretch factors for each child; all you have to do for this type of
widget is write size_request and size_allocate (look at gtkvbox.c for
an example).

Havoc




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