Prima::Grids 1.20 review
DownloadPrima::Grids is a Perl module that contains grid widgets. SYNOPSIS use Prima::Grids; $grid = Prima::Grid-> c
|
|
Prima::Grids is a Perl module that contains grid widgets.
SYNOPSIS
use Prima::Grids;
$grid = Prima::Grid-> create(
cells => [
[qw(1.First 1.Second 1.Third)],
[qw(2.First 2.Second 2.Third)],
[qw(3.First 3.Second 3.Third)],
],
onClick => sub {
print $_[0]-> get_cell_text( $_[0]-> focusedCell), " is selectedn";
}
);
The module provides classes for several abstraction layers of grid representation. The classes hierarchy is as follows:
AbstractGridViewer
AbstractGrid
GridViewer
Grid
The root class, Prima::AbstractGridViewer, provides common interface, while by itself it is not directly usable. The main differences between classes are centered around the way the cell data are stored. The simplest organization of a text-only cell, provided by Prima::Grid, stores data as a two-dimensional array of text scalars. More elaborated storage and representation types are not realized, and the programmer is urged to use the more abstract classes to derive own mechanisms. To organize an item storage, different from Prima::Grid, it is usually enough to overload either the Stringify, Measure, and DrawCell events, or their method counterparts: get_cell_text, columnWidth, rowHeight, and draw_items.
The grid widget is designed to contain cells of variable extents, of two types, normal and indent. The indent rows and columns are displayed in grid margins, and their cell are drawn with distinguished colors. An example use for a bottom indent row is a sum row in a spreadsheet application; the top indent row can be used for displaying columns' headers. The normal cells can be selected by the user, scrolled, and selected. The cell selection can only contain rectangular areas, and therefore is operated with two integer pairs with the beginning and the end of the selection.
The widget operates in two visual scrolling modes; when the space allows, the scrollbars affect the leftmost and the topmost cell. When the widget is not large enough to accommodate at least one cell and all indent cells, the layout is scrolled pixel-wise. These modes are named 'cell' and 'pixel', after the scrolling units.
The widget allows the interactive changing of cell widths and heights by dragging the grid lines between the cells.
Prima::AbstractGridViewer
Prima::AbstractGridViewer, the base for all grid widgets in the module, provides interface to generic grid browsing functionality, plus functionality for text-oriented grids. The class is not usable directly.
Prima::AbstractGridViewer is a descendant of Prima::GroupScroller, and some properties are not described here. See "Prima::GroupScroller" in Prima::IntUtils.
Requirements:
Perl
Prima::Grids 1.20 search tags