All Manuals > CAPI Reference Manual > 1 CAPI Reference Entries

NextPrevUpTopContentsIndex

pinboard-layout

Class
Summary

The class pinboard-layout provides two very useful pieces of functionality for displaying CAPI windows. Firstly it is a subclass of static-layout and so it allows its children to be positioned anywhere within itself (like a pinboard). Secondly it supports pinboard-objects which are rectangular areas within the layout which have size and drawing functionality.

Package

capi

Superclasses

output-pane
static-layout

Subclasses

simple-pinboard-layout

Initargs

:highlight-style

A keyword.

Description

When a pinboard-layout lays out its children, it positions them at the x and y specified as hints (using :x and :y ), and sizes them to their minimum size (which can be specified using :visible-min-width and :visible-max-width ).

By default, the pinboard-layout is made sufficiently large to accomodate all of its children, as specified by fit-size-to-children in the superclass static-layout. Note that results in the pinboard resizing itself automatically when objects are added, moved or removed. If you need the sizing capabilities, then use the class simple-pinboard-layout which surrounds a single child, and adopts the size constraints of that child.

The pinboard layout handles the display of pinboard objects itself by calculating which objects are visible in the region that needs redrawing, and then by calling the generic function draw-pinboard-object on these objects in the order that they are specified in the layout description. This means that if two pinboard objects overlap, the later one in the layout description will be on top of the other one. In other words, the description defines the Z-order for objects of type pinboard-object. For information about controlling this order, see layout and manipulate-pinboard.

Note: objects of type simple-pane are drawn directly by the windowing system and cannot be clipped relative to pinboard-objects, which are drawn by CAPI. Therefore simple-panes always appear on top in a pinboard, and their position in the description does not affect the Z-order.

Highlighting of the layout's children by highlight-pinboard-object is controlled by the value of highlight-style , as follows:

:invert

Swaps the foreground and background colors.

:standard

Uses system colors.

:default

Calls draw-pinboard-object-highlighted.

The default value of highlight-style is :default .

Notes
  1. The output-pane initarg :drawing-mode controls quality of drawing in a pinboard-layout , including anti-aliasing of any text displayed on Microsoft Windows and GTK+.
  2. If redrawing flickers on Microsoft Windows or Motif, perhaps because there are many pinboard objects, you can pass the output-pane initarg :draw-with-buffer t , which uses a pixmap to buffer the output before drawing it to the screen. See output-pane for more information.
Example

Here are some examples of the use of pinboard objects with pinboard layouts.

(capi:contain 
 (make-instance
  'capi:pinboard-layout
  :description 
  (list
   (make-instance
    'capi:image-pinboard-object
    :image 
    (sys:lispworks-file 
     "examples/capi/graphics/Setup.bmp")
    :x 20 :y 20)))
 :best-width 540 :best-height 415)
(capi:contain 
 (make-instance
  'capi:pinboard-layout
  :description (list
                (make-instance
                 'capi:item-pinboard-object
                 :text "Hello"
                 :x 40 :y 10)
                (make-instance
                 'capi:line-pinboard-object
                 :x 10 :y 30
                 :visible-min-width 100)))
                :best-width 200 :best-height 200)

There are further examples in the directories examples/capi/applications/ and examples/capi/graphics/ .

This example illustrates use of draw-with-buffer t :

examples/capi/graphics/compositing-mode.lisp

See also

manipulate-pinboard
output-pane
pinboard-object
redraw-pinboard-object
static-layout


CAPI Reference Manual - 15 Dec 2011

NextPrevUpTopContentsIndex