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

NextPrevUpTopContentsIndex

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 compound-drawing-object => result

recurse-compute-drawing-object object

Arguments

compound-drawing-object

A compound-drawing-object.

object

An objects-displayer, pinboard-objects-displayer, a list, or a compound-drawing-object.

Values

result

A boolean.

Description

The function compute-drawing-object-from-data does something only when it is applied to a compound-drawing-object, otherwise it just returns nil. When the object is a compound-drawing-object, compute-drawing-object-from-data checks if the object has either function or data non-nil. For the object to have a non-nil function , this must have been supplied when it was created (for example when creating geometry-drawing-object). The data can be passed in creation or set later by (setf compound-drawing-object-data).

If the object has a non-nil function , compute-drawing-object-from-data calls it with data as a single argument, and uses the result. Otherwise, if the 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.

The argument object to recurse-compute-drawing-object 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 under object , and for each compound-drawing-object that it finds calls compute-drawing-object-from-data.

When the argument is either an objects-displayer or 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
Lower level - drawing objects and objects displayers


CAPI User Guide and Reference Manual (Macintosh version) - 3 Aug 2017

NextPrevUpTopContentsIndex