A command table maintains a database of presentation translators. A presentation translator translates from its from-presentation-type to its to-presentation-type when its associated gesture (e.g., clicking a mouse button) is input. A presentation translator is triggered when its to-presentation-type matches the input context and its from-presentation-type matches the presentation type of the displayed presentation (the appearance of one of your application's objects on the display) on which the gesture is performed.
define-presentation-to-command-translator can be used to associate a presentation and a gesture with a command to be performed on the object which the presentation represents.
Translators can also be used to translate from an object of one type to an object of another type based on context. For example, consider a computer-aided design system for electrical circuits. You might have a translator that translates from a resistor object to the numeric value of its resistance. When asked to enter a resistance (as an argument to a command or for some other query), the user could click on the presentation of a resistor.
Here are some utilities for maintaining presentation translators in command tables. See 6.1, Conceptual Overview of CLIM Presentation Types for a discussion of the facilities supporting the mouse translator interaction style.
add-presentation-translator-to-command-table [Function]
Arguments: command-table translator-name
&key
(errorp
t
)
Summary: Adds the translator named by translator-name to command-table . The translator must have been previously defined with define-presentation-translator or define-presentation-to-command-translator . command-table is a command table designator.
If translator-name is already present in command-table and errorp is t , then the command-already-present error will be signaled. When the translator is already present and errorp is nil , the old translator will first be removed.
remove-presentation-translator-from-command-table [Function]
Arguments: command-table translator-name
&key
(errorp
t
)
Summary: Removes the translator named by translator-name from command-table . command-table is a command table designator.
If the translator is not present in the command table and errorp is t , then the command-not-present error will be signaled.
map-over-command-table-translators [Function]
Arguments: function command-table
&key
(inherited
t
)
Summary: Applies function to all of the translators accessible in command-table . function must be a function of one argument, the translator; it has dynamic extent. command-table is a command table designator.
If inherited is nil , this applies function only to those translators present in command-table , that is, it does not map over any inherited command tables. If inherited is t , then the inherited command tables are traversed in the same order as for do-command-table-inheritance .
find-presentation-translator [Function]
Arguments: translator-name command-table
&key
(errorp
t
)
Summary: Given a translator name and a command table, returns two values, the presentation translator and the command table in which it was found. If the translator is not present in command-table and errorp is t , then the command-not-accessible error will be signaled. command-table is a command table designator.