2 Bitmaps, Viewports, and Windows

2.3 The viewport hierarchy

The Window Tool Kit allows you to modify the viewport hierarchy. A hierarchy is like a family tree, so terms like parent and child are used to describe specific relationships between viewports and windows. Any viewport or window can be the child or single parent of any other viewport or window, with the exception of the root viewport. The root viewport is by default the parent of any viewport or window that does not have another viewport or window as its parent, but the root viewport cannot be any viewport's or window's child.

The Editor's Main Buffer is a child of the root viewport. If you invoke the Editor, this window is part of the viewport hierarchy. To see the children of the root viewport, use the function viewport-children:

(viewport-children (root-viewport))
To find out who the parent of any viewport or window is, use the function viewport-parent:

(viewport-parent *window*)
Children belong to their parent viewport or window. Children of viewports or windows are not visible unless they are located within their parent's screen clipping region. Children always occlude their parent; a parent never occludes its children. If a window is activated, its ancestors are also activated (its children may be, as well; see the reference page for activate-viewport). If a window is deactivated, its children are also deactivated. If a window that has deactivated ancestors is reactivated, the ancestors are also reactivated.

When a parent has more than one child, as the root viewport often does, the order of the parent's children, or the sibling stack, controls how the siblings overlap or occlude each other on the screen. Viewports or windows near the top of the stack occlude viewports or windows that are lower on the stack. A viewport or window can be moved to the top or bottom of the sibling stack by using the functions expose-viewport and hide-viewport.

The following example creates two overlapping windows and makes one the child of the other:

(setq *parent1*
      (make-window :width 100 :height 100 :title "parent1"))

(setq *child1* (make-window :width 60 :height 50 :y 50 :title "child1" :parent *parent1*))

The window*child1* is a child of*parent1*.

2.3.1 - Changing a parent-child relationship
2.3.2 - Rules for viewport or window occlusion

The Window Tool Kit - 9 SEP 1996

Generated with Harlequin WebMaker