new
new
9.0
top
← prev up next →

rkt-tree-widgetπŸ”— i

yjqww6

Yet another tree widget for Racket. It uses functional cursors to represent the nodes of the tree.

1Tree WidgetπŸ”— i

superclass:canvas%

extends: tree<%>
A canvas% -based tree widget.

constructor

[ [wheel-stepwheel-step]]
...superclass-args...)
The wheel-step argument controls the speed of scrolling.

method

(send a-tree-widget get-root )root-cursor?

Returns a cursor representing the root of the tree.

method

(send a-tree-widget set-root c)void?

Set the root of the tree.

method

(send a-tree-widget append-item cv[expand?])void?

v:any/c
expand?:boolean? =#f
Appends an item v to the children of c. All the cursors acquired previously will be invalidated.

method

(send a-tree-widget prepend-item c
v
[ expand?])void?
v:any/c
expand?:boolean? =#f
Prepends an item v to the children of c. All the cursors acquired previously will be invalidated.

method

(send a-tree-widget insert-item c
i
v
[ expand?])void?
v:any/c
expand?:boolean? =#f
Inserts an item v as the ith child of c. All the cursors acquired previously will be invalidated.

Updates the ith child of c to v. All the cursors acquired previously will be invalidated.

Deletes the ith child of c. All the cursors acquired previously will be invalidated.

method

(send a-tree-widget expand-item cexpand?)void?

expand?:boolean?
Changes the expanding status of c to expand?. All the cursors acquired previously will be invalidated.

method

(send a-tree-widget reset-items )void

Resets the tree to empty. All the cursors acquired previously will be invalidated.

method

(send a-tree-widget on-positions-changed )void?

Called after the tree is modified.

Default Implementation: Calls refresh .

Paints the item v represented by cursor c at specific dc location.

Overrides compute-item-size in tree<%> .
Computes the width, height and children indentation of item v.

Default Implementation: Returns (values 110).

Finds out the item at specific location (dc coordinates). If x is #f, only y is considered.

Constructs an cursor from indices, which should be only used to modify the tree immediately. Equivalent to
(for/fold ([t(send this get-root)])
([i(in-list indices)])
when used to modify the tree.

2Tree mixinπŸ”— i

interface

tree<%> :interface?

method

(send a-tree get-root )root-cursor?

Returns a cursor representing the root of the tree.

method

(send a-tree set-root c)void?

Set the root of the tree.

Computes the width, height and children indentation of item v.

method

(send a-tree on-positions-changed )void?

Called after the tree is modified.

mixin

tree-mixin :(class? . -> .class? )

result implements: tree<%>

3Functional UpdatingπŸ”— i

superclass:object%

tree-updater% is used to building and updating tree-widget% functionally.

Constructs a tree-updater% associated with tree.

method

(send a-tree-updater append-item t
v
[ expand?
children])root-cursor?
v:any/c
expand?:boolean? =#f
children:(or/c #fcursor? )=#f

method

(send a-tree-updater prepend-item t
v
[ expand?
children])root-cursor?
v:any/c
expand?:boolean? =#f
children:(or/c #fcursor? )=#f

method

(send a-tree-updater insert-item t
i
v
[ expand?
children])root-cursor?
v:any/c
expand?:boolean? =#f
children:(or/c #fcursor? )=#f

method

(send a-tree-updater expand-item texpand?)root-cursor?

expand?:boolean?

method

(send a-tree-updater set-tree tree)void?

Set the root of associated tree<%> to tree.

method

(send a-tree-updater empty-tree )root-cursor?

4Cursor OperationsπŸ”— i

procedure

( root-cursor? v)boolean?

v:any/c
Returns #t if v is a root cursor, otherwise #f. A root cursor represents the root of a tree.

procedure

( node-cursor? v)boolean?

v:any/c
Returns #t if v is a node cursor, otherwise #f. A node cursor represents an internal node of a tree.

procedure

( cursor? v)boolean?

v:any/c
Returns #t if either (root-cursor? v) or (node-cursor? v) return #t, otherwise #f.

procedure

( indices-cursor? v)boolean?

v:any/c
Returns #t if v is a indices cursor, otherwise #f. See also make-indices-cursor .

procedure

( generic-cursor? v)boolean?

v:any/c
Returns #t if either (cursor? v) or (indices-cursor? v) return #t, otherwise #f.

procedure

( cursor-up c)cursor?

Returns a cursor representing the parent node of c. If c is a root cursor, returns itself.

procedure

( cursor-equal? ab)boolean?

Returns #t if a and b represent same node (or same root), otherwise #f.
Returns #t if t is the root of c, otherwise #f.
Returns the children of c.
Similar to cursor-children , but returns a root cursor instead.
Returns the the number of children of c.
Returns the ith child of c.
Returns the width and height of the item of c.
Returns the item value of c.
Returns #t if c is expanded, otherwise #f.
Returns the position of c in its parent.
Returns the chilren indentation of c.
Returns the total size required by c.
Similar to locate-item , but x and y are relative to c.
Returns a list of visible items (flattened) in [y-start, y-end) (relative to c). Vectors in that list consist of the cursor, the y location, and the value of correspoding node.

5 rkt-tree-widget/base πŸ”— i

rkt-tree-widget/base provides all the exports provided from rkt-tree-widget, except tree-widget% . It doesn’t depend on racket/gui.

top
← prev up next →

AltStyle γ«γ‚ˆγ£γ¦ε€‰ζ›γ•γ‚ŒγŸγƒšγƒΌγ‚Έ (->γ‚ͺγƒͺγ‚ΈγƒŠγƒ«) /