File Coverage

blib/lib/Wx/Perl/TreeView/Model.pm
Criterion Covered Total %
statement 3 10 30.0
branch n/a
condition n/a
subroutine 1 5 20.0
pod 4 4 100.0
total 8 19 42.1


line stmt bran cond sub pod time code
1             package Wx::Perl::TreeView::Model;
2              
3             =head1 NAME
4              
5             Wx::Perl::TreeView::Model - virtual tree control model class
6              
7             =head1 DESCRIPTION
8              
9             An abstract base class for all models.
10              
11             =head1 METHODS
12              
13             =cut
14              
15 1     1   6 use strict;
  1         2  
  1         174  
16              
17             =head2 get_root
18              
19             my( $cookie, $string, $image, $data ) = $model->get_root;
20              
21             C<$cookie> is an opaque identifier specific to the model
22             implementation that can be used to access model nodes.
23             C<$string>, C<$image> and C<$data> are the item's label, image and
24             client data (the latter two are optional).
25              
26             =cut
27              
28 0     0 1   sub get_root { my( $self ) = @_; die 'Implement me'; }
  0            
29              
30             =head2 get_child_count
31              
32             my $count = $model->get_child_count( $cookie );
33              
34             Return the numer of childrens of a given node.
35              
36             =cut
37              
38 0     0 1   sub get_child_count { my( $self, $cookie ) = @_; die 'Implement me'; }
  0            
39              
40             =head2 get_child
41              
42             my( $cookie, $string, $image, $data ) = $model->get_child( $cookie, $index );
43              
44             Return the n-th child of the given node. See C for the return
45             values.
46              
47             =cut
48              
49 0     0 1   sub get_child { my( $self, $cookie, $index ) = @_; die 'Implement me'; }
  0            
50              
51             =head2 has_children
52              
53             my $has_children = $model->has_children( $cookie );
54              
55             Return true if the given item has childrens. The default implementation
56             uses C return value.
57              
58             =cut
59              
60 0     0 1   sub has_children { $_[0]->get_child_count( $_[1] ) != 0 }
61              
62             1;