All Manuals > CAPI User Guide and Reference Manual > 21 CAPI Reference Entries

NextPrevUpTopContentsIndex

drawn-pinboard-object

Class
Summary

The class drawn-pinboard-object is a subclass of pinboard-object which is drawn by a supplied function, and is provided as a means of the user creating their own pinboard objects.

Package

capi

Superclasses

pinboard-object

Initargs

:display-callback

Called to display the object.

Accessors

drawn-pinboard-object-display-callback

Description

The display-callback is called with the output pane to draw on, the drawn-pinboard-object itself, and the x , y , width and height of the object, and it is expected to redraw that section. The display-callback should not draw outside the object's bounds.

An alternative way of doing this is to create a subclass of pinboard-object and to provide a method for draw-pinboard-object.

Example
(defun draw-an-ellipse 
       (output-pane self x y width height)
       (let ((x-radius (floor width 2))
             (y-radius (floor height 2)))
              (gp:draw-ellipse output-pane
                (+ x x-radius) (+ y y-radius)
                x-radius y-radius
                :foreground :red
                :filled t)))
(capi:contain (make-instance 
                'capi:drawn-pinboard-object
                :visible-min-width 200
                :visible-min-height 100
                :display-callback 'draw-an-ellipse))

There are further examples in Self-contained examples.

See also

pinboard-layout
Creating Panes with Your Own Drawing and Input


CAPI User Guide and Reference Manual (Unix version) - 25 Feb 2015

NextPrevUpTopContentsIndex