App-Codit

 view release on metacpan or  search on metacpan

lib/App/Codit/CodeTextManager.pm  view on Meta::CPAN

package App::Codit::CodeTextManager;

=head1 NAME

App::Codit::CodeTextManaer - Content manager for App::Codit

=cut

use strict;
use warnings;
use Carp;
use vars qw($VERSION);
$VERSION = '0.19';
use Tk;
require Tk::CodeText;

use base qw(Tk::Derived Tk::AppWindow::BaseClasses::ContentManager);
Construct Tk::Widget 'CodeTextManager';

sub Populate {
	my ($self,$args) = @_;

	$self->SUPER::Populate($args);
	my $ext = $self->Extension;

	my $text = $self->CodeText(
		-contextmenu => $ext->ContextMenu,
		-height => 8,
		-keyreleasecall => ['KeyReleased', $self],
		-logcall => ['log', $self],
		-modifiedcall => ['Modified', $self],
		-saveimage => $ext->getArt('document-save', 16),
		-scrollbars => 'osoe',
		-width => 8,
	)->pack(-expand => 1, -fill => 'both');
	$self->CWidg($text);
	my $xt = $text->Subwidget('XText');
	$xt->bind('<Control-f>', sub { $ext->cmdExecute('doc_find') });
	$xt->bind('<Control-r>', sub { $ext->cmdExecute('doc_replace') });
	$self->{NAME} = '';

	$self->ConfigSpecs(
		-contentacpopsize => [{-acpopsize => $xt}],
		-contentacscansize => [{-acscansize => $xt}],
		-contentactivedelay => [{-activedelay => $xt}],
		-contentautobrackets => [{-autobrackets => $xt}],
		-contentautocomplete => [{-autocomplete => $xt}],
		-contentautoindent => [{-autoindent => $xt}],
		-contentbackground => [{-background => $xt}],
		-contentbgdspace => [{-spacebackground => $text}],
		-contentbgdtab => [{-tabbackground => $text}],
		-contentbookmarkcolor => [{-bookmarkcolor => $text}],
		-contentfindbg => ['PASSIVE'],
		-contentfindfg => ['PASSIVE'],
		-contentmatchbg => ['PASSIVE'],
		-contentmatchfg => ['PASSIVE'],
		-contentforeground => [{-foreground => $xt}],
#		-contentfont => [{-font => $xt}],
		-contentfontfamily => ['PASSIVE'],
		-contentfontsize => ['PASSIVE'],
		-contentindent => [{-indentstyle => $xt}],
		-contentposition => [{-position => $text}],
		-contentshowspaces => [{-showspaces => $text}],
		-contentsyntax => [{-syntax => $text}],
		-contenttabs => [{-tabs => $xt}],
		-contentwrap => [{-wrap => $xt}],
		-showfolds => [$text],
		-shownumbers => [$text],
		-showstatus => [$text],
		-highlight_themefile => [{ -themefile => $text}],
		DEFAULT => [$text],
	);
	$self->Delegates(
		DEFAULT => $text,
	);
	$self->after(10, ['configureTags', $self]);
}

sub Close {
	my $self = shift;
	$self->doClear;
	return 1;
}



( run in 0.648 second using v1.01-cache-2.11-cpan-99c4e6809bf )