1.3 The CAPI model

The CAPI provides an abstract hierarchy of classes which represent different sorts of window interface elements, along with functions for interacting with them. Instances of these classes represent window objects in an application, with their slots representing different aspects of the object, such as the text on a button, or the items on a menu. These instances are not actual window objects but provide a convenient representation of them for you. When you ask the CAPI to display your object, it creates a real window system object to represent it. This means that if you display a CAPI button, a real Windows button is created for it when running on Microsoft Windows, and a real Motif button when running on Motif, and a real Mac OS X button when running on Mac OS X.

A different approach would have been to simulate the window objects and their look and feel. This approach is problematic. Because the library makes itself entirely responsible for the application's look and feel, it may not simulate it correctly in obscure cases. Also, manufacturers occasionally change the look and feel of their window systems. Applications written with a library that simulates window objects will continue to have the old look and feel until the application is recompiled with an updated library.

The CAPI's approach makes the production of the screen objects the responsibility of the native window system, so it always produces the correct look and feel. Furthermore, the CAPI's use of the real interface to the window system means that it does not need to be upgraded to account for look and feel changes, and anything written with it is upwardly compatible, just like any well-written application.

1.3.1 CAPI Classes

LispWorks CAPI User Guide (Windows version) - 17 Mar 2008