Chapter 7 Defining a New Presentation Type

7.4 Advanced Topics

Material in this section is advanced; most CLIM programmers can skip this section entirely. The following constructs apply to defining presentation types, discussed in Section 7.2.

presentation-default-preprocessor [Presentation Method]

default type&key default-type
This method is responsible for taking the object default and coercing it to match the presentation type type (which is the type being accepted) and default-type (which is the presentation type of default). This is useful when you want to change the default gotten from the presentation type's history so that it conforms to parameters or options in type and default-type. The method returns two values, the new object to be used as the default, and a new presentation type, which should be at least as specific as type.

define-presentation-generic-function [Macro]
generic-function-name presentation-function-name lambda-list&rest options
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 the presentation type system knows about. The first argument in lambda-list must be either type-key or type-class; CLIM uses this argument 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 present presentation generic function might be defined thus:

        (define-presentation-generic-function present-method present 
          (type-key parameters options object type stream view 
                    &key acceptably for-context-type)) 
None of the arguments are evaluated.

define-default-presentation-method [Macro]
name qualifiers* specialized-lambda-list&body body
Like define-presentation-method, except that it is used to define a default method that will be used only if there are no more specific methods.

funcall-presentation-generic-function [Macro]
presentation-function-name&rest arguments
Calls the presentation generic function named by presentation-function-name on the arguments arguments. arguments must match the arguments specified by the define-presentation-generic-function that were used to define the presentation generic function, excluding the type-key, type-class, parameters, and options arguments, which are filled in by CLIM.

funcall-presentation-generic-function is analogous to funcall.

The presentation-function-name argument is not evaluated.

To call the present presentation generic function, one might use the following:

         present object presentation-type stream view) 
apply-presentation-generic-function [Macro]
presentation-function-name&rest arguments
Like funcall-presentation-generic-function, except that apply-presentation-generic-function is analogous to apply. The presentation-function-name argument is not evaluated.

CLIM 2.0 User's Guide - OCT 1998

Generated with Harlequin WebMaker