package Uploader::GUI::wxPropertyListDlg; use strict; use Wx qw/ wxDefaultSize wxDefaultPosition wxLIST_AUTOSIZE wxDEFAULT_DIALOG_STYLE wxMAXIMIZE_BOX wxMINIMIZE_BOX wxSTAY_ON_TOP /; use Wx::Locale qw/:default/; use base qw/Wx::Dialog Uploader::Object2/; use Data::Dumper; __PACKAGE__->mk_accessors( qw/ properties list / ); sub new { my ($this, $params) = @_; #on recupere le nom de la classe en fonction du type d'appel de la méthode. my $class = ref($this) || $this; my $self = $class->SUPER::new( undef, -1, gettext("Exif properties"), wxDefaultPosition, wxDefaultSize, wxDEFAULT_DIALOG_STYLE| wxMAXIMIZE_BOX| wxMINIMIZE_BOX| wxSTAY_ON_TOP ); &main::image_prop_exif($self); $self->properties( $params->{properties} ); $self->list( $self->FindWindow($main::IMG_PROP_EXIF_LIST) ); $self->{img_exif_prop_close} = $self->FindWindow($main::IMG_PROP_EXIF_CLOSE); $self->{img_exif_prop_close}->SetLabel( gettext("Close") ); Wx::Event::EVT_BUTTON( $self, $self->{img_exif_prop_close}, \&OnClose ); $self->list->InsertColumn(0, gettext("Property")); $self->list->InsertColumn(1, gettext("Value")); print Dumper $self->properties; $self; } sub Refresh { my ( $self ) = @_; $self->list->Freeze; $self->list->DeleteAllItems; my $i=0; map { $self->list->InsertStringItem($i, $_->{label}); $self->list->SetItem($i, 1, $_->{value}->()); $i++; }@{$self->properties}; $self->list->SetColumnWidth(0, wxLIST_AUTOSIZE ); $self->list->SetColumnWidth(1, wxLIST_AUTOSIZE ); $self->list->Thaw; } sub OnClose { my ( $self, $event ) = @_; $self->Hide; } 1;