| 1 | package Gapp::FormButtons; | ||
| 2 | { | ||
| 3 | $Gapp::FormButtons::VERSION = '0.60'; | ||
| 4 | } | ||
| 5 | |||
| 6 | use Moose; | ||
| 7 | use MooseX::SemiAffordanceAccessor; | ||
| 8 | |||
| 9 | extends 'Gapp::HButtonBox'; | ||
| 10 | with 'Gapp::Meta::Widget::Native::Role::FormElement'; | ||
| 11 | |||
| 12 | |||
| 13 | use Gapp::Actions::Form qw( Ok Apply Cancel ); | ||
| 14 | |||
| 15 | |||
| 16 | has 'apply_button' => ( | ||
| 17 | is => 'rw', | ||
| 18 | isa => 'Maybe[Gapp::Button]', | ||
| 19 | default => sub { | ||
| 20 | Gapp::Button->new( action => [Apply] ), | ||
| 21 | }, | ||
| 22 | lazy => 1, | ||
| 23 | ); | ||
| 24 | |||
| 25 | has 'cancel_button' => ( | ||
| 26 | is => 'rw', | ||
| 27 | isa => 'Maybe[Gapp::Button]', | ||
| 28 | default => sub { | ||
| 29 | Gapp::Button->new( action => [Cancel] ), | ||
| 30 | }, | ||
| 31 | lazy => 1, | ||
| 32 | ); | ||
| 33 | |||
| 34 | has 'ok_button' => ( | ||
| 35 | is => 'rw', | ||
| 36 | isa => 'Maybe[Gapp::Button]', | ||
| 37 | default => sub { | ||
| 38 | Gapp::Button->new( action => [Ok], default => 1 ), | ||
| 39 | }, | ||
| 40 | lazy => 1, | ||
| 41 | ); | ||
| 42 | |||
| 43 | has '+content' => ( | ||
| 44 | default => sub { [ $_[0]->cancel_button, $_[0]->apply_button, $_[0]->ok_button ] }, | ||
| 45 | lazy => 1, | ||
| 46 | ); | ||
| 47 | |||
| 48 | |||
| 49 | |||
| 50 | |||
| 51 | 1; | ||
| 52 | |||
| 53 | |||
| 54 | __END__ |