[4718] | 1 | package Uploader::GUI::wxPropertyListDlg; |
---|
| 2 | use strict; |
---|
| 3 | use Wx qw/ |
---|
| 4 | wxDefaultSize |
---|
| 5 | wxDefaultPosition |
---|
| 6 | wxLIST_AUTOSIZE |
---|
| 7 | wxDEFAULT_DIALOG_STYLE |
---|
| 8 | |
---|
| 9 | wxMAXIMIZE_BOX |
---|
| 10 | wxMINIMIZE_BOX |
---|
| 11 | |
---|
| 12 | wxSTAY_ON_TOP |
---|
| 13 | /; |
---|
| 14 | use Wx::Locale qw/:default/; |
---|
| 15 | use base qw/Wx::Dialog Uploader::Object2/; |
---|
| 16 | |
---|
| 17 | use Data::Dumper; |
---|
| 18 | __PACKAGE__->mk_accessors( |
---|
| 19 | qw/ |
---|
| 20 | properties |
---|
| 21 | list |
---|
| 22 | / |
---|
| 23 | ); |
---|
| 24 | |
---|
| 25 | |
---|
| 26 | |
---|
| 27 | sub new { |
---|
| 28 | my ($this, $params) = @_; |
---|
| 29 | #on recupere le nom de la classe en fonction du type d'appel de la méthode. |
---|
| 30 | my $class = ref($this) || $this; |
---|
| 31 | |
---|
| 32 | |
---|
| 33 | my $self = $class->SUPER::new( |
---|
| 34 | undef, |
---|
| 35 | -1, |
---|
| 36 | gettext("Exif properties"), |
---|
| 37 | wxDefaultPosition, |
---|
| 38 | wxDefaultSize, |
---|
| 39 | wxDEFAULT_DIALOG_STYLE| |
---|
| 40 | |
---|
| 41 | wxMAXIMIZE_BOX| |
---|
| 42 | wxMINIMIZE_BOX| |
---|
| 43 | |
---|
| 44 | wxSTAY_ON_TOP |
---|
| 45 | |
---|
| 46 | ); |
---|
| 47 | |
---|
| 48 | &main::image_prop_exif($self); |
---|
| 49 | |
---|
| 50 | $self->properties( |
---|
| 51 | $params->{properties} |
---|
| 52 | ); |
---|
| 53 | $self->list( |
---|
| 54 | $self->FindWindow($main::IMG_PROP_EXIF_LIST) |
---|
| 55 | ); |
---|
| 56 | |
---|
| 57 | $self->{img_exif_prop_close} = $self->FindWindow($main::IMG_PROP_EXIF_CLOSE); |
---|
| 58 | |
---|
| 59 | $self->{img_exif_prop_close}->SetLabel( |
---|
| 60 | gettext("Close") |
---|
| 61 | ); |
---|
| 62 | |
---|
| 63 | Wx::Event::EVT_BUTTON( $self, $self->{img_exif_prop_close}, \&OnClose ); |
---|
| 64 | |
---|
| 65 | $self->list->InsertColumn(0, gettext("Property")); |
---|
| 66 | $self->list->InsertColumn(1, gettext("Value")); |
---|
| 67 | print Dumper $self->properties; |
---|
| 68 | |
---|
| 69 | $self; |
---|
| 70 | } |
---|
| 71 | |
---|
| 72 | |
---|
| 73 | sub Refresh { |
---|
| 74 | my ( $self ) = @_; |
---|
| 75 | |
---|
| 76 | $self->list->Freeze; |
---|
| 77 | $self->list->DeleteAllItems; |
---|
| 78 | my $i=0; |
---|
| 79 | map { |
---|
| 80 | $self->list->InsertStringItem($i, $_->{label}); |
---|
| 81 | $self->list->SetItem($i, 1, $_->{value}->()); |
---|
| 82 | $i++; |
---|
| 83 | }@{$self->properties}; |
---|
| 84 | $self->list->SetColumnWidth(0, wxLIST_AUTOSIZE ); |
---|
| 85 | $self->list->SetColumnWidth(1, wxLIST_AUTOSIZE ); |
---|
| 86 | $self->list->Thaw; |
---|
| 87 | } |
---|
| 88 | |
---|
| 89 | |
---|
| 90 | sub OnClose { |
---|
| 91 | my ( $self, $event ) = @_; |
---|
| 92 | |
---|
| 93 | $self->Hide; |
---|
| 94 | } |
---|
| 95 | |
---|
| 96 | 1; |
---|