1 CAPI Reference Entries

interface

Class

Summary

The classinterface is the top level window class, which contains both menus and a hierarchy of panes and layouts. Interfaces can also themselves be contained within a layout, in which case they appear without their menu bar.

Superclasses

simple-pane
titled-pane

Slots

title
The title of the interface.

layout
The layout of the interface.

menu-bar-items

The items on the menu bar.

destroy-callback

A callback done on closing the window.

confirm-destroy-function

A function to verify closing of the window.

best-x
The best x position for the interface.

best-y
The best y position for the interface.

best-width
The best width of the interface.

best-height
The best height of the interface.

Accessors

interface-title
pane-layout
interface-menu-bar-items
interface-destroy-callback
interface-confirm-destroy-function

Description

Every interface can have a title which when it is a top level interface is shown as a title on its window, and when it is contained within another layout is displayed as a decoration (see the classtitled-pane for more details).

The argumentlayout specifies a layout object that contains the children of the interface. To change this layout you can either use the writerpane-layout, or you can use the layoutswitchable-layout which allows you to easily switch the currently visible child.

The argumentmenu-bar-items specifies a list of menus to appear on the interface's menu bar. Note that an interface may have some automatic menus created by the environment in which it is running (for example the Works menu in the LispWorks environment). To switch these automatic menus off, specify the argument

:auto-menus nil 

When you have an instance of an interface, you can display it either as an ordinary window or as a dialog using respectivelydisplay anddisplay-dialog. Then to remove it from the display again, you usequit-interface and eitherexit-dialog orabort-dialog respectively. When the interface is about to be closed, the CAPI calls theconfirm-destroy-function (if there is one) with the interface, and if this function returns non-nil the interface is closed. Once the interface is closed, thedestroy-callback is called with the interface.

The interface also accepts a number of hints as to the size and position of the interface for when it is first displayed. The argumentsbest-x andbest-y must be the position as an integer ornil (meaning anywhere), while the argumentsbest-width andbest-height can be any hints accepted bymax-width andmax-height for elements.

Example

(capi:display (make-instance 'capi:interface
                             :title "Test Interface"))

(capi:display (make-instance 'capi:interface :title "Test Interface" :destroy-callback #'(lambda (interface) (capi:display-message "Quitting ~S" interface))))

(capi:display (make-instance 'capi:interface :title "Test Interface" :confirm-destroy-function #'(lambda (interface) (capi:confirm-yes-or-no "Really quit ~S" interface))))

(capi:display (make-instance 'capi:interface :menu-bar-items (list (make-instance 'capi:menu :title "Menu" :items '(1 2 3))) :title "Menu Test"))

(setq interface (capi:display (make-instance 'capi:interface :title "Test Interface" :layout (make-instance 'capi:simple-layout :description (make-instance 'capi:text-input-pane) ))))

(setf (capi:pane-layout interface) (make-instance 'capi:simple-layout :description (make-instance 'capi:editor-pane)))

(capi:display (make-instance 'capi:interface :title "Test" :best-x 200 :best-y 200 :best-width '(/ :screen-width 2) :best-height 300))

See Also

layout
switchable-layout
menu
display
display-dialog
quit-interface
define-interface
activate-pane


CAPI Reference Manual, Liquid Common Lisp Version 5.0 - 3 OCT 1997

Generated with Harlequin WebMaker