::tycho::TWidget
-
Related constructs -
Source File -
Contents:
public methods
- protected variable
This is a total re-write of the earlier design. In this new design, complex items are not represented by [incr Tcl] objects, but by an associative array containing just enough information to allow hierarchical item construction and object-oriented-like item manipulation.
In addition to the Slate class itself, there are a number of other classes that work with the slate to implement its full functionality. These classes are grouped into several categories, according to their function in the slate:
To create a slate, do not call the constructor directly, but call
the procedure ::tycho::slate
:
::tycho::slate .s
pack .s -fill both -expand on
wm deiconify .
The Slate class is designed to be fully compatible with the canvas, so some of the methods are less efficient than they could be. We are considering writing a second class which will provide a faster interface for code that doesn't need backwards compatibility.
addtag
add searchSpec args
find
to get all relevant
items, and then tags them; optimized for some special cases.
aspect
id args
The aspects supported depends on the type (or more specifically,
the shape type -- see the type
method) of the complex item. Some
item types will support a more complex set of aspects. If the
complex item is rectangular, is supports at least the aspects c or
center, and the eight compass
points: n, s, e, w, ne, nw, se, and sw. If the
-region
option is given, these aspects will be assumed regardless
of the complex item's actual shape, and will denote the corners
of the complex item's region (see the region
method).
If there are no arguments, return the list of valid aspects for this complex item.
bbox
args
bind
id {sequence {}} args
Caveat: The bind
command dpes not work properly on
hierarchical complex items yet. There are
some interactions with canvas bindings, multiple bindings on the
same tag/object, and hierarchical complex items that need to be
explored and clarified.
call
id method args
In the Slate code itself, this method is called in non-critical situations; in time-critical situations, the (very obscure) code here is "in-lined.".
canvasx
screenx {gridspacing {}}
canvasy
screeny {gridspacing {}}
coords
id args
component
id args
With one argument, return the names of the components of this complex item. With two arguments, return the specified component. With more than two arguments, call the specified method on the component and return its result.
Since this method shadows the default itk method of the same name, this one checks for the argument "canvas" and returns the canvas name if it matches -- using component to access the canvas inside the slate thus still works as expected.
Note: The first argument cannot be an arbitrary tag.
FIXME: The bulk of this method should probably be moved into the Picture class.
create
type args
-tag
with
tags returned by calling gettags
on a complex item, the new
item will be added to that complex item.
dchars
id first {last {}}
delete
args
describe
id args
recreate
so that the item can be recreated or
duplicated later in various forms. Do not make any assumptions
about the contents of the string returned by this method.
Note: If saving the description for later recreation, you may also need to save other information about the complex item, such as its type or whether it has certain tags that affect how you will recreate it.
describe
accepts the following optional arguments:
-hierarchical
: Return a description of all child complex items as well.
-constraints
: Include all constraints in the description.
FIXME: -hierarchical
and -constraints
options do nothing.
dtag
tag {tagToDelete {}}
find
searchSpec args
The tag can also be ``current,'' in which case either a) the current item is returned if that item is not a component; or b) the parent of the current item is returned.
focus
args
focusin
focu
command has been called with a megawidget as an
argument, so instead of calling
focus $slateyou need to call
$slate focusin.
gettags
id
icursor
id index
index
id index
insert
id beforeThis string
interact
command item args
itemcget
id option
itemconfigure
id args
Note also that dtag
, gettags
, and addtag
are faster (and safer)
ways of manipulating tags and should be used in preference to
itemcget
and itemconfigure
.
lower
id {belowThis {}}
FIXME: I am by no means certain that this works correctly!
move
tag xAmount yAmount
moveto
tag x y {aspect center}
If a tag is specified and the tag denotes more than one complex item, then the complex items are moved so that the indicated point on the region covered by those complex items is at the specified location.
picture
mode args
Note: The functionality of the method is still evolving,
and much of it may end up in other methods, such as component
.
postscript
args
raise
id {aboveThis {}}
FIXME: I am by no means certain that this works correctly!
recreate
description args
describe
.
By default, the complex item will be created in exactly the same
position as when describe was called, and without any hierarchy.
A number of options can modify this behavior (these options do not
have to be used, but are really just short-cuts to save other calls:
-move
x y: Move the new complex item relative to the described
position.
-at
x y ?aspect?: Place the given aspect at (x,y).
The aspect default to center.
-coords
x0 y0 ...: Use these coordinates instead of the ones
given by the description.
-in
id: Make the complex item a child of the complex item _id.
-move
, -at
and -coords
are mutually exclusive.
region
id args
FIXME: Be sure to give Picture classes the chance to override.
scale
id xOrigin yOrigin xScale yScale
scan
option args
select
option {id {}} {index {}}
type
id args
With the -shape
option, return the "shape" of the complex item. The
value returned is a subset of the types.
xview
args
yview
args
canvas