| 1 | package TUI::Dialogs::CheckBoxes; | ||
| 2 | # ABSTRACT: Multi-item checkbox cluster control based on TCluster | ||
| 3 | |||
| 4 | 7 | ▶ | use 5.010; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 5 | 7 | ▶ | use strict; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 6 | 7 | ▶ | use warnings; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 7 | |||
| 8 | 7 | our $VERSION = '2.000002'; | |
| 9 | 7 | $VERSION =~ tr/_//d; | |
| 10 | 7 | our $AUTHORITY = 'cpan:BRICKPOOL'; | |
| 11 | |||
| 12 | 7 | ▶ | use Exporter 'import'; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 13 | |||
| 14 | 7 | our @EXPORT = qw( | |
| 15 | TCheckBoxes | ||
| 16 | new_TCheckBoxes | ||
| 17 | ); | ||
| 18 | |||
| 19 | 7 | ▶ | use TUI::toolkit; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 20 | 7 | ▶ | use TUI::toolkit::Types qw( Object Int ); |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 21 | |||
| 22 | 7 | ▶ | use TUI::Dialogs::Cluster; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 23 | |||
| 24 | sub TCheckBoxes() { __PACKAGE__ } | ||
| 25 | sub name() { 'TCheckBoxes' } | ||
| 26 | 0 | ▶ | sub new_TCheckBoxes { __PACKAGE__->from( @_ ) } |
|
Subroutine
new_TCheckBoxes: not called CC=1 SCAR=6.9
Pod
documented
| |||
| 27 | |||
| 28 | 7 | extends TCluster; | |
| 29 | |||
| 30 | # declare global variables | ||
| 31 | 7 | our $button = " [ ] "; | |
| 32 | |||
| 33 | 0 | ▶ | sub draw { # void () |
|
Subroutine
draw: not called CC=1 SCAR=6.9
Pod
documented
| |||
| 34 | 0 | state $sig = signature( | |
| 35 | method => Object, | ||
| 36 | pos => [], | ||
| 37 | ); | ||
| 38 | 0 | my ( $self ) = $sig->( @_ ); | |
| 39 | 0 | $self->drawMultiBox( $button, " X" ); | |
| 40 | 0 | return; | |
| 41 | } | ||
| 42 | |||
| 43 | 0 | ▶ | sub mark { # $bool ($item) |
|
Subroutine
mark: not called CC=1 SCAR=6.9
Pod
documented
| |||
| 44 | 0 | state $sig = signature( | |
| 45 | method => Object, | ||
| 46 | pos => [Int], | ||
| 47 | ); | ||
| 48 | 0 | my ( $self, $item ) = $sig->( @_ ); | |
| 49 | 0 | return ( $self->{value} & ( 1 << $item ) ) != 0; | |
| 50 | } | ||
| 51 | |||
| 52 | 0 | ▶ | sub press { # void ($item) |
|
Subroutine
press: not called CC=1 SCAR=6.9
Pod
documented
| |||
| 53 | 0 | state $sig = signature( | |
| 54 | method => Object, | ||
| 55 | pos => [Int], | ||
| 56 | ); | ||
| 57 | 0 | my ( $self, $item ) = $sig->( @_ ); | |
| 58 | 0 | $self->{value} = $self->{value} ^ ( 1 << $item ); | |
| 59 | 0 | return; | |
| 60 | } | ||
| 61 | |||
| 62 | 7 | 1 | |
| 63 | |||
| 64 | __END__ | ||