Source

Kephra / lib / doubled.pl

Full commit
use v5.12;
use warnings;

DoubleView->new->MainLoop;

package DoubleView;
use base qw(Wx::App);
use Wx;
use WX::STC;

sub OnInit {
	my $app   = shift;
	my $win = Wx::Frame->new( undef, -1, 'DVD - Double View Demo',[-1, -1],[600, 600]);
	my $ed1 = Wx::StyledTextCtrl->new($win, -1, );
	my $ed2 = Wx::StyledTextCtrl->new($win, -1, );


	$ed2->SetDocPointer( $ed1->GetDocPointer() );
	Wx::Window::SetFocus( $ed1 );

	Wx::Event::EVT_KEY_DOWN ($ed1, sub {
		my ($self, $event) = @_;
		my $code = $event->GetUnicodeKey;
		if($code == &Wx::WXK_TAB and $event->ControlDown){ Kephra::App::Focus::set($ed2) }
		else {$event->Skip}
	});
	Wx::Event::EVT_KEY_DOWN ($ed2, sub {
		my ($self, $event) = @_;
		my $code = $event->GetUnicodeKey;
		if($code == &Wx::WXK_TAB and $event->ControlDown){ Kephra::App::Focus::set($ed1) }
		else {$event->Skip}
	});

	my $sizer = Wx::BoxSizer->new( &Wx::wxHORIZONTAL);
	$sizer->Add($ed1, 1, &Wx::wxGROW);
	$sizer->Add($ed2, 1, &Wx::wxGROW);
	$win->SetSizer($sizer);

	$win->Center();
	$win->Show(1);
	$app->SetTopWindow($win);
	1;
}