Re: [gtk-list] Re: Intended behaviour of gtk_box_pack_{start,end}?




On Tue, 22 Sep 1998, Ted Lemon wrote:
> 
> The reason for doing this is that the contents of the box aren't
> static - they're dynamic.  As an adjustment object is adjusted,
> widgets are created and destroyed on the fly.  This is rather clumsy,
> but the alternative is to have a box with an arbitrary number of
> elements - however many are present in the database - and this is
> even more clumsy, since I don't want to restrict the size of table my
> application can display.
>

Gtk is in general very clumsy if you want to dynamically rearrange the
widgets. I have done dynamically changing table, box, menu, notebook, and
they are all annoying. Something to work on when we're bored. 

The infrastructure is basically there to do dynamic stuff, and everything
is possible and works, it's just that the API and widgets aren't
necessarily designed with it in mind.

I have a horrible hack (in C++) of GtkTable that would do what you want. 
Basically it's a dynamic table; but it has to do inserts by removing all
the widgets to one side of the insert and reattaching them, which works in
practice but is way lame, since the table could do this internally with a
fast memcpy. 
 
> Would it be considered useful if I added some box primitives that
> supported adding widgets at the beginning and end of the box, as
> opposed to in two insertion-ordered classes with different affinities?
> 

I would consider it useful; it might be better to do a new widget though.
I think a dynamic version of GtkTable would basically do what you need; it
can have only a single column or row so it also works like a box.

In the dynamic case the widgets have to be interchangeable, so you can
just have row, column cell coordinates rather than all four attachment
points. I might get around to translating my C++ hack into a nice C widget
eventually but no time just now.

> Also, I'd like to be able to say "put all the padding at the end (or
> beginning) of the box, and don't space the widgets out to fill it."
> Is that possible now, and if not, would it be considered a useful
> addition?
> 

You basically get this if you set expand to false and use either pack_end
or pack_start exclusively. You could also just stick in a padding widget,
or pack the box into another box with expand set to false. 

Also on my dynamic-friendly wishlist:

 - freeze/thaw as a GtkContainer function
 - Menu, Notebook could have a function:
   gtk_*_set_empty_message(const gchar* message);
   which gives a message to display in a label if there are no pages 
   or menu items, since the dynamic changes can leave them empty.

Havoc






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