ListBrowser/LBCanvas.pm untested

filter: Statementstmt 0.0% 0 / 42 Branchbran n/a Conditioncond n/a MC/DCmcdc n/a Subroutinesub 0.0% 0 / 8 Podpod 0.0% 0 / 3 totaltotal 0.0% 0 / 53 CC 1 SCAR 6.9
CC
1
Cov
0%
Populate
2.0
ClassInit
2.0
KeyPress
2.0
CRAP 2.0
1 package Tk::ListBrowser::LBCanvas;
2  
3 use warnings;
4 use strict;
5 use vars qw ($VERSION);
6 use Carp;
7  
8 $VERSION = 0.04;
9  
10 use base qw(Tk::Derived Tk::Canvas);
11  
12 Construct Tk::Widget 'LBCanvas';
13  
14 sub Populate {
15 my ($self,$args) = @_;
16 $self->SUPER::Populate($args);
17 $self->ConfigSpecs(
18 -keycall => ['CALLBACK'],
19 DEFAULT => [ $self ],
20 );
21 }
22  
23 sub ClassInit {
24 my ($class,$mw) = @_;
25 $class->SUPER::ClassInit($mw);
26 for (qw/Escape Return space Down Left Right Up End Home/) {
27 my $bnd = $_;
28 $mw->bind($class, "<$bnd>", ['KeyPress', $bnd]);
29 }
30 for (qw/Down Left Right Up End Home/) {
31 my $bnd = $_;
32 $mw->bind($class, "<Shift-$bnd>", ['KeyPress', "Shift-$bnd"]);
33 }
34 for (qw/End Home/) {
35 my $bnd = $_;
36 $mw->bind($class, "<Shift-$bnd>", ['KeyPress', "Shift-$bnd"]);
37 $mw->bind($class, "<Control-$bnd>", ['KeyPress', "Control-$bnd"]);
38 $mw->bind($class, "<Control-Shift-$bnd>", ['KeyPress', "Control-Shift-$bnd"]);
39 }
40 }
41  
42 sub KeyPress {
43 my ($self, $key) = @_;
44 $self->Callback('-keycall', $key)
45 }
46  
47 1;