Next Prev Up Top Contents Index

interface

Class
Summary

The class interface 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-object

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 class titled-object for more details).

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

The argument menu-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 respectively display and display-dialog . Then to remove it from the display again, you use quit-interface and either exit-dialog or abort-dialog respectively. When the interface is about to be closed, the CAPI calls the confirm-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, the destroy-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 arguments best-x and best-y must be the position as an integer or nil (meaning anywhere), while the arguments best-width and best-height can be any hints accepted by visible-max-width and visible-max-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
                       (list (make-instance
                              'capi:text-input-pane))
                       ))
       :process nil))
(setf (capi:pane-layout interface)
      (make-instance
       'capi:simple-layout
       :description
       (list (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
titled-object


LispWorks CAPI Reference Manual - 14 Dec 2001

Next Prev Up Top Contents Index