TkTreeWidget - Helper

The helper specification

The helper specification is a record.
This is what a complete specification may look like:


(Node x Canvas x ScaledX:int x ScaledY:int -> NewItem)
This procedure does the actual drawing. Its arguments are the node to be drawn, a "Canvas"-Object (which is NOT a real tk canvas) and the X- and Y-coordinates of the middle of the new node.
The "Canvas" has a method for creating Objects:
tkGet(Tickle ?Id)

(Node -> bool)
This procedure gets a Node, and depending on the node's state should decide whether the node has to be redrawn (if its state has changed) or can be just moved (if necessary).

(Node -> bool)
This procedure gets a node, and depending on the node's state should decide whether this node (when selected) should get the cursor (or whether this node can't be selected).

(Node x Canvas x ScaledX:int x ScaledY:int -> )
This procedure draws the "cursor", the shadow under a selected node.

(Node x Node x MomX:int x MomY:int x MyY:int -> int x int x int x int)
This procedure gets the current node, this node's parent node, the parent node's X and Y coordinates and its own Y coordinate and should return the endpoints of the connection line between the node and its parent.

(Event -> )
This procedure is currently called when one of the following events occurs:
nodeSelected(Node) - the node Node was selected
nodeInspected(Node) - the node Node was double-clicked
(More events will be included in a future release)

(Node -> int)
This procedure gets a node and returns the width this node occupies (for dynamically sized nodes, e.g. with text labels).

Guido Tack
Last modified: Thu May 2 20:48:22 CEST 2002