rkt-tree-widget
(require rkt-tree-widget) | package: rkt-tree-widget |
Yet another tree widget for Racket. It uses functional cursors to represent the nodes of the tree.
1 Tree Widget
constructor
(new tree-widget% [ [wheel-step wheel-step]] ...superclass-args...) → (is-a?/c tree-widget%) wheel-step : exact-positive-integer? = 3 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
c : root-cursor? Set the root of the tree.
method
(send a-tree-widget append-item c v [expand?]) → void?
c : generic-cursor? 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? c : generic-cursor? 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? c : generic-cursor? i : exact-nonnegative-integer? v : any/c expand? : boolean? = #f Inserts an item v as the ith child of c. All the cursors acquired previously will be invalidated.
method
(send a-tree-widget update-item c i v) → void?
c : generic-cursor? i : exact-nonnegative-integer? v : any/c Updates the ith child of c to v. All the cursors acquired previously will be invalidated.
method
(send a-tree-widget delete-item c i) → void?
c : generic-cursor? i : exact-nonnegative-integer? Deletes the ith child of c. All the cursors acquired previously will be invalidated.
method
(send a-tree-widget expand-item c expand?) → void?
c : generic-cursor? 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.
method
(send a-tree-widget paint-item c v x y) → void?
c : node-cursor? v : any/c x : exact-nonnegative-integer? y : exact-nonnegative-integer? Paints the item v represented by cursor c at specific dc location.
method
(send a-tree-widget compute-item-size v)
→
exact-positive-integer? exact-positive-integer? exact-nonnegative-integer? v : any/c Overrides compute-item-size in tree<%>.Computes the width, height and children indentation of item v.Default Implementation: Returns (values 1 1 0).
method
(send a-tree-widget locate-item x y) → (or/c #f node-cursor?)
x : (or/c #f exact-nonnegative-integer?) y : exact-nonnegative-integer? Finds out the item at specific location (dc coordinates). If x is #f, only y is considered.
method
(send a-tree-widget make-indices-cursor indices)
→ indices-cursor? indices : (non-empty-listof exact-nonnegative-integer?) 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)]) (cursor-get-child t i)) when used to modify the tree.
2 Tree mixin
|
method
(send a-tree get-root) → root-cursor?
Returns a cursor representing the root of the tree.
method
c : root-cursor? Set the root of the tree.
method
(send a-tree compute-item-size v) →
exact-positive-integer? exact-positive-integer? exact-nonnegative-integer? v : any/c Computes the width, height and children indentation of item v.
method
(send a-tree on-positions-changed) → void?
Called after the tree is modified.
| ||
|
3 Functional Updating
|
superclass: object% |
constructor
(new tree-updater% [tree tree]) → (is-a?/c tree-updater%)
tree : (instanceof/c (implementation?/c tree<%>)) Constructs a tree-updater% associated with tree.
method
(send a-tree-updater append-item t v [ expand? children]) → root-cursor? t : generic-cursor? v : any/c expand? : boolean? = #f children : (or/c #f cursor?) = #f
method
(send a-tree-updater prepend-item t v [ expand? children]) → root-cursor? t : generic-cursor? v : any/c expand? : boolean? = #f children : (or/c #f cursor?) = #f
method
(send a-tree-updater insert-item t i v [ expand? children]) → root-cursor? t : generic-cursor? i : exact-nonnegative-integer? v : any/c expand? : boolean? = #f children : (or/c #f cursor?) = #f
method
(send a-tree-updater update-item t i v) → root-cursor?
t : generic-cursor? i : exact-nonnegative-integer? v : any/c
method
(send a-tree-updater delete-item t i) → root-cursor?
t : generic-cursor? i : exact-nonnegative-integer?
method
(send a-tree-updater expand-item t expand?) → root-cursor?
t : generic-cursor? expand? : boolean?
method
(send a-tree-updater update-children t f) → root-cursor?
t : generic-cursor? f : (-> root-cursor? root-cursor?)
method
tree : root-cursor? Set the root of associated tree<%> to tree.
method
(send a-tree-updater empty-tree) → root-cursor?
4 Cursor Operations
procedure
(root-cursor? v) → boolean?
v : any/c
procedure
(node-cursor? v) → boolean?
v : any/c
procedure
(indices-cursor? v) → boolean?
v : any/c
procedure
(generic-cursor? v) → boolean?
v : any/c
procedure
(cursor-equal? a b) → boolean?
a : cursor? b : cursor?
procedure
(cursor-valid? t c) → boolean?
t : root-cursor? c : cursor?
procedure
(cursor-children c) → (listof node-cursor?)
c : cursor?
procedure
c : cursor?
procedure
c : cursor?
procedure
(cursor-get-child c i) → node-cursor?
c : cursor? i : exact-nonnegative-integer?
procedure
(node-cursor-item-size c) →
exact-positive-integer? exact-positive-integer? c : node-cursor?
procedure
(node-cursor-value c) → any/c
c : node-cursor?
procedure
(node-cursor-expand? c) → boolean?
c : node-cursor?
procedure
c : node-cursor?
procedure
(node-cursor-children-indent c) → exact-nonnegative-integer?
c : node-cursor?
procedure
(root-cursor-total-size c) →
exact-nonnegative-integer? exact-nonnegative-integer? c : root-cursor?
procedure
(root-cursor-locate-item c x y) → (or/c #f node-cursor?)
c : root-cursor? x : (or/c #f exact-nonnegative-integer?) y : exact-nonnegative-integer?
procedure
(root-cursor-get-visible-items c y-start y-end) → (listof (vector/c node-cursor? exact-nonnegative-integer? any/c)) c : root-cursor? y-start : exact-nonnegative-integer? y-end : exact-nonnegative-integer?
5 rkt-tree-widget/base
(require rkt-tree-widget/base) | package: rkt-tree-widget |