| Allegro CL version 10.0 Unrevised from 9.0 to 10.0. 9.0 version |
A non-instantiable class that can be mixed with the grid-column
class to create grid
columns whose cells draw pixmaps that represent user values. Each cell
in the column will display a pixmap if the row of that cell is an
instance of a grid-row
subclass that mixes in the widget-row-mixin
class.
To ensure that this mixin class' methods take precedence over other
methods that specialize on grid-column
, this mixin class generally should
appear first in a defclass
expression's list of superclasses, as in:
(defclass my-pixmap-column (pixmap-column-mixin my-subclass-of-grid-column) ...)
The draw-cell method provided
by this mixin will draw (in each cell of the grid column) a pixmap
that is associated with an application value, if a pixmap has been
supplied for that value. First read-cell-value is called as usual to find the
application value to display (this typically calls the column's
data-reader function). Then
the pixmap-alist of the
grid-column
is searched to
find an entry whose first element is that user value. If a match is
found, then the second element of the alist entry is taken to be the
name of a pixmap. If find-pixmap finds a cached pixmap by that name,
then it is displayed in the cell. Otherwise the cell will be drawn
blank.
If the stretching property of
the grid-column
is true,
then the pixmap will be expanded or shrunk as needed to exactly fit
the cell. Otherwise the pixmap will be drawn at its natural size.
If the user-modifiable
property of the grid-column
is true, then the user may cycle through the set of pixmaps by
clicking the grid cell or pressing the spacebar when it has the
keyboard focus. Each time a new pixmap is displayed, write-cell-value is called to write
the associated data-value back
into the data-object of the
grid-row (this typically calls the column's data-writer function).
Here is a typical expression for creating a pixmap grid column. It
assumes that the data-object
of each grid-row
has a slot
accessor called access containing one of the values
:none
, :partial
, or
:full
.
(make-instance 'my-pixmap-column :name :access :proportional nil :section-size 24 :data-reader 'access :data-writer '(setf access) :pixmap-alist '((:none nil) (:partial :key) (:full :key-special))
The Employee grid example in the Navigator Dialog includes a pixmap column that displays pictures of keys as in the code snippet above.
See the section Built-In Grid Cell Widgets on the page for the
grid-widget
class for an
overview of the grid column mixins.
A quicker but less object-oriented alternative to using the widget-column-mixin
classes is to
write cell-widget methods.
Copyright (c) 1998-2019, Franz Inc. Oakland, CA., USA. All rights reserved.
This page was not revised from the 9.0 page.
Created 2015.5.21.
| Allegro CL version 10.0 Unrevised from 9.0 to 10.0. 9.0 version |