All Manuals > CAPI User Guide and Reference Manual


10 Defining Interface Classes - top level windows

Interface classes (subclasses of interface) are (mainly) used to define top level windows and the components inside them. Normally, each kind of a window in an application is specified by a different interface class. Complex dialogs are also typically presented using an interface class.

An interface class can also be used to create a component made of several elements. This is especially useful when these elements need to interact, because the syntax of define-interface makes it easier to refer to elements in the interface. To distinguish between this usage and the more typical case where an interface instance corresponds to a window, the latter case is referred to as a "top level interface" (also "top level window"). The parent of a top level interface is a screen (or document-container inside MDI on Microsoft Windows) rather than another pane.

An interface class is defined by the macro define-interface (normally, cl:defclass inheriting from an interface class works too). define-interface is an extension of cl:defclass with additional options for specifying display elements. After an interface class is defined it can be used to display a window or a dialog by calling display or display-dialog on an instance of it. For example:

(capi:define-interface my-interface ()
  (:panes (my-display-pane capi:display-pane :text "Some text"))
  (:default-initargs :title "My title"))
(capi:display (make-instance 'my-interface))

10.1 The define-interface macro

10.2 An example interface

10.3 Adapting the example

10.4 Connecting an interface to an application

10.5 Controlling the appearance of the top level window

10.6 Querying and modifying interface geometry

CAPI User Guide and Reference Manual (Windows version) - 25 Feb 2015