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

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

Dependencies

Annotate this POD

Website

CPAN RT

New  1
Open  1
View/Report Bugs
Module Version: 0.003   Source  

NAME ^

Tickit::Widget::Table - tabular widget support for Tickit

VERSION ^

version 0.003

SYNOPSIS ^

 use Tickit::Widget::HBox;
 use Tickit::Widget::Table;
 # Create the widget
 my $table = Tickit::Widget::Table->new(
        padding => 1,
        columns => [
                { label => 'First column', align => 'center', width => 'auto' },
                { label => 'Second column', align => 'right', width => 'auto' },
        ],
 );
 $table->add_row(
        'First entry',
        'Second column',
 );
 $table->add_row(
        'Second entry',
        'More data',
 );
 # Put it in something
 my $container = Tickit::Widget::HBox->new;
 $container->add($table, expand => 1);

DESCRIPTION ^

Basic support for table widgets. See examples/ in the main distribution for usage instructions.

METHODS ^

new

Create a new table widget.

Takes the following named parameters:

add_header_row

Adds a header row to the top of the table. Takes no parameters.

add_initial_columns

Populates initial columns from the given arrayref. Generally handled internally when passing columns in the constructor.

padding

Returns amount of padding between cells

lines

Number of rows.

cols

Number of screen columns.

rows

'rows' are the number of data rows we have in the table. That's one less than the total number of rows if we have a header row

columns

Number of columns in the table.

data_rows

Returns the rows containing data - this excludes the header row if there is one.

reposition_cursor

Put the cursor in the right place. Possibly used internally, probably of dubious utility.

header_row

Returns the header row if there is one.

set_highlighted_row

Highlight a row in the table. Only one row can be highlighted at a time, as opposed to selected rows.

set_highlighted_column

Highlight a row in the table. Only one row can be highlighted at a time, as opposed to selected rows.

highlight_row

Returns currently-highlighted row, if we have one. In cell mode, returns the row corresponding to current cell highlight.

highlight_column

Returns currently-highlighted column, if we have one. In cell mode, returns the column corresponding to current cell highlight.

highlight_cell

highlighted_item

highlight_row_index

Index of the currently-highlighted row.

highlight_column_index

Index of the currently-highlighted column.

refit

Check current widths and apply width on columns we already have sufficient information for.

min_refit

Try to shrink columns down to minimum possible width if they're flexible. Typically used by "add_column" to allow the new column to fit properly.

get_column_width

Return the width for the given column, or undef if this column should be autosized.

column_list

Returns all columns for this table as a list.

add_column

Add a new column to the table, returning a Tickit::Widget::Table::Column instance.

update_highlight

add_row

Adds a new row of data to the table. This will instantiate a new Tickit::Widget::Table::Row and return it.

remove_row

Remove the given row.

clear_data

Clears any data for this table, leaving structure including header row intact.

window_gained

Once we have a window, we want to refit to ensure that all the child elements are given subwindows with appropriate geometry.

window_lost

When the main window is lost, we also clear all the subwindows that were created for children.

on_key

Key handling: convert some common key requests to events.

on_quit

Handle a quit request. This is clearly not the place to have code like this.

on_switch_window

uh, no. you didn't see this.

on_toggle_select_all

Select everything, unless everything is already selected in which case select nothing instead.

on_select

Toggle selection for this row.

on_key_insert

Should not be here.

on_key_delete

Should not be here.

on_cursor_up

Move to the row above.

on_cursor_home

Move to the top of the table.

on_cursor_end

Move to the end of the table.

on_cursor_pageup

Move several lines up.

on_cursor_down

Move one line down.

on_cursor_pagedown

Move several lines down.

on_cursor_left

Move to the item on the left.

on_cursor_right

Move to the item on the right.

highlight_mode

default_action

bind_key

Accessor/mutator for the on_key callback.

Returns $self when used as a mutator, or the current on_key value when called with no parameters.

on_highlight_changed

Accessor/mutator for the on_highlight_changed callback.

Returns $self when used as a mutator, or the current on_highlight_changed value when called with no parameters.

highlight_attrs

Accessor for pen attributes to use for highlighted cells, as a hashref.

normal_attrs

Accessor for pen attributes to use for unhighlighted cells, as a hashref.

reshape

Called when the window has been resized. Recalculates layout.

AUTHOR ^

Tom Molesworth <cpan@entitymodel.com>

LICENSE ^

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

syntax highlighting: