File Coverage

blib/lib/Wx/DemoModules/wxSplashScreen.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/wxSplashScreen.pm
3             ## Purpose: wxPerl demo helper
4             ## Author: Mattia Barbon
5             ## Modified by:
6             ## Created: 28/08/2002
7             ## RCS-ID: $Id: wxSplashScreen.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::wxSplashScreen;
14              
15 1     1   1380 use strict;
  1         3  
  1         42  
16 1     1   7 use base qw(Wx::Panel);
  1         2  
  1         881  
17              
18             use Wx qw(:splashscreen wxBITMAP_TYPE_JPEG);
19             use Wx::Event qw(EVT_BUTTON);
20              
21             use File::chdir;
22              
23             sub new {
24             my( $class, $parent ) = @_;
25             my $self = $class->SUPER::new( $parent );
26              
27             my $splash = Wx::Button->new( $self, -1, 'Splash Screen', [ 10, 10 ] );
28             my $splashfast = Wx::Button->new( $self, -1, 'Splash Fast', [ 150, 10 ] );
29              
30             EVT_BUTTON( $self, $splash, \&on_splash );
31             EVT_BUTTON( $self, $splashfast, \&on_splash_fast );
32              
33             return $self;
34             }
35              
36             sub on_splash {
37             my( $self, $event ) = @_;
38             my $logo_file = Wx::Demo->get_data_file( 'splash/logo.jpg' );
39              
40             my $bitmap = Wx::Bitmap->new( $logo_file, wxBITMAP_TYPE_JPEG );
41              
42             Wx::SplashScreen->new( $bitmap,
43             wxSPLASH_CENTRE_ON_SCREEN|wxSPLASH_TIMEOUT,
44             5000, undef, -1 );
45             }
46              
47             sub on_splash_fast {
48             my( $self, $event ) = @_;
49             my $splash_pl = Wx::Demo->get_data_file( 'splash/splash.pl' );
50              
51             local $CWD = File::Basename::dirname( $splash_pl );
52             Wx::ExecuteCommand( "$^X splash.pl", 0 );
53             }
54              
55             sub add_to_tags { qw(managed) }
56             sub title { 'wxSplashScreen' }
57              
58             1;