| 1 | package Gapp::MenuItem; | ||
| 2 | { | ||
| 3 | $Gapp::MenuItem::VERSION = '0.60'; | ||
| 4 | } | ||
| 5 | |||
| 6 | use Moose; | ||
| 7 | use MooseX::SemiAffordanceAccessor; | ||
| 8 | |||
| 9 | extends 'Gapp::Bin'; | ||
| 10 | with 'Gapp::Meta::Widget::Native::Role::HasAction'; | ||
| 11 | with 'Gapp::Meta::Widget::Native::Role::HasLabel'; | ||
| 12 | with 'Gapp::Meta::Widget::Native::Role::HasMenu'; | ||
| 13 | with 'Gapp::Meta::Widget::Native::Role::HasMnemonic'; | ||
| 14 | |||
| 15 | has '+gclass' => ( | ||
| 16 | default => 'Gtk2::MenuItem', | ||
| 17 | ); | ||
| 18 | |||
| 19 | has '+constructor' => ( | ||
| 20 | default => 'new_with_label', | ||
| 21 | ); | ||
| 22 | |||
| 23 | has '+args' => ( | ||
| 24 | default => sub { [ '' ] }, | ||
| 25 | ); | ||
| 26 | |||
| 27 | has 'visible_func' => ( | ||
| 28 | is => 'rw', | ||
| 29 | isa => 'Maybe[CodeRef]', | ||
| 30 | ); | ||
| 31 | |||
| 32 | |||
| 33 | sub BUILDARGS { | ||
| 34 | my $class = shift; | ||
| 35 | my %args = @_ == 1 && is_HashRef( $_[0] ) ? %{$_[0]} : @_; | ||
| 36 | |||
| 37 | for my $att ( qw(accel_path) ) { | ||
| 38 | $args{properties}{$att} = delete $args{$att} if exists $args{$att}; | ||
| 39 | } | ||
| 40 | |||
| 41 | __PACKAGE__->SUPER::BUILDARGS( %args ); | ||
| 42 | } | ||
| 43 | |||
| 44 | |||
| 45 | |||
| 46 | 1; | ||
| 47 | |||
| 48 | |||
| 49 | __END__ |