::tycho::EditDAG
-
Source File -
Contents:
itk_options
- public methods
- protected methods
This class is meant to serve as a base class for
such tools as class browsers for object-oriented languages, program
structure displays for hierarchical programs, navigation maps for
hypertext documents, etc. The EditForest
top-level
window class provides a convenient container for this widget.
Data stored on the nodes of the trees are (almost) arbitrary strings. The only constraint is that there for every open brace "{" there must be a close brace "}". I.e., the string must be recognizable as a Tcl list. However, if the data takes a certain form, then the display and behavior of the editor can be controlled very precisely. In particular, the contents of the node can be a list, with items in the list being lists lists of the form "{keyword value}". The following keywords are currently understood:
getFont
method of the FontManager
class.
EditForest
. The point may be a string identifying
a named anchor in an HTML file, or "{line linenumber}" or
"{range start end}" for text files, or any other destination
that is understood by the seeFragment
method of the
widget that will display the hyperlink.
Here is an example of how to use the EditForest:
::tycho::view EditForest
The widget has a number of options. The -graph option gives
the name of an object of type Forest
to display and
edit. If it is not given, the widget creates its own object of type
Forest
, and destroys that object on exiting. The
-indent option gives the indentation of children with respect
to their parents (in pixels, default 30). The -readonly option
disables changes, making the widget a display only. The
-vertspacing option gives the vertical spacing as a multiplier of
the height of the font(s). The -startx and -starty
options gives the position of the upper left corner of the first node
(in pixels, default 10 and 5). This upper left corner will be placed
below the title information, if there is any.
Below is an example:
catch {delete object ff}
::tycho::Forest ff
ff add a {label {A Node} color red font {times 16 bold r}}
ff add b {label {B Node} color green}
ff add c {label {C Node} font {times 40 bold r}}
ff add d {label {D Node}}
ff roots
ff add e {e e} b
set descr [ff describe]
set view [::tycho::view EditForest [list -graph ff]]
set win [$view displayer windowName]
wm deiconify $win
-indent
30
-vertspacing
1.2
contract
node
help
expand
node
redrawGraph
drawParentLines
node
drawSubgraph
root xcoord ycoord {pntloc {}}
drawSubgraphVertically
root xcoord
structClass