Re: GtkPaned vs. GtkBox



Owen Taylor wrote:
> 
> Fritz Jetzek <fritz.jetzek@i-dmedia.com> writes:
> 
> > Karl Nelson wrote:
> > >
> A clean patch to add n-child operation to GtkPaned would have a good
> chance of being accepted; I tend to think that greater-than-two-way
> separations are rather confusing to the user, but they are occasionally
> useful. (One would have been useful in memprof program.)
> 
> The reason why the two parameters for GtkPaned (resize and shrink)
> are not the same as the parameters for GtkBox (expand and fill)
> is that the environments are quite different; for example:
> 
>  - A GtkPaned widget has to maintain the size set by the user in
>    some fashion when resized to a different size
>  - It makes no sense to have fill = FALSE for a GtkPaned: why
>    would the user want to make a partition bigger simply
>    to add white space around a widget?
> 
> However, the resize and shrink parameters do extend pretty logically
> to greater than 2 panes.
> 
> (Also, note that GtkPaned has been rewritten quite a bit now for
> GTK+-1.3 to allow dragging anywhere along the length of the
> separator. Making patches against the GTK+-1.2 GtkPaned would
> not be particularly useful at this point.)
> 
> Regards,
>                                         Owen

Ok, I couldn't resist being lazy and, instead of hacking the GtkPaned
structure directly, created a generic gtk_paned_pack function around the
existing pack1 and pack2 funcs.

This has the following disadvantages:

a) The generic function is ineffective; it would be faster if the
GtkPaned structure would by itself allow an arbitrary number of children
b) The function makes use of the gtk_widget_reparent function which is
not actually recommended as I understand from the GTK FAQ
c) It is based on GTK+ 1.2.7 in spite the fact that the GtkPaned widget
underwent changes since then

... and advantages:

a) People can continue to use the old pack1 and pack2 functions
b) The old functions can even be intermingled with the generic pack
function (i.e. use pack1, then pack; using pack1 after pack will
generate a GTK warning)

Please take a look at the attached code snippet that packs a bunch of
buttons in a GtkPaned widget.

I didn't care to stick to the GTK+ coding style as I wouldn't actually
propose this function to go into the library; just take a look at it and
tell me what you think.

Thanks,

Fritz

paned.c.gz



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