The example below uses three predefined panes, which need to be defined as follows:
(setq red-pane (make-instance 'output-pane
(setq green-pane (make-instance 'output-pane
(setq blue-pane (make-instance 'output-pane
A switchable layout allows you to place CAPI objects on top of one another and determine which object is displayed on top through Lisp code, possibly linked to a button or menu option through a callback. Switchable layouts are set up using a switchable-layout element in a
make-instance. As with the other layouts, such as column-layout and row-layout, the elements to be organized are listed in the
slot, initialized in this example by the
A tab-layout displays several tabs, and a single pane which contains the main contents.
In its simplest mode, a tab-layout is similar to a switchable layout, except that each pane is provided with a labelled tab, like the tabs on filing cabinet folders or address books. If the tab is clicked on by the user, the pane it is attached to is pulled to the front. Remember to close the switchable layout window created in the last example before displaying this:
However, a tab layout can also be used in a non-switchable manner, with each tab responding with a callback to alter the appearance of only one pane. In this mode the
:description keyword is used to describe the main layout of the tab pane. In the following example the tabs alter the choice of starting node for one graph pane, by using a callback to the
(tab-graph '(1 2 4 5 7))
If you need adjacent panes in a row or column to have a narrow user-movable divider between them, supply the special value
:divider in the
. The divider allows the user to resize one pane into the space of the other. To see this in the column layout below, grab the divider between the two panes and then drag it vertically to resize both panes:
Dividers and separators can also be placed between panes in a row-layout or even combinations of row and column layouts.
static-layout is a layout that simply places each of its children where the geometry specifies (
). The children can be moved and resized by
(setf static-layout-child-position) and
Your interface can have a toolbar which the user can configure by selecting and rearranging the buttons to display. To implement this, specify an interface toolbar as described in Adding Toolbars.
docking-layout allows docking/undocking of panes, which means interactively moving the panes between places in the interface (docking) and into standalone floating windows (undocking). The full functionality is available only on Microsoft Windows, while GTK+ gives very limited functionality. On Cocoa it is completely static. Docking layouts are especially useful for toolbars, but can contain other panes.
To allow moving a pane between different places in the interface, you need to group several docking-layouts. This done by using make-docking-layout-controller to create a controller object, and then passing the controller when making the docking-layout with the initarg
:controller. You then place each docking-layout in a different place in the interface, by including it in the layout hierarchy of the interface in the usual way, and then it is possible to interactively move panes between all the docking-layouts that share the controller.
The function docking-layout-pane-docked-p can be used to test whether a pane is docked in a specific docking-layout, and can be used with
cl:setf to programmatically dock a pane in a specific docking-layout or to undock it (to do this, dock it to
The function docking-layout-pane-visible-p can be used to test whether a pane is docked in one of the docking-layouts in the group of a docking-layout (that is, layouts with the same controller) or is undocked, and the docking-layout or the floating window is visible. It can be used with
cl:setf to change the visibility of the docking-layout (if the pane is docked) or the floating window (undocked).
In LispWorks for Windows, the CAPI supports MDI through the class document-frame. MDI is not supported on other platforms.
To use MDI in the CAPI, define an interface class that inherits from document-frame, and use the two special slots
capi:windows-menu as described below.
Interfaces of any type other than subclasses of document-frame may be added as children. To add a child interface in your MDI interface, call display on the child interface and pass the MDI interface as the
argument. This will display the child interface inside the container pane. To obtain a list of the child interfaces, call the screen reader function
screen-interfaces, passing the frame's document-container as the
capi:windows-menu contains the Windows Menu, which allows the user to manipulate child interfaces. The standard functionality of the Windows Menu is handled by the system and normally you will not need to modify it. However, you will want to specify its position in the menu bar. Do this by adding the symbol
capi:windows-menu in the
:menu-bar option of your define-interface form.
This example uses document-frame to create a primitive
capi:containeris used in the layout description.
capi:windows-menuis in the
CAPI User Guide and Reference Manual (Macintosh version) - 25 Feb 2015