| line | stmt | bran | cond | sub | pod | time | code | 
| 1 |  |  |  |  |  |  | package Devel::ebug::Wx; | 
| 2 |  |  |  |  |  |  |  | 
| 3 | 1 |  |  | 1 |  | 2472 | use Wx; | 
|  | 0 |  |  |  |  |  |  | 
|  | 0 |  |  |  |  |  |  | 
| 4 |  |  |  |  |  |  |  | 
| 5 |  |  |  |  |  |  | use strict; | 
| 6 |  |  |  |  |  |  | use base qw(Wx::Frame Devel::ebug::Wx::Service::Base Class::Accessor::Fast); | 
| 7 |  |  |  |  |  |  |  | 
| 8 |  |  |  |  |  |  | our $VERSION = '0.09'; | 
| 9 |  |  |  |  |  |  |  | 
| 10 |  |  |  |  |  |  | use Wx qw(:aui wxOK); | 
| 11 |  |  |  |  |  |  | use Wx::Event qw(EVT_CLOSE); | 
| 12 |  |  |  |  |  |  |  | 
| 13 |  |  |  |  |  |  | use Devel::ebug::Wx::ServiceManager; | 
| 14 |  |  |  |  |  |  | use Devel::ebug::Wx::ServiceManager::Holder; | 
| 15 |  |  |  |  |  |  | use Devel::ebug::Wx::Publisher; | 
| 16 |  |  |  |  |  |  |  | 
| 17 |  |  |  |  |  |  | __PACKAGE__->mk_ro_accessors( qw(ebug) ); | 
| 18 |  |  |  |  |  |  |  | 
| 19 |  |  |  |  |  |  | sub service_name { 'ebug_wx' } | 
| 20 |  |  |  |  |  |  | sub initialized  { 1 } | 
| 21 |  |  |  |  |  |  |  | 
| 22 |  |  |  |  |  |  | sub new { | 
| 23 |  |  |  |  |  |  | my( $class, $args ) = @_; | 
| 24 |  |  |  |  |  |  | my $self = $class->SUPER::new( undef, -1, 'wxebug', [-1, -1], [-1, 500] ); | 
| 25 |  |  |  |  |  |  |  | 
| 26 |  |  |  |  |  |  | EVT_CLOSE( $self, \&_on_close ); | 
| 27 |  |  |  |  |  |  |  | 
| 28 |  |  |  |  |  |  | $self->service_manager( Devel::ebug::Wx::ServiceManager->new ); | 
| 29 |  |  |  |  |  |  | $self->service_manager->add_service( Devel::ebug::Wx::Publisher->new ); # FIXME | 
| 30 |  |  |  |  |  |  | $self->service_manager->add_service( $self ); | 
| 31 |  |  |  |  |  |  | $self->{ebug} = $self->ebug_publisher_service; | 
| 32 |  |  |  |  |  |  |  | 
| 33 |  |  |  |  |  |  | $self->service_manager->initialize; | 
| 34 |  |  |  |  |  |  | $self->service_manager->load_configuration; | 
| 35 |  |  |  |  |  |  |  | 
| 36 |  |  |  |  |  |  | $self->ebug->add_subscriber( 'load_program', $self, '_pgm_load' ); | 
| 37 |  |  |  |  |  |  | $self->ebug->add_subscriber( 'finished', $self, '_pgm_stop' ); | 
| 38 |  |  |  |  |  |  |  | 
| 39 |  |  |  |  |  |  | $self->SetMenuBar( $self->command_manager_service->get_menu_bar ); | 
| 40 |  |  |  |  |  |  |  | 
| 41 |  |  |  |  |  |  | $self->ebug->load_program( $args->{argv} ); | 
| 42 |  |  |  |  |  |  |  | 
| 43 |  |  |  |  |  |  | return $self; | 
| 44 |  |  |  |  |  |  | } | 
| 45 |  |  |  |  |  |  |  | 
| 46 |  |  |  |  |  |  | sub _on_close { | 
| 47 |  |  |  |  |  |  | my( $self ) = @_; | 
| 48 |  |  |  |  |  |  |  | 
| 49 |  |  |  |  |  |  | $self->service_manager->finalize( $self ); | 
| 50 |  |  |  |  |  |  | $self->Destroy; | 
| 51 |  |  |  |  |  |  | } | 
| 52 |  |  |  |  |  |  |  | 
| 53 |  |  |  |  |  |  | sub _pgm_load { | 
| 54 |  |  |  |  |  |  | my( $self, $ebug, $event, %params ) = @_; | 
| 55 |  |  |  |  |  |  |  | 
| 56 |  |  |  |  |  |  | $self->SetTitle( $params{filename} ); | 
| 57 |  |  |  |  |  |  | } | 
| 58 |  |  |  |  |  |  |  | 
| 59 |  |  |  |  |  |  | sub _pgm_stop { | 
| 60 |  |  |  |  |  |  | my( $self, $ebug, $event, %params ) = @_; | 
| 61 |  |  |  |  |  |  |  | 
| 62 |  |  |  |  |  |  | Wx::MessageBox( "Program terminated", "wxebug", wxOK, $self ); | 
| 63 |  |  |  |  |  |  | } | 
| 64 |  |  |  |  |  |  |  | 
| 65 |  |  |  |  |  |  | 1; | 
| 66 |  |  |  |  |  |  |  | 
| 67 |  |  |  |  |  |  | __END__ |