Here is a simple example of interface definition done with define-interface:
(define-interface demo ()
:text "Page Up")
:text "Page Down")
:text "Open File"))
'(page-up page-down open-file)))
(:default-initargs :title "Demo"))
An instance of this interface can be displayed as follows:
(display (make-instance 'demo))
At the moment the buttons do nothing, but they will eventually do the following:
Figure 10.1 A demonstration of a CAPI interface
Later on, we will specify callbacks for these buttons to provide this functionality.
(:default-initargs :title "Demo") part at the end is necessary to give the interface a title. If no title is given, the default name is "Untitled CAPI Interface".
Examine the define-interface form to see how this interface was built. The first part of this form is shown below:
The interesting part of the define-interface form occurs after these
defclass-like preliminaries, where it lists the elements that define the interface's appearance. Here is the
:panes part of the definition:
:panes list specifies panes that are made when the interface is made. However it does not specify which panes are displayed: that is controlled dynamically by the interface's layout which may contain all, some or none of the panes in the
:panes list. The interface may also display other panes that are made explicitly, though this is less common.
The interface information supplied in this section is a series of specifications for panes and layouts. It could also specify menus and a menu bar. In this case, three buttons are defined. The layout chosen is a row layout, which displays the buttons side by side at the top of the pane.
CAPI User Guide and Reference Manual (Macintosh version) - 3 Aug 2017