File: demo.pl

package info (click to toggle)
libtickit-widget-floatbox-perl 0.11-1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, forky, sid, trixie
  • size: 128 kB
  • sloc: perl: 346; makefile: 2
file content (27 lines) | stat: -rwxr-xr-x 791 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
#!/usr/bin/perl

use strict;
use warnings;

use Tickit;
use Tickit::Widgets qw( Placegrid Box FloatBox );

my $tickit = Tickit->new(
   root => my $fb = Tickit::Widget::FloatBox->new
      ->set_base_child( Tickit::Widget::Placegrid->new )
);

my $float = $fb->add_float(
   child => Tickit::Widget::Box->new(
      child_lines => 5, child_cols => 20,
   )->set_child( Tickit::Widget::Placegrid->new( grid_fg => "red" ) ),
   top => 1, left => 1,
);

$tickit->bind_key( Up   => sub { $float->move( top => 1, bottom => undef ) } );
$tickit->bind_key( Down => sub { $float->move( top => undef, bottom => -2 ) } );

$tickit->bind_key( Left  => sub { $float->move( left => 1, right => undef ) } );
$tickit->bind_key( Right => sub { $float->move( left => undef, right => -2 ) } );

$tickit->run;