NAME
TUI::Outline::Outline - outline viewer that displays a tree of TNode objects
HIERARCHY
TObject
TView
TScroller
TOutlineViewer
TOutline
SYNOPSIS
use TUI::toolkit;
use TUI::Objects;
use TUI::Outline;
use TUI::Views;
my $root = TNode->new(
text => 'Root',
childList => $child,
expanded => true,
);
my $outline = TOutline->new(
bounds => TRect->new( ax => 0, ay => 0, bx => 20, by => 10 ),
hScrollBar => undef,
vScrollBar => undef,
root => $root,
);
DESCRIPTION
TOutline is the concrete outline viewer of the Turbo Vision outline subsystem. It displays the tree of TNode objects that starts at its root node and implements the abstract methods of TOutlineViewer on top of the node attributes.
The constructor updates the viewer, so the outline is ready to draw after creation. Expanding or retracting a node changes its expanded attribute.
The tree is freed by Perl reference counting. Streaming is supported through Storable serialization, which writes the node tree as a flat sequence of primitive values; the root is preceded by a presence flag, since an empty outline has no root node to write.
ATTRIBUTES
root
The root node of the outline tree (TNode), or undef for an empty outline.
CONSTRUCTOR
new
my $outline = TOutline->new(
bounds => $bounds,
hScrollBar => $hScrollBar,
vScrollBar => $vScrollBar,
root => $root,
);
Creates a new outline viewer for the tree that starts at root.
- bounds
-
Bounding rectangle of the outline viewer (TRect).
- hScrollBar
-
Optional horizontal scroll bar (TScrollBar or
undef). - vScrollBar
-
Optional vertical scroll bar (TScrollBar or
undef). - root
-
Root node of the outline tree (TNode or
undeffor an empty outline).
new_TOutline
my $outline = new_TOutline($bounds, $hScrollBar | undef,
$vScrollBar | undef, $root);
Factory constructor that mirrors the positional Turbo Vision constructor.
METHODS
adjust
$outline->adjust($node, $expand);
Sets the expanded attribute of $node to $expand.
getChild
my $child = $outline->getChild($node, $i);
Returns the child of $node at index $i, counting from 0, or undef if there is no such child.
getNumChildren
my $count = $outline->getNumChildren($node);
Returns the number of children of $node.
getRoot
my $root = $outline->getRoot();
Returns the root node of the outline tree, or undef if the outline is empty.
getText
my $text = $outline->getText($node);
Returns the text of $node.
hasChildren
my $bool = $outline->hasChildren($node);
Returns true if $node has at least one child.
isExpanded
my $bool = $outline->isExpanded($node);
Returns the expanded attribute of $node.
SEE ALSO
AUTHORS
Borland International (original Turbo Vision design)
J. Schneider <brickpool@cpan.org> (Perl implementation and maintenance)
COPYRIGHT AND LICENSE
Copyright (c) 1990-1994, 1997 by Borland International
Copyright (c) 2026 the "AUTHORS" as listed above.
This software is licensed under the MIT license (see the LICENSE file, which is part of the distribution).