Resizing child windows
Glynn Clements
glynn at gclements.plus.com
Thu Aug 30 23:01:34 PDT 2007
matthew.garman at gmail.com wrote:
> If I have a parent window with one or more child windows, and the
> parent window's size is changed (either by the user, due to
> application design/behavior, whatever), what's the typical generic
> method of making sure the children get updated accordingly?
>
> E.g., how do widget toolkits based on X11 (gtk, qt, etc) tell child
> widgets to resize?
>
> I'm not looking for exact code, just a general idea.
>
> I looked through the gtk/gdk sources a bit... it looks like there is
> some kind of queueing going on with size requests and actual size
> allocations... but it wasn't clear to me where these requests are
> first routed, and the path they take through the window hierarhcy.
> Also the queueing/event mechanism wasn't obvious (at a glance
> anyway).
Each container widget has a layout policy which determines the
position and size of each child widget given the size of the
container. The layout policy may have various per-child settings
and/or may ask the child to specify its preferred, minimum and/or
maximum sizes.
The layout policy may be tied to a particular type of container, or
there may be distinct "geometry manager" (aka layout, packer) objects
which are associated with a container.
You should read the documentation for a specific toolkit to determine
how that toolkit handles layout.
--
Glynn Clements <glynn at gclements.plus.com>
More information about the xorg
mailing list