####
#!perl -w
use strict;
use Wx;
use Wx::XRC;
package MyPanel;
use base 'Wx::Panel';
sub new {
my $class = shift;
my $self = $class->SUPER::new();
$self->OnInit(@_);
return $self;
}
sub OnInit {
my $self = shift;
my $parent = shift;
my $xrc = shift;
$xrc->LoadPanel($parent, 'panel_1');
return $self;
}
package MyApp;
use base qw(Wx::App);
sub OnInit {
my $self = shift;
my $frame = MyFrame->new( undef, -1, "Hello World");
$frame->Show(1);
$self->SetTopWindow($frame);
return $self;
}
package MyFrame;
use base qw(Wx::Frame);
sub new {
my $class = shift;
my $self = $class->SUPER::new( @_ );
$self->{xrc} = Wx::XmlResource->new();
$self->{xrc}->InitAllHandlers();
$self->{xrc}->Load('t.xrc');
$self->{panel} = MyPanel->new($self, $self->{xrc});
return $self;
}
package main;
my($app) = MyApp->new();
$app->MainLoop();