Here are some examples of how to use the :panes and :layouts options of define-application-frame to describe the appearance of your application.
We begin by showing Figure 18., an example of how CLIM supplies a default layout when you don't explicitly specify one in your frame definition. The default layout is a single column of panes, in the order (top to bottom) that you specified them in the :panes option. Command menus are allocated only enough space to display their contents, while the remaining space is divided among the other types of panes equally.
(define-application-frame test () ()
(vertically () main test-menu listener)))
(("EXIT" :command cmd-exit)))))
Now we take the same example as before and in Figure 19. add an explicit :layout option to the frame definition. The pane named explanation occupies the bottom sixth of the screen. The remaining five-sixths are occupied by the demo and commands panes, which lie side by side, with the command pane to the right. The commands pane is only as wide as is needed to display the command menu.
Finally, here is a stripped-down version of the application frame definition for the CAD demo (in the file <release-directory>/demo/new-cad-demo.lisp ) which implements an extremely simplistic computer-aided logic circuit design tool.
There are four panes defined for the application. The pane named title displays the string "Mini-CAD" and serves to remind the user which application is running. The pane named menu provides a menu of commands for the application. The pane named design-area is the actual "work surface" of the application on which various objects (logic gates and wires) can be manipulated. A pane named documentation is provided to inform the user about what actions can be performed using the pointing device (typically the mouse) and is updated based on what object is currently being pointed to.
The application has two layouts, one named main and one named other . Both layouts have their panes arranged in vertical columns. At the top of both layouts is the title pane, which is of the smallest height necessary to display the title string "Mini-CAD." Both layouts have the documentation pane at the bottom.
The two layouts differ in the arrangement of the menu and design-area panes. In the layout named main , the menu pane appears just below the title pane and extends for the width of the screen. Its height will be computed so as to be sufficient to hold all the items in the menu. The design-area pane occupies the remaining screen real estate, extending from the bottom of the menu pane to the top of the documentation pane, and is as wide as the screen.
To see the layout named
(setf (frame-current-layout *application-frame*) :other)
. This differs from the
layout in the shape of the
pane. Here the implementor of the CAD demo realized that, depending on what was being designed, either a short, wide area or a narrower but taller area might be more appropriate. The
layout provides the narrower, taller alternative by rearranging the
panes to be side by side (forming a row of the two panes). The
panes occupy the space between the bottom of the
pane and the top of the
pane, with the
pane to the left and occupying as much width as is necessary to display all the items of the menu and the
occupying the remaining width.