9 Creating Your Own Panes

9.3 Creating graphical objects

A common feature needed by an application is to have a number of objects displayed in a window and to make events affect the object underneath the cursor. The CAPI provides the ability to create graphical objects, to place them into a window at a specified size and position, and to display them as necessary. Also a function is provided to determine which object is under any given point so that events can be dispatched correctly.

These graphical objects are called pinboard objects, as they can only be displayed if they are contained within apinboard-layout. To define a pinboard-object, you define a subclass ofdrawn-pinboard-object and specify a drawing routine for it (and you can also specify constraints on the size of your object). You can then make instances of these objects and place them into layouts just as if they were ordinary panes. You can also place these objects inside layouts as long as there is a pinboard-layout higher up the layout hierarchy that contains the panes.

Here is an example of the built-in pinboard object class item-pinboard-object which displays its text like a title-pane. Note that the function contain always creates a pinboard-layout as part of the wrapper for the object to be contained, and so it is possible to contain pinboard-objects in just the same way as you can contain other classes of CAPI object.

(contain
 (make-instance
  'item-pinboard-object
  :text "Hello world"))

Figure 9.4 A pinboard object

9.3.1 - The implementation of graph panes
9.3.2 - An example pinboard object

CAPI User Guide, Liquid Common Lisp Version 5.0 - 2 OCT 1997

Generated with Harlequin WebMaker