File Coverage

blib/lib/Wx/DemoModules/wxCheckListBox.pm
Criterion Covered Total %
statement 6 6 100.0
branch n/a
condition n/a
subroutine 2 2 100.0
pod n/a
total 8 8 100.0


line stmt bran cond sub pod time code
1             #############################################################################
2             ## Name: lib/Wx/DemoModules/wxCheckListBox.pm
3             ## Purpose: wxPerl demo helper for Wx::CheckListBox
4             ## Author: Mattia Barbon
5             ## Modified by:
6             ## Created: 13/03/2002
7             ## RCS-ID: $Id: wxCheckListBox.pm 2189 2007-08-21 18:15:31Z mbarbon $
8             ## Copyright: (c) 2002, 2006 Mattia Barbon
9             ## Licence: This program is free software; you can redistribute it and/or
10             ## modify it under the same terms as Perl itself
11             #############################################################################
12              
13             package Wx::DemoModules::wxCheckListBox;
14              
15 1     1   1167 use strict;
  1         3  
  1         28  
16 1     1   4 use base qw(Wx::CheckListBox);
  1         2  
  1         501  
17              
18             use Wx qw(wxDefaultPosition wxDefaultSize);
19             use Wx::Event qw(EVT_CHECKLISTBOX);
20              
21             sub new {
22             my $class = shift;
23             my $this = $class->SUPER::new( $_[0], -1, wxDefaultPosition,
24             wxDefaultSize,
25             [ qw(one two three four five size seven
26             eight nine ten) ] );
27              
28             foreach my $i ( 0 .. 9 ) { $this->Check( $i, $i & 1 ) }
29              
30             EVT_CHECKLISTBOX( $this, $this, \&OnCheck );
31              
32             return $this;
33             }
34              
35             sub OnCheck {
36             my( $this, $event ) = @_;
37              
38             Wx::LogMessage( "Element %d toggled to %s", $event->GetInt(),
39             ( $this->IsChecked( $event->GetInt() ) ? 'checked' : 'unchecked' ) );
40             }
41              
42             sub add_to_tags { qw(controls) }
43             sub title { 'wxCheckListBox' }
44              
45             1;