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

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

Change copyright notice to add 2010.

File size: 3.5 KB
Line 
1# +-----------------------------------------------------------------------+
2# | pLoader - a Perl photo uploader for Piwigo                            |
3# +-----------------------------------------------------------------------+
4# | Copyright(C) 2008-2010 Piwigo Team                  http://piwigo.org |
5# +-----------------------------------------------------------------------+
6# | This program is free software; you can redistribute it and/or modify  |
7# | it under the terms of the GNU General Public License as published by  |
8# | the Free Software Foundation                                          |
9# |                                                                       |
10# | This program is distributed in the hope that it will be useful, but   |
11# | WITHOUT ANY WARRANTY; without even the implied warranty of            |
12# | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU      |
13# | General Public License for more details.                              |
14# |                                                                       |
15# | You should have received a copy of the GNU General Public License     |
16# | along with this program; if not, write to the Free Software           |
17# | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, |
18# | USA.                                                                  |
19# +-----------------------------------------------------------------------+
20package Uploader::GUI::wxPropertyListDlg;
21use strict;
22use Wx qw/
23             wxDefaultSize
24             wxDefaultPosition
25             wxLIST_AUTOSIZE
26             wxDEFAULT_DIALOG_STYLE
27
28             wxMAXIMIZE_BOX
29             wxMINIMIZE_BOX
30 
31             wxSTAY_ON_TOP
32             wxLC_NO_HEADER
33         /;
34use Wx::Locale qw/:default/;
35use base qw/Wx::Dialog Uploader::Object2/;
36
37use Data::Dumper;
38__PACKAGE__->mk_accessors(     
39    qw/
40        properties
41        list
42      /
43);
44
45
46
47sub new {
48    my ($this, $params) = @_;
49    #on recupere le nom de la classe en fonction du type d'appel de la méthode.
50    my $class = ref($this) || $this;
51
52
53    my $self = $class->SUPER::new( 
54        undef,
55        -1,
56        $params->{caption}, 
57        wxDefaultPosition, 
58        wxDefaultSize, 
59        wxDEFAULT_DIALOG_STYLE|
60        wxMAXIMIZE_BOX|
61        wxMINIMIZE_BOX|
62        wxSTAY_ON_TOP
63
64    );
65
66    &main::image_prop_exif($self);
67
68    $self->properties(
69        $params->{properties}
70    );
71    $self->list(
72        $self->FindWindow($main::IMG_PROP_EXIF_LIST)
73    );
74
75    $self->list->SetSingleStyle(wxLC_NO_HEADER);
76
77    $self->{img_exif_prop_close} = $self->FindWindow($main::IMG_PROP_EXIF_CLOSE);
78
79    $self->{img_exif_prop_close}->SetLabel(
80        gettext("Close")
81    );
82
83    Wx::Event::EVT_BUTTON( $self, $self->{img_exif_prop_close}, \&OnClose );
84
85    $self->list->InsertColumn(0, gettext("Property"));
86    $self->list->InsertColumn(1, gettext("Value"));
87   
88    $self;
89}
90
91
92sub Refresh {
93    my ( $self ) = @_;
94
95    $self->list->Freeze;
96    $self->list->DeleteAllItems;
97    my $i=0;
98    map {
99        $self->list->InsertStringItem($i, $_->{label});
100        $self->list->SetItem($i, 1, $_->{value}->());
101        $i++;
102    }@{$self->properties};
103    $self->list->SetColumnWidth(0, wxLIST_AUTOSIZE );
104    $self->list->SetColumnWidth(1, wxLIST_AUTOSIZE );
105    $self->list->Thaw;
106}
107
108# call to destroy crashes with GTK
109sub OnClose {
110    my ( $self, $event ) = @_;
111   
112    $self->Hide;
113}
114
1151;
Note: See TracBrowser for help on using the repository browser.