All Manuals > CAPI User Guide and Reference Manual > 23 LW-GT Reference Entries

compute-drawing-object-from-data

recurse-compute-drawing-object Functions

Summary

Use the function and/or data in compound-drawing-objects.

Package

lw-gt

Signatures

compute-drawing-object-from-data object => result

recurse-compute-drawing-object object-or-displayer

Arguments
object
A Lisp object.
object-or-displayer
Values
result
A boolean.
Description

The function compute-drawing-object-from-data computes the drawing for an object.

If object is not a compound-drawing-object, then compute-drawing-object-from-data just returns nil.

If object is a compound-drawing-object, then compute-drawing-object-from-data checks if object has a non-nil value for either function or data. For object to have a non-nil function, this must have been supplied when object was created (for example when creating geometry-drawing-object). data can be passed during creation or set later by using setf with compound-drawing-object-data.

If object has a non-nil function, then compute-drawing-object-from-data calls function with data as a single argument, and uses the result. Otherwise, if object has a non-nil data, compute-drawing-object-from-data calls the generic function get-drawing-object with data as a single argument, and uses the result. If this result is :no-change, compute-drawing-object-from-data just returns nil. get-drawing-object has a default method that returns :no-change.

Otherwise, the result must be a "drawing-object-spec", which means either an instance of (a subclass of) drawing-object or a list of "drawing-object-specs". compute-drawing-object-from-data then sets the sub-object of the object to the result, and returns t.

For recurse-compute-drawing-object, object-or-displayer should be an objects-displayer, a pinboard-objects-displayer, a list, or a compound-drawing-object. For other objects recurse-compute-drawing-object just returns nil.

recurse-compute-drawing-object recurses the hierarchy starting at object-or-displayer, and for each compound-drawing-object that it finds calls compute-drawing-object-from-data.

When it finds an objects-displayer or a pinboard-objects-displayer, recurse-compute-drawing-object also calls force-objects-redraw when it finishes.

These functions can be called on any thread.

Notes
  1. The purpose of these functions is to allow creating a tree of drawing-objects that can update itself, by passing the function argument when making it or defining get-drawing-object and passing the appropriate data. Then the tree can be told to recompute itself by calling recurse-compute-drawing-object.
  2. These functions do not cause redraw, except when recurse-compute-drawing-object is applied to objects-displayer or pinboard-objects-displayer. You will have to do it yourself by using force-objects-redraw on the root of the hierarchy or hierarchies which need redrawing.
  3. recurse-compute-drawing-object does not check against duplication, so if the same object appears in the hierarchy more than once, it will be updated repeatedly.
See also

geometry-drawing-object
compound-drawing-object
14.1 Lower level - drawing objects and objects displayers


CAPI User Guide and Reference Manual (Macintosh version) - 01 Dec 2021 19:31:48