Defines an alias for a mouse or keyboard gesture that can be used in the input model of an output pane.
A unique Lisp object.
A valid input model gesture.
Alias for library, for backwards compatibility.
Specifies for which library this mapping is applicable. See <new section above about libraries> for which libraries are applicable. By default the mapping is applicable to all libraries.
define-command defines an alias for an input gesture that can then be used in output-pane's input models.
is the name of the alias, which should be a symbol.
is one of the gestures accepted by output-pane. For a full description of the gesture syntax and arguments for the callback, see Detailed description of the input model. It is possible to specify multiple gestures by passing as
a list of the form
is supplied it needs to be a function that takes the same arguments that a callback for the gesture would take (not including the
), and returns a list which is used after
instead of the gesture callback arguments. When there is a
, the callbacks for commands in the models are invoked by:
(apply callback pane
(append (apply translator gesture-callback-args)
specifies which library this mapping is applicable to. It is possible to have distinct definitions for different libraries, but redefinition with the same library overrides the previous definition. The default value of
nil, which means all libraries.
Firstly, here is an example of defining a command which maps onto a gesture.
(defun gesture-callback (output-pane x y)
"Pressed ~S at (~S,~S)"
output-pane x y))
(capi:define-command :select (:button-1 :press))
Here is a more complicated example demonstrating the use of
to affect the arguments passed to a callback.
:select-object (:button-1 :press)
:translator #'(lambda (output-pane x y)
output-pane x y)))
(defun object-select-callback (output-pane
(when object (capi:display-message
"Pressed on ~S in ~S"
:text "Press Me!"
:x 10 :y 20)
:start-x 20 :start-y 50
:end-x 120 :end-y 150)
Here is a further example:
CAPI User Guide and Reference Manual (Macintosh version) - 25 Feb 2015