| 1 | package Gapp::TimeEntry; | ||
| 2 | { | ||
| 3 | $Gapp::TimeEntry::VERSION = '0.60'; | ||
| 4 | } | ||
| 5 | |||
| 6 | use Moose; | ||
| 7 | use MooseX::SemiAffordanceAccessor; | ||
| 8 | |||
| 9 | use Gapp::Gtk2::DateEntry; | ||
| 10 | |||
| 11 | extends 'Gapp::Entry'; | ||
| 12 | with 'Gapp::Meta::Widget::Native::Role::FormField'; | ||
| 13 | |||
| 14 | has '+gclass' => ( | ||
| 15 | default => 'Gapp::Gtk2::TimeEntry', | ||
| 16 | ); | ||
| 17 | |||
| 18 | |||
| 19 | sub BUILDARGS { | ||
| 20 | my $class = shift; | ||
| 21 | my %args = @_ == 1 && is_HashRef( $_[0] ) ? %{$_[0]} : @_; | ||
| 22 | |||
| 23 | |||
| 24 | for my $att ( qw(value) ) { | ||
| 25 | $args{properties}{$att} = delete $args{$att} if exists $args{$att}; | ||
| 26 | } | ||
| 27 | |||
| 28 | __PACKAGE__->SUPER::BUILDARGS( %args ); | ||
| 29 | } | ||
| 30 | |||
| 31 | # returns the value of the widget | ||
| 32 | sub get_field_value { | ||
| 33 | $_[0]->gobject->get_value; | ||
| 34 | } | ||
| 35 | |||
| 36 | sub set_field_value { | ||
| 37 | my ( $self, $value ) = @_; | ||
| 38 | $self->gobject->set_value( $value ); | ||
| 39 | } | ||
| 40 | |||
| 41 | sub _connect_changed_handler { | ||
| 42 | my ( $self ) = @_; | ||
| 43 | |||
| 44 | $self->gobject->signal_connect ( | ||
| 45 | 'value-changed' => sub { $self->_widget_value_changed }, | ||
| 46 | ); | ||
| 47 | } | ||
| 48 | |||
| 49 | |||
| 50 | 1; | ||
| 51 | |||
| 52 | |||
| 53 | __END__ |