App-Wx-PodEditor

 view release on metacpan or  search on metacpan

lib/App/Wx/PodEditor/Frame.pm  view on Meta::CPAN

use Wx::Perl::PodEditor;
use YAML::Tiny;

our $VERSION = 0.01;

sub new {
    my( $class ) = shift;
    
    my( $this ) = $class->SUPER::new( @_ );

    $this->CreateMyMenuBar();
    
    $this->CreateStatusBar(1);
    $this->SetToolBar( $this->_toolbar );
    $this->GetToolBar->Realize;
    $this->SetStatusText("Welcome!", 0);
    
    # insert main window here
        
    my $main_sizer   = Wx::BoxSizer->new( wxVERTICAL );
    my $editor       = $this->_editor;

lib/App/Wx/PodEditor/Frame.pm  view on Meta::CPAN

sub _editor {
    my ($self, $panel) = @_;
    
    unless( $self->{editor} ){
        $self->{editor} = Wx::Perl::PodEditor->create( $self, [500,220] );
    }

    $self->{editor};
}

sub CreateMyMenuBar {
    my( $this ) = shift;
    
    my $menuconf    = do{ local $/; <DATA> };
    my $config      = YAML::Tiny->read_string( $menuconf );
    
    my $menubar_def = $config->[0]->{full_menubar};
    my $menubar     = Wx::MenuBar->new();
    
    Wx::InitAllImageHandlers();
    
    for my $menu_def ( @$menubar_def ){
        for my $menu_id (keys %$menu_def){
            my $label = $menu_def->{$menu_id}->{label};
            my $items = $menu_def->{$menu_id}->{items};
            my $menu  = Wx::Menu->new();
            $this->create_static( $menu, $items );
            $menubar->Append( $menu, $label );
        }
    }
    
    $this->SetMenuBar( $menubar );
}

sub create_static{
    my $self     = shift;
    my $menu     = shift;
    my $menu_def = shift;

    return unless ref $menu_def eq 'ARRAY';
    
    for my $elem ( @$menu_def ){



( run in 1.499 second using v1.01-cache-2.11-cpan-49f99fa48dc )