Adds or removes one or more pinboard-objects on a pinboard.
capi
manipulate-pinboard pinboard-layout pinboard-object action &key position
| pinboard-layout⇩ | |
| pinboard-object⇩ |
A pinboard-object to be added, or (with action :add-many) a list of pinboard-objects to be added, or (with action :delete-if) a function of one argument, for multiple deletion. |
| action⇩ |
One of :add, :add-top, :add-bottom, :add-many or :delete. Can also be :delete-if, for multiple deletion. |
| position⇩ |
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:
:top |
On top of the other pinboard objects. |
:bottom |
Below the other pinboard objects. |
| An integer |
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.
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)))
Add some pinboard-objects:
(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-objects:
(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-objects:
(capi:apply-in-pane-process
pl 'capi:manipulate-pinboard pl
#'(lambda (x)
(typep x 'capi:line-pinboard-object))
:delete-if)
CAPI User Guide and Reference Manual (Unix version) - 18 Feb 2025 15:34:22