1 CAPI Reference Entries
titled-pane
gp:graphics-port-mixin
pinboard-layout
editor-pane
display-callback
A function that knows how to redisplay the pane.
input-model
scroll-callback
A function called when the user scrolls the pane.
output-pane-display-callback
output-pane-scroll-callback
output-pane-input-model
output-pane
is a subclass ofgp:graphics-port-mixin
which means that it supports many of the graphics ports drawing operations. When the CAPI needs to redisplay a region of the output pane, thedisplay-callback
gets called with theoutput-pane
and the x, y, width and height of the region that needs redrawing, and the callback should then use graphics port operations to redisplay that area. To force an area to be redisplayed, use the functiongp:invalidate-rectangle
.
input-model
provides a means to get callbacks on mouse and keyboard gestures. Aninput-model
is a list of mappings from gesture to callback, where each mapping is a list of a gesture and a callback and optional arguments to be passed to the callback. The gesture itself is a list specifying the type of gesture, which can be a button, key, character or motion gesture, along with optional arguments specifying keyboard modifiers (:shift
,:control
and:meta
) and actions associated with the gesture (:press
,:release
,:second-press
and:motion
). These options can be specified in any order, and if the list is only one item long then the gesture can be specified as just the item itself.
:button-1
,:button-2
or:button-3
) along with an optional action (one of:press
,:release
,:second-press
or:motion
) and zero or more keyboard modifiers.
:key
meaning any key) along with an optional action (one of:press
or:release
) and zero or more keyboard modifiers.
:character
meaning any character.
:motion
), or it can be defined for motions whilst no button is down by just specifying the keyword:motion
with no additional arguments.
input-model
also accepts a command instead of a gesture, where a command is defined usingdefine-command
, and provides an alias for a gesture.
scroll-callback
with theoutput-pane
and the new x and y coordinates of the top-left hand corner of the visible part of the output pane. This callback is for information only, as scrolling and redrawing any exposed areas will be handled by calls to thedisplay-callback
.
(defun display-circle (self x y width height) (declare (ignore x y width height)) (gp:draw-circle self 200 200 200 :filled t)) (capi:contain (make-instance 'capi:output-pane :display-callback 'display-circle) :best-width 200 :best-height 200)
(defun test-callback (self x y) (capi:display-message "Pressed button 1 at (~S,~S) in ~S" x y self)) (capi:contain (make-instance 'capi:output-pane :title "Press button 1:" :input-model `(((:button-1 :press) test-callback))) :best-width 200 :best-height 200)
(defun draw-character (self x y character) (gp:draw-character self character x y)) (capi:contain (make-instance 'capi:output-pane :title "Press keys in the pane..." :input-model '((:character draw-character))) :best-width 200 :best-height 200)
(capi:contain (make-instance 'capi:output-pane :title "Drag button-1 across this pane:" :input-model '(((:motion :button-1) gp:draw-point))) :best-width 200 :best-height 200)
capi/elements/output-pane.lisp
define-command
pinboard-object
Generated with Harlequin WebMaker