Source

Kephra / lib / Kephra / App / Frame.pm

use v5.12;
use warnings;
use Wx;
use Kephra::API;


package Kephra::App::Frame;
our @ISA = 'Wx::Frame';
our $_ref;
my $title_end = "$Kephra::NAME $Kephra::VERSION";

#Kephra::CommandList::register_cmd({
 #'window-fullscreen-toggle'=>{sub => '$win->toggle_fullscreen', label=>'Fullscreen', keys=>'F11'},
 #'iounit-focus'            =>{sub =>'$win->{"part"}{"iounit"}->focus_on_input', label => ' ', keys => 'esc'},
#});


sub new {
	my( $class, $title ) = @_;
	my( $self ) = $_ref = $class->SUPER::new ( undef, -1, $title, [-1,-1],[1000, 800] );
	$self->SetIcon( Wx::GetWxPerlIcon() );
	Kephra::App::Focus::set($self);

	#Wx::Event::EVT_CLOSE( $self, sub{ Kephra::App::close_save() });

	return $self;
}

sub close   { $_ref->Close() }
sub destroy { $_ref->Destroy() }

sub get_title { $_ref->GetTitle( )       }
sub set_title { $_ref->SetTitle( $_[1] ) }
sub refresh_title {
	my $self = shift;
	my $doc = Kephra::API::document();
	return $self->set_title( $title_end ) unless defined $doc and $doc;

	my $title = $doc->title;
	$title .= ' ('.$doc->file_path.')' if $doc->file_path;
	$self->set_title( $title . " - $title_end" );
}

sub toggle_fullscreen {
	my ($self) = @_;
	$self->{fullscreen} ^= 1;
	$self->ShowFullScreen ( 
		$self->{fullscreen}, 
		&Wx::wxFULLSCREEN_NOCAPTION | &Wx::wxFULLSCREEN_NOBORDER
	);
}

1;
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.