NAME

Tickit::Widget::Scroller::Item - interface for renderable scroller items

DESCRIPTION

Items added to a Tickit::Widget::Scroller must adhere to the interface documented here.

METHODS

$height = $item->height_for_width( $width )

Returns the number of screen lines the item would occupy if rendered to the given width.

$item->render( $win, %args )

Renders the item to the given window. %args will contain the following keys:

firstline => INT
lastline => INT

The (inclusive) bounds of the line numbers to render. If these do not cover the entire height of the item, then they imply that clipping should occur; drawing only the lines indicated.

top => INT

The line of $win to consider as the top of the item. Note that this will be the line on which to draw line 0 of the item; not necessarily the line at which to start drawing (if firstline is greater than zero).

It is possible that top will be a negative value, if the item is to be drawn partially clipped by the top of the window, though the negative value will never be more than firstline is positive.

width => INT
height => INT

The width in columns and the height in lines to render the item. This will correspond to the most recent call to height_for_width, and is passed in for consistency and convenience of the item's render method. This is given as the full dimensions of the item, which may be larger than the subset of lines requested by the firstline and lastline parameters.

AUTHOR

Paul Evans <leonerd@leonerd.org.uk>