Package: gtk

Function gtk-widget-get-allocation

Lambda List

gtk-widget-get-allocation (widget)


widget -- a gtk-widget object

Return Value

A gdk-rectangle structure.


Retrieves the widget's allocation.

Note, when implementing a gtk-container: a widget's allocation will be its "adjusted" allocation, that is, the widget's parent container typically calls the function gtk-widget-size-allocate with an allocation, and that allocation is then adjusted, to handle margin and alignment for example, before assignment to the widget. gtk-widget-get-allocation returns the adjusted allocation that was actually assigned to the widget. The adjusted allocation is guaranteed to be completely contained within the gtk-widget-size-allocate allocation, however. So a gtk-container is guaranteed that its children stay inside the assigned bounds, but not that they have exactly the bounds the container assigned. There is no way to get the original allocation assigned by the function gtk-widget-size-allocate, since it is not stored; if a container implementation needs that information it will have to track it itself.

In the Lisp binding to GTK+ this function does not return an allocation of type GtkAllocation, but the type is gdk-recangle. In the C implementation GtkAllocation is a synonym for gdk-rectangle.

Since 2.18

See also