Next Prev Up Top Contents Index

manipulate-pinboard

Generic Function
Summary

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

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.

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 :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)
       :process nil))

Add some pinboard-objects:

(dotimes (y 10)
  (let ((yy (* y 40)))
    (capi:manipulate-pinboard 
     pl 
     (make-instance 'capi:line-pinboard-object
                    :start-x 4  :start-y yy
                    :end-x 54   :end-y (+ 6 yy))
     :add-top)
    (capi:manipulate-pinboard 
     pl 
     (make-instance 'capi:pinboard-object 
                    :x 4  :y (+ 20 yy)
                    :width 50 :height 6
                    :graphics-args 
                    '(:background :red))
     :add-top)))

Remove some pinboard-objects:

(dotimes (y 15)
  (let ((po (capi:pinboard-object-at-position pl 
                                              10
                                              (* y 30))))
    (when po (capi:manipulate-pinboard pl 
                                       po 
                                       :delete))))

Remove all line-pinboard-object s:

(capi:manipulate-pinboard 
 pl 
 #'(lambda (x) 
     (typep x 'capi:line-pinboard-object)) 
 :delete-if)
See also

pinboard-layout


LispWorks CAPI Reference Manual - 13 Mar 2003

Next Prev Up Top Contents Index