File Coverage

blib/lib/Wx/Perl/ListView/SimpleModel.pm
Criterion Covered Total %
statement 6 15 40.0
branch n/a
condition n/a
subroutine 2 6 33.3
pod 4 4 100.0
total 12 25 48.0


line stmt bran cond sub pod time code
1             package Wx::Perl::ListView::SimpleModel;
2              
3             =head1 NAME
4              
5             Wx::Perl::ListView::SimpleModel - virtual list control simple model class
6              
7             =head1 DESCRIPTION
8              
9             A simple model class for C.
10              
11             =head1 METHODS
12              
13             =cut
14              
15 1     1   1339 use strict;
  1         13  
  1         35  
16 1     1   5 use base qw(Wx::Perl::ListView::Model);
  1         2  
  1         240  
17              
18             =head2 new
19              
20             my $model = Wx::Perl::ListView::SimpleModel->new( $data );
21              
22             Where data has the form:
23              
24             [ [ $item, $item, $item, ... ],
25             [ $item, $item, $item, ... ],
26             [ $item, $item, $item, ... ],
27             ]
28              
29             and each item is a valid return value for C.
30              
31             =cut
32              
33             sub new {
34 0     0 1   my( $class, $data ) = @_;
35 0           my $self = bless { data => $data }, $class;
36              
37 0           return $self;
38             }
39              
40             sub get_item {
41 0     0 1   my( $self, $row, $column ) = @_;
42              
43 0           return $self->data->[$row][$column];
44             }
45              
46             sub get_item_count {
47 0     0 1   my( $self ) = @_;
48              
49 0           return scalar @{$self->data};
  0            
50             }
51              
52             =head2 data
53              
54             my $data = $self->data;
55              
56             Accessor for the model data.
57              
58             =cut
59              
60 0     0 1   sub data { $_[0]->{data} }
61              
62             1;