File Coverage

blib/lib/Wx/DemoModules/wxWizard.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/wxWizard.pm
3             ## Purpose: wxPerl demo helper for Wx::Wizard
4             ## Author: Mattia Barbon
5             ## Modified by:
6             ## Created: 28/08/2002
7             ## RCS-ID: $Id: wxWizard.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::wxWizard;
14              
15 1     1   1434 use strict;
  1         2  
  1         32  
16 1     1   5 use base qw(Wx::Panel);
  1         1  
  1         543  
17              
18             use Wx qw(wxDefaultPosition wxDefaultSize);
19             use Wx::Event qw(EVT_WIZARD_PAGE_CHANGED EVT_BUTTON);
20              
21             sub new {
22             my( $class, $parent ) = @_;
23             my $self = $class->SUPER::new( $parent, -1 );
24              
25             my $button = Wx::Button->new( $self, -1, "Start wizard", [20, 20] );
26             my $wizard = Wx::Wizard->new( $self, -1, "Wizard test" );
27              
28             # first page
29             my $page1 = Wx::WizardPageSimple->new( $wizard );
30             Wx::TextCtrl->new( $page1, -1, "First page" );
31              
32             # second page
33             my $page2 = Wx::WizardPageSimple->new( $wizard );
34             Wx::TextCtrl->new( $page2, -1, "Second page" );
35              
36             Wx::WizardPageSimple::Chain( $page1, $page2 );
37              
38             EVT_WIZARD_PAGE_CHANGED( $self, $wizard, sub {
39             Wx::LogMessage( "Wizard page changed" );
40             } );
41              
42             EVT_BUTTON( $self, $button, sub {
43             $wizard->RunWizard( $page1 );
44             } );
45              
46             return $self;
47             }
48              
49             sub OnCheck {
50             my( $self, $event ) = @_;
51              
52             Wx::LogMessage( "Element %d toggled to %s", $event->GetInt(),
53             ( $self->IsChecked( $event->GetInt() ) ?
54             'checked' : 'unchecked' ) );
55             }
56              
57             sub add_to_tags { qw(managed) }
58             sub title { 'wxWizard' }
59              
60             1;