source: extensions/pLoader/trunk/src/Uploader/GUI/wxPropertyListDlg.pm @ 4751

Last change on this file since 4751 was 4751, checked in by ronosman, 14 years ago

Photo exif properties dialog : add i18n for caption, remove headers.

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