is the gateway between a collection of tiled
(graphics, dialog) and the Window System. Any displayed window has a
frame. The `window
method (invoked by
will create a default frame for a window if the window does not have a
Windows in a frame are controlled by a hierarchy of tile objects. The leaves of this hierarchy manage an individual window, while the non-leaf tiles either manages a left-to-right list of sub-tiles or a top-to-bottom list. A non-leaf horizontal (left-to-right) tile forces all windows to be as high as the highest wishes to be and distributes the horizontal space over the sub-tiles, while a vertical tile forces all members to the same (widest) member and distributes the vertical space.
A tile hierarchy is built using the methods `window
etc. described below. Each window is born with a leaf-tile. If two
windows are connected using
a horizontal tile is created. Any other window associated to the left or
right will be added as a member to this horizontal tile. A analogous
story applies to vertically stacked windows.
If a window or collection of windows is placed left of a vertical tiled stack of windows, a horizontal tile is created.
Whenever a window receives one of the
etc. messages, it will forward these messages to the root of the
associated tile hierarchy. Assuming both windows are not yet related,
the root tiles negotiate the alignment (combine, become member, create a
Suppose we want to realise the window layout shown in figure 16. Now, look for windows that have equal width or height. This is the starting point, W3 and W4 in this example. So, the first statement is:
send(W3, above, W4)
|Figure 16 : Demo window layout|
Note that `send(W4, below, W3)' is the same, except that if both W3 and W4 have a frame attached, the frame of the argument of the message will hold both windows, while the frame of the receiver is destroyed.
Now simply continue inwards-out:
send(W2, left, W3), send(W1, above, W2), send(W5, below, W2)
Note that `send(W2, left, W4)' is exactly the same as positioning W2 left of W3. The resulting tile hierarchy is shown in figure 17. The numbers indicate the order of creation of the various objects.
|Figure 17 : Tile hierarchy of example|
A tile defines six size parameters, described below.
The various built-in window types have the following defaults shown in table 7.
(1)If the dialog is not empty, the bounding box of the contents with
<-gap around it will be used.
(2)Interpreted as character units.
|Table 7 : The window types and their default sizes|
These rules will often suffice for simple applications. You may adjust the stretch and shrink parameters after creating the window, but before opening the window.
Windows may be added to an open frame using the
etc. message, specifying any of the member windows as argument. Windows
may be deleted from a frame using `frame
If a window is added or deleted from an open window, the message `frame
will be called to readjust the contents. This will normally change the
size of the frame. If this is not desired, class frame
must be sub-classed as below. Note that fixed_size should not be set to @on
before the frame is open.
:- pce_begin_class(my_dynamic_frame, frame, "Add fixed_size"). variable(fixed_size, bool := @off, both, "Do not resize on ->fit"). fit(F) :-> "Request to fit the contents":: ( get(F, fixed_size, @on) -> send(F, resize) ; send(F, send_super, fit) ).