Add libwx-perl
[pkg-perl] / deb-src / libwx-perl / libwx-perl-0.96 / debian / libwx-perl / usr / lib / perl5 / Wx / App.pm
1 #############################################################################
2 ## Name:        lib/Wx/App.pm
3 ## Purpose:     Wx::App class
4 ## Author:      Mattia Barbon
5 ## Modified by:
6 ## Created:     25/11/2000
7 ## RCS-ID:      $Id: App.pm 2057 2007-06-18 23:03:00Z mbarbon $
8 ## Copyright:   (c) 2000-2003, 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::App;
14
15 @ISA = qw(Wx::_App);
16
17 use strict;
18
19 # this allows multiple ->new calls and it is an horrible kludge to allow
20 # Wx::Perl::SplashFast to work "better"; see also App.xs:Start
21 sub new {
22   my $this;
23
24   my $class = ref( $_[0] ) || $_[0];
25   if( ref( $Wx::wxTheApp ) ) {
26     bless $Wx::wxTheApp, $class;
27     $this = $Wx::wxTheApp;
28   } else {
29     $this = $_[0]->SUPER::new();
30     bless $this, $class;
31     $Wx::wxTheApp = $this;
32   }
33
34   $this->SetAppName( $_[0] ); # reasonable default for Wx::ConfigBase::Get
35
36   my $ret = Wx::_App::Start( $this, $_[1] || $this->can( 'OnInit' ) );
37   Wx::_croak( 'OnInit must return a true return value' ) unless $ret;
38
39   $this;
40 }
41
42 sub OnInit { 0 }
43
44 package Wx::SimpleApp;
45
46 @Wx::SimpleApp::ISA = qw(Wx::App);
47
48 sub OnInit { 1 }
49
50 1;
51
52 # Local variables: #
53 # mode: cperl #
54 # End: #