NextPrevUpTopContentsIndex

manipulate-pinboard

Generic Function
Summary

Adds a pinboard-object to a pinboard, or removes objects.

Package

capi

Signature

manipulate-pinboard pinboard-layout pinboard-object
action &key position

Arguments

pinboard-layout

A pinboard-layout.

pinboard-object

A pinboard-object. Can also be a function of one argument, for multiple deletion or a list for multiple addition.

action

One of :add , :add-top , :add-bottom , or :delete . Can also be :delete-if , for multiple deletion.

position

One of :top or :bottom , or a non-negative integer.

Description

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

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 .

Example
(setq pl 
      (capi:contain 
       (make-instance 'capi:pinboard-layout
                      :visible-min-height 500
                      :visible-min-width 200)))

Add some pinboard-object s:

(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)
See also

pinboard-layout


LispWorks CAPI Reference Manual - 25 Jul 2006

NextPrevUpTopContentsIndex