Page 210 Table of Contents Index Page 212
Chapters
1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30
A, B, C, D, E



CHAPTER 23. PRESENTATION TYPES


 (define-presentation-type num ())

 (define-presentation-method presentation-typep (object (type num))
   (numberp object))
If the user were to evaluate the form (presentation-typep X '(int 1 5)), then the type
parameters will be (1 5) in the presentation-typep method for int, (5 1) in the method for
rrat, and nil in the method for num. The value for type will be or ((int 1 5)) in each of the
methods.

=> define-presentation-generic-function generic-function-name presentation-function-name lambda-
list
&rest options [Macro]
Defines a generic function that will be used for presentation methods. generic-function-name is
a symbol that names the generic function that will be used internally by CLIM for the individual
methods, presentation-function-name is a symbol that names the function that programmers will
call to invoke the method, and lambda-list and options are as for defgeneric.

There are some "special" arguments in lambda-list that are known about by the presentation
type system. The first argument in lambda-list must be either type-key or type-class; this
argument is used by CLIM to implement method dispatching. The second argument may be
parameters, meaning that, when the method is invoked, the type parameters will be passed to
it. The third argument may be options, meaning that, when the method is invoked, the type
options will be passed to it. Finally, an argument named type must be included in lambda-list;
when the method is called, type argument will be bound to the presentation type specifier.

For example, the accept presentation generic function might be defined as follows:
 
 (define-presentation-generic-function present-method present
     (type-key parameters options object type stream view
      &key acceptably for-context-type))
None of the arguments is evaluated.

=> define-presentation-method name qualifiers* specialized-lambda-list &body body [Macro]
Defines a presentation method for the function named name on the presentation type named in
specialized-lambda-list. specialized-lambda-list is a CLOS specialized lambda list for the method,
and its contents varies depending on what name is. qualifiers* is zero or more of the usual
CLOS method qualifier symbols. define-presentation-method must support at least standard
method combination (and therefore the :before, :after, and :around method qualifiers). Some
CLIM implementations may support other method combination types, but this is not required.

body defines the body of the method. body may have zero or more declarations as its first forms.

All presentation methods have an argument named type that must be specialized with the name
of a presentation type. The value of type is a presentation type specifier, which can be for a
subtype that inherited the method.


Page 210 Table of Contents Index Page 212
Chapters
1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30
A, B, C, D, E