| 1 | package Term::Fabulous::Event::Choose; | ||
| 2 | |||
| 3 | use v5.32; | ||
| 4 | use warnings; | ||
| 5 | use feature 'signatures'; | ||
| 6 | no warnings 'experimental::signatures'; | ||
| 7 | |||
| 8 | our $VERSION = '0.05'; | ||
| 9 | |||
| 10 | use Object::Pad 0.825; | ||
| 11 | |||
| 12 | use Clay::UI::Events::Event; | ||
| 13 | |||
| 14 | class Term::Fabulous::Event::Choose :isa(Clay::UI::Events::Event) :strict(params) { | ||
| 15 | use Scalar::Util qw(blessed); | ||
| 16 | use Term::Fabulous::Check qw(describe non_negative_integer); | ||
| 17 | |||
| 18 | field $command :param :reader; | ||
| 19 | field $index :param :reader; | ||
| 20 | |||
| 21 | ADJUST { | ||
| 22 | die "Term::Fabulous::Event::Choose: command must be a Term::Fabulous::Command, got " . describe($command) unless blessed $command && $command->isa('Term::Fabulous::Command'); | ||
| 23 | $index = non_negative_integer( $self, index => $index ); | ||
| 24 | } | ||
| 25 | |||
| 26 | method event_name :common { 'Choose' } | ||
| 27 | } | ||
| 28 | |||
| 29 | 1; | ||
| 30 | |||
| 31 | __END__ |