« blib/lib/Gapp/Meta/Widget/Native/Trait/ListFormField.pm
↑ Summary
blib/lib/Gapp/Action/Undefined.pm »
| 1 | package Gapp::Moose::Role; | ||
| 2 | { | ||
| 3 | $Gapp::Moose::Role::VERSION = '0.60'; | ||
| 4 | } | ||
| 5 | |||
| 6 | use Moose::Role; | ||
| 7 | use Moose::Meta::Method; | ||
| 8 | use Moose::Exporter; | ||
| 9 | |||
| 10 | use Gapp; | ||
| 11 | use Gapp::Gtk2; | ||
| 12 | use Gapp::Moose::Meta::Attribute::Trait::GappActionGroup; | ||
| 13 | use Gapp::Moose::Meta::Attribute::Trait::GappAssistant; | ||
| 14 | use Gapp::Moose::Meta::Attribute::Trait::GappCheckButton; | ||
| 15 | use Gapp::Moose::Meta::Attribute::Trait::GappComboBox; | ||
| 16 | use Gapp::Moose::Meta::Attribute::Trait::GappBox; | ||
| 17 | use Gapp::Moose::Meta::Attribute::Trait::GappButton; | ||
| 18 | use Gapp::Moose::Meta::Attribute::Trait::GappDateEntry; | ||
| 19 | use Gapp::Moose::Meta::Attribute::Trait::GappEntry; | ||
| 20 | use Gapp::Moose::Meta::Attribute::Trait::GappEventBox; | ||
| 21 | use Gapp::Moose::Meta::Attribute::Trait::GappExpander; | ||
| 22 | use Gapp::Moose::Meta::Attribute::Trait::GappFileChooserButton; | ||
| 23 | use Gapp::Moose::Meta::Attribute::Trait::GappFileChooserDialog; | ||
| 24 | use Gapp::Moose::Meta::Attribute::Trait::GappFileFilter; | ||
| 25 | use Gapp::Moose::Meta::Attribute::Trait::GappFrame; | ||
| 26 | use Gapp::Moose::Meta::Attribute::Trait::GappHBox; | ||
| 27 | use Gapp::Moose::Meta::Attribute::Trait::GappHButtonBox; | ||
| 28 | use Gapp::Moose::Meta::Attribute::Trait::GappImage; | ||
| 29 | use Gapp::Moose::Meta::Attribute::Trait::GappLabel; | ||
| 30 | use Gapp::Moose::Meta::Attribute::Trait::GappListStore; | ||
| 31 | use Gapp::Moose::Meta::Attribute::Trait::GappDefault; | ||
| 32 | use Gapp::Moose::Meta::Attribute::Trait::GappDialog; | ||
| 33 | use Gapp::Moose::Meta::Attribute::Trait::GappMenu; | ||
| 34 | use Gapp::Moose::Meta::Attribute::Trait::GappMenuBar; | ||
| 35 | use Gapp::Moose::Meta::Attribute::Trait::GappScrolledWindow; | ||
| 36 | use Gapp::Moose::Meta::Attribute::Trait::GappSpinButton; | ||
| 37 | use Gapp::Moose::Meta::Attribute::Trait::GappStatusIcon; | ||
| 38 | use Gapp::Moose::Meta::Attribute::Trait::GappTable; | ||
| 39 | use Gapp::Moose::Meta::Attribute::Trait::GappTextView; | ||
| 40 | use Gapp::Moose::Meta::Attribute::Trait::GappTimeEntry; | ||
| 41 | use Gapp::Moose::Meta::Attribute::Trait::GappToolbar; | ||
| 42 | use Gapp::Moose::Meta::Attribute::Trait::GappTreeView; | ||
| 43 | use Gapp::Moose::Meta::Attribute::Trait::GappUIManager; | ||
| 44 | use Gapp::Moose::Meta::Attribute::Trait::GappWindow; | ||
| 45 | use Gapp::Moose::Meta::Attribute::Trait::GappWidget; | ||
| 46 | use Gapp::Moose::Meta::Attribute::Trait::GappVBox; | ||
| 47 | use Gapp::Moose::Meta::Attribute::Trait::GappVButtonBox; | ||
| 48 | |||
| 49 | Moose::Exporter->setup_import_methods( | ||
| 50 | with_meta => ['widget'], | ||
| 51 | also => [ 'Moose::Role' ], | ||
| 52 | ); | ||
| 53 | |||
| 54 | sub init_meta { | ||
| 55 | shift; | ||
| 56 | return Moose::Role->init_meta( @_ ); | ||
| 57 | } | ||
| 58 | |||
| 59 | sub widget { | ||
| 60 | my $meta = shift; | ||
| 61 | my $name = shift; | ||
| 62 | |||
| 63 | Moose->throw_error('Usage: widget \'name\' => ( key => value, ... )') if @_ % 2 == 1; | ||
| 64 | |||
| 65 | my %args = @_; | ||
| 66 | |||
| 67 | # apply GtkWidget trait | ||
| 68 | $args{traits} = [] if ! exists $args{traits}; | ||
| 69 | push @{ $args{traits} }, 'GappWidget'; | ||
| 70 | |||
| 71 | # pass on to moose to handle | ||
| 72 | &Moose::Role::has( $meta, $name, %args ); | ||
| 73 | } | ||
| 74 | |||
| 75 | 1; | ||
| 76 | |||
| 77 | |||
| 78 | |||
| 79 | |||
| 80 | |||
| 81 | __END__ |