Re: Size of widget



Fredrik Rambris <fredrik rambris com> writes:

How do I get the current size of a widget? (Like a GtkFixed).

Look at widget->allocation.width, widget->allocation.height. Typically
this is broken though; what you really want to do in most cases is
track the size of the widget, by connecting to the size_allocate
signal and doing any actions that depend on widget size in the signal
handler, so that you automatically adapt to widget resize. (There are
exceptions, e.g. in a draw/expose_event handler you can just use
current widget->allocation, since resizing will generally trigger a
redraw anyhow).

Also. Anyone know of a containerwidget that wraps the children kindof
like a wordprocessor does with the words? Like icons in gmc but it
should be any widgets.


On the gtk/gnome CVS server (see 'getting GNOME' on www.gnome.org), 
the file beast/beast-gtk/glewidgets.h and beast/beast-gtk/glewidgets.c
contain a GtkWrapBox that might be useful. It isn't quite like gmc
though.

We're considering adding this widget to GTK, but I'm kind of wondering
what it's good for - would you mind briefly explaining what your app
would use it for?

Havoc




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