« blib/lib/Term/Fabulous/Event/PageChange.pm
↑ Summary
blib/lib/Term/Fabulous/Event/RowActivate.pm »
| 1 | package Term::Fabulous::Event::Resize; | ||
| 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::Resize :isa(Clay::UI::Events::Event) :strict(params) { | ||
| 15 | field $width :param :reader; | ||
| 16 | field $height :param :reader; | ||
| 17 | field $is_post_event :param :reader = 0; | ||
| 18 | |||
| 19 | method is_pre_event() { | ||
| 20 | return !$is_post_event; | ||
| 21 | } | ||
| 22 | |||
| 23 | method event_name :common { 'Resize' } | ||
| 24 | |||
| 25 | method of :common ($ev, $is_post_event = 0) { | ||
| 26 | return $class->new( | ||
| 27 | width => $ev->w, | ||
| 28 | height => $ev->h, | ||
| 29 | is_post_event => $is_post_event, | ||
| 30 | ); | ||
| 31 | } | ||
| 32 | } | ||
| 33 | |||
| 34 | 1; | ||
| 35 | |||
| 36 | __END__ |