| 1 | package Gapp::TreeStore; | ||
| 2 | { | ||
| 3 | $Gapp::TreeStore::VERSION = '0.60'; | ||
| 4 | } | ||
| 5 | |||
| 6 | use Moose; | ||
| 7 | use MooseX::SemiAffordanceAccessor; | ||
| 8 | use MooseX::Types::Moose qw( HashRef ); | ||
| 9 | |||
| 10 | extends 'Gapp::Object'; | ||
| 11 | |||
| 12 | |||
| 13 | has '+gclass' => ( | ||
| 14 | default => 'Gtk2::TreeStore', | ||
| 15 | ); | ||
| 16 | |||
| 17 | has 'columns' => ( | ||
| 18 | is => 'rw', | ||
| 19 | isa => 'ArrayRef', | ||
| 20 | default => sub { [ ] }, | ||
| 21 | ); | ||
| 22 | |||
| 23 | has 'content' => ( | ||
| 24 | is => 'rw', | ||
| 25 | isa => 'ArrayRef', | ||
| 26 | default => sub { [ ] }, | ||
| 27 | ); | ||
| 28 | |||
| 29 | sub BUILDARGS { | ||
| 30 | my $class = shift; | ||
| 31 | my %args = @_ == 1 && is_HashRef( $_[0] ) ? %{$_[0]} : @_; | ||
| 32 | |||
| 33 | if ( exists $args{columns} ) { | ||
| 34 | $args{args} = [ @{ $args{columns} } ] if ! exists $args{args}; | ||
| 35 | } | ||
| 36 | |||
| 37 | __PACKAGE__->SUPER::BUILDARGS( %args ); | ||
| 38 | } | ||
| 39 | |||
| 40 | 1; | ||
| 41 | |||
| 42 | |||
| 43 | |||
| 44 | __END__ |