App-Lorem-Tickit
view release on metacpan or search on metacpan
Tickit/TextWidget.pm view on Meta::CPAN
use strict;
use warnings;
use Tickit::Pen;
our $VERSION = 0.01;
sub new {
my ($class, %args) = @_;
my $self = $class->SUPER::new(%args);
$self->{'_lines'} = [''];
$self->{'_width'} = 76;
return $self;
}
sub lines {
my $self = shift;
return scalar @{$self->{'_lines'}};
Tickit/Widget.pm view on Meta::CPAN
use Text::Lorem;
use Tickit::Pen;
use Tickit::Widget::Choice;
use Tickit::Widget::ScrollBox;
our $VERSION = 0.01;
sub new {
my ($class, %args) = @_;
my $self = $class->SUPER::new(%args);
$self->{'_counts'} = {
'paragraphs' => 3,
'sentences' => 8,
'words' => 50,
};
$self->{'_lorem'} = Text::Lorem->new;
$self->{'_version'} = $args{'version'} || $VERSION;
$self->{'_choice'} = Tickit::Widget::Choice->new(
'choices' => [
['paragraphs', 'paragraphs'],
Tickit/Widget.pm view on Meta::CPAN
return 40;
}
sub lines {
return 10;
}
sub window_gained {
my $self = shift;
$self->SUPER::window_gained(@_);
$self->reshape;
return;
}
sub window_lost {
my $self = shift;
if ($self->{'_choice'}->window) {
$self->{'_choice'}->window->close;
$self->{'_choice'}->set_window(undef);
}
if ($self->{'_scrollbox'}->window) {
$self->{'_scrollbox'}->window->close;
$self->{'_scrollbox'}->set_window(undef);
}
$self->SUPER::window_lost(@_);
return;
}
sub on_key {
my $self = shift;
my ($ev) = @_;
my $key = $ev->str;
if ($key eq '+') {
( run in 2.073 seconds using v1.01-cache-2.11-cpan-8f98c5d2c55 )