NAME
Curses::UI::Number - Create and manipulate number widgets.
CLASS HIERARCHY
Curses::UI::Widget
|
+----Curses::UI::Label
|
+----Curses::UI::Number
SYNOPSIS
use Curses::UI;
my $win = $cui->add('window_id', 'Window');
my $number = $win->add(
'mynum', 'Curses::UI::Number',
-num => 5,
);
$number->draw;
DESCRIPTION
Curses::UI::Number is a widget that shows a number in graphic form.
STANDARD OPTIONS
-parent
, -x
, -y
, -width
, -height
, -pad
, -padleft
, -padright
, -padtop
, -padbottom
, -ipad
, -ipadleft
, -ipadright
, -ipadtop
, -ipadbottom
, -title
, -titlefullwidth
, -titlereverse
, -onfocus
, -onblur
.
For an explanation of these standard options, see Curses::UI::Widget.
REMOVED OPTIONS
-text
.
WIDGET-SPECIFIC OPTIONS
-num
< NUMBER >Number. Default value is undef.
-char
< CHARACTER >Foreground color. Possible values are defined in Curses::UI::Color. Default value is '█'.
STANDARD METHODS
layout
, draw
, intellidraw
, focus
, onFocus
, onBlur
.
For an explanation of these standard methods, see Curses::UI::Widget.
WIDGET-SPECIFIC METHODS
new(%parameters)
Constructor. Create widget with volume in graphic form, defined by -volume number. Returns object.
num([$number])
Get or set number. Returns number (0 - 9).
EXAMPLE1
# Pragmas.
use strict;
use warnings;
# Modules.
use Curses::UI;
# Object.
my $cui = Curses::UI->new;
# Main window.
my $win = $cui->add('window_id', 'Window');
# Add volume.
$win->add(
undef, 'Curses::UI::Number',
'-num' => 5,
);
# Binding for quit.
$win->set_binding(\&exit, "\cQ", "\cC");
# Loop.
$cui->mainloop;
EXAMPLE2
# Pragmas.
use strict;
use warnings;
# Modules.
use Curses::UI;
# Object.
my $cui = Curses::UI->new(
-color_support => 1,
);
# Main window.
my $win = $cui->add('window_id', 'Window');
# Add number.
my $num = $win->add(
undef, 'Curses::UI::Number',
'-border' => 1,
'-num' => 0,
);
# Binding for quit.
$win->set_binding(\&exit, "\cQ", "\cC");
# Time.
$cui->set_timer(
'timer',
sub {
my $act = $num->num;
$act += 1;
if ($act > 9) {
$act = 0;
}
$num->num($act);
return;
},
1,
);
# Loop.
$cui->mainloop;
DEPENDENCIES
Curses::UI::Common, Curses::UI::Label, Curses::UI::Widget, Encode.
SEE ALSO
Curses::UI, Curses::UI::Widget.
REPOSITORY
https://github.com/tupinek/Curses-UI-Number
AUTHOR
Michal Špaček mailto:skim@cpan.org
LICENSE AND COPYRIGHT
BSD license.
DEDICATION
To Czech Perl Workshop 2014 and their organizers.
VERSION
0.01