A pinboard-object that draws itself as an arrow, which can switch dynamically from double-headed to single-headed.
double-head-predicate should be a function of two arguments returning a boolean value. The first argument is the output pane on which the arrow pinboard object is drawn. The second argument is the arrow pinboard object itself.
double-head-predicate
should return a true value if the arrow is to be double-headed, and nil
if a single-headed arrow should be drawn. It is called each time the arrow object is redrawn.
(defvar *doublep* t)
(let ((dhr
(capi:contain
(make-instance
'capi:pinboard-layout
:description
(list
(make-instance
'capi:double-headed-arrow-pinboard-object
:double-head-predicate
#'(lambda (x y) *doublep*)
:start-x 5 :start-y 5 :end-x 95 :end-y 95)
(make-instance
'capi:double-headed-arrow-pinboard-object
:double-head-predicate
#'(lambda (x y) *doublep*)
:head-direction :backwards
:start-x 5 :start-y 95 :end-x 95 :end-y 5)))
:visible-min-width 100
:visible-min-height 100)))
(dotimes (x 10)
(sleep 1)
(setq *doublep* (not *doublep*))
(mapcar 'capi:redraw-pinboard-object
(capi:layout-description dhr))))
CAPI User Guide and Reference Manual (Unix version) - 25 Feb 2015