Testfile template file with line numbers

001 package Syntax::Kamelon::Wx::PluggableTextCtrl; 002 003 use strict; 004 use warnings; 005 use Carp; 006 007 use vars qw($VERSION); 008 $VERSION="0.01"; 009 010 use Wx qw( :textctrl :font :colour ); 011 use Wx::DND; 012 use Wx qw( wxTheClipboard ); 013 use base qw( Wx::TextCtrl ); 014 use Wx::Event qw( EVT_CHAR ); 015 016 require Syntax::Kamelon::Wx::PluggableTextCtrl::KeyEchoes; 017 require Syntax::Kamelon::Wx::PluggableTextCtrl::UndoRedo; 018 require Syntax::Kamelon::Wx::PluggableTextCtrl::Highlighter; 019 020 my $defaultfont = [10, wxFONTFAMILY_MODERN, wxFONTSTYLE_NORMAL, wxFONTWEIGHT_NORMAL, 0]; 021 022 my $debug = 0; 023 024 if ($debug) { 025 use Data::Dumper; 026 } 027 028 sub new { 029 my $class = shift; 030 my $self = $class->SUPER::new(@_); 031 032 $self->{CALLBACK} = sub {}; 033 $self->{COMMANDS} = { 034 'doremove' => \&DoRemove, 035 'doreplace' => \&DoReplace, 036 'dowrite' => \&DoWrite, 037 }; 038 $self->{LISTENING} = 0; 039 040 $self->{OVRMODE} = 0; 041 $self->{PLUGINS} = []; 042 043 $self->SetFont( Wx::Font->new(@$defaultfont) ); 044 EVT_CHAR($self, \&OnChar); 045 046 return $self; 047 } 048 049 sub AppendText { 050 my $self = shift; 051 unless ($self->Broadcast('append', @_)) { 052 $self->SUPER::Append(@_); 053 } 054 } 055 056 sub Broadcast { 057 my $self = shift; 058 my $plugs = $self->{PLUGINS}; 059 my $flag = 0; 060 foreach (@$plugs) { 061 if ($_->Receive(@_)) { 062 $flag = 1; 063 } 064 } 065 return $flag; 066 } 067 068 069 070 1; 071 __END__