| 1 | package FBP::Demo::FBP::Main; | ||
| 2 | |||
| 3 | use 5.008; | ||
| 4 | use strict; | ||
| 5 | use warnings; | ||
| 6 | use Wx ':everything'; | ||
| 7 | |||
| 8 | our $VERSION = '0.03'; | ||
| 9 | our @ISA = 'Wx::Frame'; | ||
| 10 | |||
| 11 | sub new { | ||
| 12 | my $class = shift; | ||
| 13 | my $parent = shift; | ||
| 14 | |||
| 15 | my $self = $class->SUPER::new( | ||
| 16 | $parent, | ||
| 17 | -1, | ||
| 18 | "Main Window", | ||
| 19 | Wx::wxDefaultPosition, | ||
| 20 | [ 500, 300 ], | ||
| 21 | Wx::wxDEFAULT_FRAME_STYLE | Wx::wxTAB_TRAVERSAL, | ||
| 22 | ); | ||
| 23 | |||
| 24 | $self->{m_staticText1} = Wx::StaticText->new( | ||
| 25 | $self, | ||
| 26 | -1, | ||
| 27 | "This is the FBP::Perl demonstration project.\n\nIt shows a complete working standalone application skeleton as produced by FBP::Perl.", | ||
| 28 | ); | ||
| 29 | |||
| 30 | $self->{m_staticline1} = Wx::StaticLine->new( | ||
| 31 | $self, | ||
| 32 | -1, | ||
| 33 | Wx::wxDefaultPosition, | ||
| 34 | Wx::wxDefaultSize, | ||
| 35 | Wx::wxLI_HORIZONTAL, | ||
| 36 | ); | ||
| 37 | |||
| 38 | $self->{simple_button} = Wx::Button->new( | ||
| 39 | $self, | ||
| 40 | -1, | ||
| 41 | "Simple buttin with click event", | ||
| 42 | Wx::wxDefaultPosition, | ||
| 43 | Wx::wxDefaultSize, | ||
| 44 | ); | ||
| 45 | |||
| 46 | Wx::Event::EVT_BUTTON( | ||
| 47 | $self, | ||
| 48 | $self->{simple_button}, | ||
| 49 | sub { | ||
| 50 | shift->simple_button_click(@_); | ||
| 51 | }, | ||
| 52 | ); | ||
| 53 | |||
| 54 | my $bSizer1 = Wx::BoxSizer->new(Wx::wxVERTICAL); | ||
| 55 | $bSizer1->Add( $self->{m_staticText1}, 0, Wx::wxALL, 5 ); | ||
| 56 | $bSizer1->Add( $self->{m_staticline1}, 0, Wx::wxEXPAND | Wx::wxALL, 5 ); | ||
| 57 | $bSizer1->Add( $self->{simple_button}, 0, Wx::wxALL, 5 ); | ||
| 58 | |||
| 59 | $self->SetSizer($bSizer1); | ||
| 60 | $self->Layout; | ||
| 61 | |||
| 62 | return $self; | ||
| 63 | } | ||
| 64 | |||
| 65 | sub simple_button_click { | ||
| 66 | die 'Handler method simple_button_click for event simple_button.OnButtonClick not implemented'; | ||
| 67 | } | ||
| 68 | |||
| 69 | 1; |