Source

Kephra / lib / Kephra / App / Panel / IOUnit.pm

Full commit
use strict;
use warnings;
use Wx::AUI;
use Kephra::App::Helper;

package Kephra::App::Panel::IOUnit;
our @ISA = 'Wx::Panel';

my ($input, $output, %outputtext);
my @slot = qw/drum log perl output shell all/;

sub new {
    my( $class, $parent) = @_;
    my $op = $class->SUPER::new($parent, -1);
    
    $input = Wx::RichTextCtrl->new($op, -1, '', [-1,-1], [-1, 29]);
    $output = Wx::AuiNotebook->new(
        $op, -1, [-1,-1], [-1, -1],
        &Wx::wxAUI_NB_TOP | &Wx::wxAUI_NB_TAB_MOVE
    );
    for my $slot (@slot) {
        $outputtext{ $slot } = Wx::TextCtrl->new(
            $output, -1, '', [-1,-1], [-1,-1],
            &Wx::wxTE_MULTILINE | &Wx::wxTE_READONLY
        );
        $output->AddPage ( $outputtext{ $slot }, $slot, 0 );

        Wx::Event::EVT_TEXT_ENTER($outputtext{ $slot }, -1, sub {
            
        });
    }

    Wx::Event::EVT_AUINOTEBOOK_BEGIN_DRAG  ( $output, -1, sub { });
    Wx::Event::EVT_AUINOTEBOOK_END_DRAG    ( $output, -1, sub { });
    Wx::Event::EVT_AUINOTEBOOK_PAGE_CHANGED( $output, -1, sub { });


    my $sizer = Wx::BoxSizer->new( &Wx::wxVERTICAL );
    $sizer->Add( $output, 1, &Wx::wxGROW);
    $sizer->Add( $input,  0, &Wx::wxGROW);
    $op->SetSizer( $sizer );

    return $op;
}

sub set_focus { Wx::Window::SetFocus( $input ) }

1;