App-passmanager

 view release on metacpan or  search on metacpan

lib/App/PassManager/Role/CursesWin.pm  view on Meta::CPAN

package App::PassManager::Role::CursesWin;
{
  $App::PassManager::Role::CursesWin::VERSION = '1.113580';
}
use Moose::Role;

with 'App::PassManager::Role::Content';

use Curses::UI;
use Scalar::Util 'weaken';

has _ui_options => (
    is => 'rw',
    isa => 'HashRef',
    auto_deref => 1,
    lazy_build => 1,
    accessor => 'ui_options',
);
sub _build__ui_options {    
    return {
        -clear_on_exit => 1,
        -color_support => 1,
        -mouse_support => 0,
    };
}

has '_ui' => (
    is => 'ro',
    isa => 'Curses::UI',
    reader => 'ui',
    lazy_build => 1,
);

# must be lazy otherwise Curses::UI nobbles help output
sub _build__ui {
    my $self = shift;
    my $ui = Curses::UI->new( $self->ui_options );
    $ui->set_binding( sub { $self->abort   }, "\cR" );  # ctrl-r
    $ui->set_binding( sub { $self->cleanup }, "\cQ" );  # ctrl-q
    # $ui->set_binding( sub { $self->cleanup }, "\x1b" ); # escape
    return $ui;
}

has '_windows' => (
    is => 'ro',
    isa => 'HashRef',
    reader => 'win',
    default => sub { {} },
);

has '_win_config' => (
    is => 'ro',
    isa => 'HashRef',
    reader => 'win_config',
    auto_deref => 1,
    lazy_build => 1,
);

sub _build__win_config {
    return {
        -border       => 1, 
        -titlereverse => 0, 
        -padbottom    => 1,
        -ipad         => 1,
    }
}

sub new_root_win {
    my $self = shift;



( run in 2.075 seconds using v1.01-cache-2.11-cpan-5837b0d9d2c )