The Slate class builds on the complex item support of the IncrCanvas class, to add more complex forms of item manipulation and support for user interaction. This document is an overview of its methods.
ghost tag ?tag?...
ghost
method to override the
default behaviour.
highlight tag ?tag?...
highlight
method to override the default
behaviour. Each created item is tagged with "highlight" and
"highlight.id", where id is the item it highlights, and
any additional arguments to this method.
unhighlight tag
aspect id ?aspect? ...
?-region
?
x
-y
list. An
aspect
is a named point on an item, such as
origin
or center
or ne
. The aspects of an item depend on its
type. If the -region
flag is supplied, treat the item as
a rectangular item regardless of its real shape. To query legal
aspects, call with no argument, and a list of legal aspects will be
returned. (Note that the legal aspects are not necessarily constant
over the lifetime of an item -- for example, adding a vertex to a
polygon will also add an aspect.)
region tag ?x0 y0 x1 y1?
coords
, except that it treats every item as though
it were rectangular.
shape id ?method? ?region?
align where ?tagOrID ... ?
where
argument specifies the alignment,
and can be one of left
, center
, right
,
top
, middle
, or bottom
. Not implemented.
move tag x y
highlight
method
are also moved.
moveclick tag x y ?args?
x
,
y
). Additional arguments include various flags that may
be supplied by the interactors that the slate uses to affect the
behavior of items, such as -ghost, which says that an item is to be
moved or reshaped using a "ghost" outline.
movedrag tag x y
x
, y
) as the new
cursor position.
moverelease tag x y
x
,
y
), x
and y
will usually be the
same as the last coordinates passed to the drag mode.
moveto tag x y ?aspect?
aspect
to the absolute
location (x
, y
). If tag
denotes more than one
item, treat the set of items as a rectangle. (In this case,
aspect
must of course be legal for rectangles.) If aspect
is omitted, it defaults to center
.
reshape id x y ?-region? ?aspect ...?
x
and y
. If the -region
flag is present,
the item is treated as a rectangle regardless of its actual shape.
reshapeclick id x y ?aspect? ...
x
, y
). Additional arguments
include various flags that may be supplied by the interactors that the
slate uses to affect the behavior of items, such as
-ghost
, which says that an item is to be moved or
reshaped using a "ghost" outline.
reshapedrag id x y
x
, y
) as the new cursor position.
reshaperelease id x y
x
, y
). x
and y
will usually be the same as the last
coordinates passed to the "drag" mode.
reshapeto tag x y aspect
interactor class ?args? ...
class
and return it.
This is just a convenient interface to the interactor constructors.
select tagOrIDid ?id ...?
select
method of the
IncrCanvas superclass, adding some modes to allow multiple items to be
in the selection. (The superclass method only allows a region of a
single text item to be in the selection.) Each selected item is tagged
sel
. The new modes are:
add tagorid
: Add the items specified by
tagorid
to the selection. If the selection is
currently inside an item, that selection is cleared.
remove tagorid
: Remove the items specified by
tagorid
from the selection.
describe
: Return a string describing the items
in the selection.
exists
: Test if an item is in the selection.
selector ?method? ?arg ...?
method
on selector with the given
arguments.
describe id
recreate
command to re-create or clone
the item.
recreate description
?-move
x y?
?-at
x y?
?-coords
x0 y0 ... ?
?-in
id?
describe
method. The various options allow the item to be created at a
different position on the canvas, or as a child of some other item.