Standard complex item methods
Item classes may need to define any of the following methods to
override the default behaviour in Picture.
- aspect id canvas slate ?aspect? ...
- Return aspect coordinates as a flat x-y list. An
aspect is a named point on an item, such as "origin" or "center"
or "ne." The aspects of an item is entirely up to this method. If there
is no
aspect
method (the default), the Slate attempts to do
something sensible with an item based on its shape; an item class
thus need only define this method if it needs something usual. If no
aspects are given, this method must return a list of aspects that it
understands.
- component id canvas slate ?name? ...
- With no name argument, return a list of components in the
item. If one or more names are given, return the named components.
This method is similar to the
aspect
method, except that
an item is returned instead of coordinates. If there is no
component
method (the default), the Slate attempts to
find components by poking around inside the item classes common
variables.
- construct id canvas slate tags x0 y1 ...
-
option value ...
- Build a new complex item. This method is the only compulsory one.
- deform id canvas slate x y ?aspect? ...
- Deform the named aspects by the given x and y
coordinates. This is a slightly higher-level interface than
coords
, and gives the item class the opportunity to
perform resizing more efficiently (if it wants to).
- destruct id canvas slate
- Prepare a complex item for deletion. This method does not need
to delete items that make up the complex item (since that it done
by the slate), but it won't cause an error if it does,
- coords id canvas slate ?x0 y0 ...?
- Get or set the coordinates of a complex item. If no coordinates are
supplied, return the coordinates (usually, from the primary component);
if coordinates are supplied, then move or deform the components
accordingly.
- ghost id canvas slate
- Create and return an item to be used as a "ghost" when moving
or resizing the item. The color should be "grey."
- region id canvas slate ?x0 y0 x1 y1?
- Get or set the region of a complex item. This is the same as
coords
, except that it treats every item as though
it were rectangular. Because the Slate provides a reasonable
implementation of region
in terms of coords
,
item classes generally do not need to provide this method.
- transform id canvas slate type ?specs?
- Perform a transformation of the specified type on
the item. The transformations allowed depend entirely
upon the item class.
Back up
Tycho Home Page
Copyright © 1996, The Regents of the University of California.
All rights reserved.
Last updated: 96/12/11,
comments to: johnr@eecs.berkeley.edu