Hobocamp
view release on metacpan or search on metacpan
dialog_vars.no_lines = FALSE;
}
else {
dialog_vars.ascii_lines = FALSE;
dialog_vars.no_lines = TRUE;
}
# -------- widgets --------
int
dialog_calendar(const char *title, const char *subtitle, int height, int width, int day = 1, int month = 1, int year = 1970)
int
dialog_checklist(title, prompt, height, width, list_height = 1, items_list, checklist_or_radio_flag = 1)
const char *title
const char *prompt
int height
int width
int list_height
SV *items_list
int checklist_or_radio_flag
lib/Hobocamp/Calendar.pm view on Meta::CPAN
package Hobocamp::Calendar;
{
$Hobocamp::Calendar::VERSION = '0.600';
}
use v5.10;
use warnings;
# ABSTRACT: calendar widget
use Moose;
with qw(Hobocamp::Role::Widget Hobocamp::Role::Window);
use Hobocamp::Dialog;
has 'day' => (
'is' => 'ro',
'isa' => 'Int',
lib/Hobocamp/Calendar.pm view on Meta::CPAN
has 'year' => (
'is' => 'ro',
'isa' => 'Int',
'default' => '1970'
);
sub run {
my ($self) = @_;
my $retcode = Hobocamp::Dialog::dialog_calendar($self->title, $self->prompt, $self->width, $self->height, $self->day, $self->month, $self->year);
$self->value($self->_get_user_input_result());
return $retcode;
}
1;
__END__
=pod
=head1 NAME
Hobocamp::Calendar - calendar widget
=head1 VERSION
version 0.600
=head1 DESCRIPTION
A widget to choose a date.
=head1 AUTHOR
lib/Hobocamp/Dialog.pm view on Meta::CPAN
DLG_EXIT_ERROR
DLG_EXIT_ESC
DLG_EXIT_EXTRA
DLG_EXIT_HELP
DLG_EXIT_ITEM_HELP
DLG_EXIT_OK
DLG_EXIT_UNKNOWN
);
my @widgets = qw(
dialog_calendar
dialog_checklist
dialog_dselect
dialog_editbox
dialog_fselect
dialog_gauge
dialog_inputbox
dialog_menu
dialog_msgbox
dialog_pause
dialog_textbox
lib/Hobocamp/Dialog.pm view on Meta::CPAN
=head1 MISSING WIDGETS
dialog_form, dialog_gauge, dialog_mixedform, dialog_mixedgauge, dialog_progressbox, dialog_tailbox
=head2 EXPORT
=head2 :widgets
=over
=item * C<dialog_calendar($title, $subtitle, $height, $width, $day, $month, $year)>
Defaults: C<$day = 1>, C<$month = 1>, C<$year = 1970>
Widget: L<Hobocamp::Calendar>
=item * C<dialog_checklist($title, $prompt, $height, $width, $list_height, [ { name => $name, text => $text, on => $bool }, ... ])>
Defaults: C<$list_height = 1>
Widget: L<Hobocamp::CheckList>
samples/widgets.pl view on Meta::CPAN
use Data::Dumper;
use Hobocamp;
my $c = Hobocamp->new;
$c->init();
my %items;
my @f;
my @t = (
'Calendar', 'calendar', 'CheckList', 'multiple select', 'DirectorySelect', 'directory selector',
'EditBox', 'edit multiple lines', 'Form', 'TODO', 'FileSelect', 'file selector',
'Gauge', 'TODO', 'InputBox', 'edit a single line', 'Menu', 'select 1 item from a list',
'MessageBox', 'message box', 'MixedForm', 'TODO', 'Pause', 'display a message for a period of time',
'RadioList', 'radio list', 'TailBox', 'TODO', 'TextBox', 'show text from a file',
'TimeBox', 'Choose a time', 'YesNo', 'yes or no?', 'Quit', 'Exit application'
);
for (my $i = 0; $i < scalar(@t); $i += 2) {
push(@f, {name => $t[$i], text => $t[ $i + 1 ]});
}
samples/widgets.pl view on Meta::CPAN
while (1) {
$menu->run;
my $widget;
my $v = $menu->value;
given ($v->{name}) {
when ('Calendar') {
$widget = Hobocamp::Calendar->new(title => "Calendar", "prompt" => "check out this awesome calendar!");
}
when ('CheckList') {
$widget = Hobocamp::CheckList->new(
items => [
{
name => 'item 1', 'text' => "thing 1"
},
{
name => 'item 2', "text" => "thing 2", "on" => 1
}
( run in 0.546 second using v1.01-cache-2.11-cpan-5dc5da66d9d )