Adds or removes one or more
pinboard-object
s on a pinboard.
A pinboard-object to be added, or (with
action
:add-many
) a list of pinboard-objects to be added.
With
action
:delete-if
,
pinboard-object
can also be a function of one argument, for multiple deletion.
One of
:add
,
:add-top
,
:add-bottom
,
:add-many
or
:delete
. Can also be
:delete-if
, for multiple deletion.
One of
:top
or
:bottom
, or a non-negative integer.
The generic function
manipulate-pinboard
adds
pinboard-object
to
pinboard-layout
, or removes one or more pinboard-objects from
pinboard-layout
. These operations can also be effected using
(setf layout-description)
, but
manipulate-pinboard
is much more efficient and produces a better display.
If
action
is
:add
, then the
pinboard-object
pinboard-object
is added according to the value of
position
:
On top of the other pinboard objects.
Below the other pinboard objects.
At index
position
in the sequence of pinboard objects, where 0 is the index of the topmost pinboard object. Values of
position
greater than the number of pinboard objects are interpreted as
:bottom
.
action
:add-top
is the same as passing
action
:add
and
position
:top
.
action
:add-bottom
is the same as passing
action
:add
and
position
:bottom
.
action
:add-many
is like calling the function with
action
:add
several times, but is more efficient. The value of
pinboard-object
must be a list of pinboard-objects, each of which is added at the specified
position
, as for
:add
.
action
:delete
deletes the
pinboard-object pinboard-object
from
pinboard-layout
.
When
action
is
:delete-if
,
pinboard-object
should be a function which takes one argument, a pinboard-object. This function is applied to each pinboard-object in
pinboard-layout
and each object for which it returns true is deleted from
pinboard-layout
.
Note: you can control automatic resizing of pinboard-object using set-object-automatic-resize.
(setq pl
(capi:contain
(make-instance 'capi:pinboard-layout
:visible-min-height 500
:visible-min-width 200)))
(capi:apply-in-pane-process
pl #'(lambda (pp)
(dotimes (y 10)
(let ((yy (* y 40)))
(capi:manipulate-pinboard
pp
(make-instance 'capi:line-pinboard-object
:start-x 4 :start-y yy
:end-x 54 :end-y (+ 6 yy))
:add-top)
(capi:manipulate-pinboard
pp
(make-instance 'capi:pinboard-object
:x 4 :y (+ 20 yy)
:width 50 :height 6
:graphics-args
'(:background :red))
:add-top))))
pl)
Remove some
pinboard-object
s:
(capi:apply-in-pane-process
pl
#'(lambda (pp)
(dotimes (y 15)
(let ((po (capi:pinboard-object-at-position pp
10
(* y 30))))
(when po (capi:manipulate-pinboard pp
po
:delete)))))
pl)
Remove all
line-pinboard-object
s:
(capi:apply-in-pane-process
pl 'capi:manipulate-pinboard pl
#'(lambda (x)
(typep x 'capi:line-pinboard-object))
:delete-if)