Source

Kephra / lib / Kephra / App.pm

use strict;
use warnings;

use Wx;
use Kephra::API;
use Kephra::App::Window;
use Kephra::CommandList;
use Kephra::Config::Global;

package Kephra::App;
our @ISA = 'Wx::App';
our $_ref;

Kephra::CommandList::register_cmd({
	'app-close-save' => {
		sub => 'Kephra::API::app()->close_save()',
		label => 'Exit', keys  => 'alt + q',
		help => ''},
});

sub OnInit {
	$_ref = shift;
	Kephra::CommandList::init();

	my $win = Kephra::App::Window->new(__PACKAGE__);
	Kephra::File::new();

	$win->Center();
	$win->Refresh();   # remove visual clutter on start
	$win->Show();

	1;
}

sub close_save {
	close_raw();
}

sub close_raw  {
	
	my $win = Kephra::API::main_window();
	$win->destroy();
}

sub OnExit {
	my $app = shift;
	Wx::wxTheClipboard->Flush;
	1;
}

# $app->ExitMainLoop(1);
1;