Alt-Tickit-Widgets-ObjectPad
view release on metacpan or search on metacpan
lib/Tickit/Widget/CheckButton.pm view on Meta::CPAN
# You may distribute under the terms of either the GNU General Public License
# or the Artistic License (the same terms as Perl itself)
#
# (C) Paul Evans, 2013-2020 -- leonerd@leonerd.org.uk
use Object::Pad 0.09;
class Tickit::Widget::CheckButton 0.29
extends Tickit::Widget;
use Tickit::Style;
use Carp;
use Tickit::Utils qw( textwidth );
use List::Util 1.33 qw( any );
use constant CAN_FOCUS => 1;
=head1 NAME
C<Tickit::Widget::CheckButton> - a widget allowing a toggle true/false option
=head1 SYNOPSIS
use Tickit;
use Tickit::Widget::CheckButton;
use Tickit::Widget::VBox;
my $vbox = Tickit::Widget::VBox->new;
$vbox->add( Tickit::Widget::CheckButton->new(
label => "Check button $_",
) ) for 1 .. 5;
Tickit->new( root => $vbox )->run;
=head1 DESCRIPTION
This class provides a widget which allows a true/false selection. It displays
a clickable indication of status and a caption. Clicking on the status or
caption inverts the status of the widget.
This widget is part of an experiment in evolving the design of the
L<Tickit::Style> widget integration code, and such is subject to change of
details.
=head1 STYLE
The default style pen is used as the widget pen. The following style pen
prefixes are also used:
=over 4
=item check => PEN
The pen used to render the check marker
=back
The following style keys are used:
=over 4
=item check => STRING
The text used to indicate the active status
=item spacing => INT
Number of columns of spacing between the check mark and the caption text
=back
The following style tags are used:
=over 4
=item :active
Set when this button's status is true
=back
The following style actions are used:
=over 4
=item toggle
The main action to activate the C<on_click> handler.
=back
=cut
style_definition base =>
check_fg => "hi-white",
check_b => 1,
check => "[ ]",
( run in 1.003 second using v1.01-cache-2.11-cpan-39bf76dae61 )