Tom Molesworth > Tickit-Widget-Tree-0.003 > Tickit::Widget::Tree

Download:
Tickit-Widget-Tree-0.003.tar.gz

Dependencies

Annotate this POD

CPAN RT

Open  1
View/Report Bugs
Module Version: 0.003   Source  

NAME ^

Tickit::Widget::Tree - support for an expandable tree widget

VERSION ^

version 0.003

SYNOPSIS ^

 my $tree = Tickit::Widget::Tree->new(
        is_open => 1,
        label => 'Root',
        line_style => 'single',
 );
 $tree->add(Tickit::Widget::Tree->new(
        is_open => 1,
        label => 'First',
 ));

DESCRIPTION ^

Simple tree widget. See examples in main source for more info.

METHODS ^

new

Instantiate new tree.

Takes the following named parameters:

label

Set or retrieve the label for this widget.

By default all nodes use a Tickit::Widget::Static widget as a label, see the "label_widget" method for more control over this.

label_widget

Set or retrieve the label widget for this node. Typically a Tickit::Widget::Static, this must accept a pen which will be used for displaying the currently-highlighted node.

prev

The 'previous element' is determined as follows:

prev_sibling

Returns the previous sibling for this node. RO accessor.

next_sibling

Returns the next sibling for this node. RO accessor.

next

The 'next element' is determined as follows:

_next_ignore_children

Returns the next node, ignoring any children in the current node for the purposes of the search.

lines

Returns the number of lines used by this node. Will be the label height unless the widget is open.

cols

Number of cols for autocalculation. We're flexible, so we just use the default 1.

is_open

Returns true if this node is open, false if not.

If open state is undefined, then we inherit from the parent if we have one, or return 0 as a fallback.

is_closed

Returns true if we're closed, false if not.

window_lost

Callback to clear children and label when we lose our window.

window_gained

Callback to adjust our widgets when we get a window.

reshape

Callback to adjust the label window when our window is resized.

_reshape_label

Adjust our label window to fit the current window.

reapply_windows

Calculate windows for all widgets.

insert_after

Adds $v after $self.

Takes over $self->next, including backlink from $self->next->prev.

add

Adds a child node after all other children.

children

Returns a list of all children.

is_highlighted

Returns true if this node is highlighted.

Note that the highlighted widget itself is tracked through the root node, see "highlighted" for more information.

prefix_text

Returns the appropriate line prefix text for the current style.

style_map

Returns hashref which maps a component to the character string used to represent it.

render

Tickit::Window

highlighted

highlight

highlight_next

highlight_prev

rerender

root

tree_parent

update_root_and_parent

on_key

open

Open this node. Triggers a redraw.

close

Close this node. Triggers a redraw.

on_add

Make sure everything has a consistent view of root and parent nodes when adding a widget to a parent.

line_style

Returns current line style. Inherits from parent, root or defaults to 'single'.

SEE ALSO ^

AUTHOR ^

Tom Molesworth <cpan@entitymodel.com>

LICENSE ^

Copyright Tom Molesworth 2011. Licensed under the same terms as Perl itself.

syntax highlighting: