Next Prev Up Top Contents Index

7.1 Conceptual Overview of Defining a New Presentation Type

CLIM's standard set of presentation types will be useful in many cases, but most applications will need customized presentation types to represent the objects modeled in the application.

In defining a presentation type, you define all the user interface components of the entity:

A displayed representation, for example, textual or graphical

Pointer sensitivity for user input via the pointer

A textual representation for user input via the keyboard (optional)

In other words, in one place you provide all the information about an object necessary to display it to the user and to accept it as input from the user.

The set of presentation types forms a type lattice, an extension of the Common Lisp CLOS type lattice. When a new presentation type is defined as a subtype of another presentation type, it inherits all the attributes of the supertype except those explicitly overridden in the definition.

To define a new presentation type, you follow these steps:

Use the define-presentation-type macro.

Name the new presentation type.

Supply parameters that further restrict the type (if appropriate).

Supply options that affect the appearance of the type (if appropriate).

State the supertypes of this type, to make use of inheritance (if appropriate).

  1. Define the CLIM presentation methods.

Specify how objects are displayed with a present presentation method. (You must define a present method, unless the new presentation type inherits a method that is appropriate for it.)

Specify how objects are parsed with an accept presentation method. (In most cases, you must define an accept method, unless the new presentation type inherits a method that is appropriate for it. If it will never be necessary to enter the object by typing its representation on the keyboard, you don't need to provide this method.)

Specify the type/subtype relationships of this type and its related types, if necessary, with presentation-typep and presentation-subtypep presentation methods. (You must define or inherit these methods when defining a presentation type that has parameters.)

7.1.1 CLIM Presentation Type Inheritance

7.1.2 Defining an Accept for a Structure With Several Fields


CommonLisp Interface Manager 2.0 User's Guide - 8 Aug 2003

Next Prev Up Top Contents Index