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

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

Feature 1562 : remove STAY_ON_TOP attribute.

File size: 3.3 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             wxMAXIMIZE_BOX
28             wxMINIMIZE_BOX
29             wxLC_NO_HEADER
30         /;
31use Wx::Locale qw/:default/;
32use base qw/Wx::Dialog Uploader::Object2/;
33
34use Data::Dumper;
35__PACKAGE__->mk_accessors(     
36    qw/
37        properties
38        list
39      /
40);
41
42
43
44sub new {
45    my ($this, $params) = @_;
46    #on recupere le nom de la classe en fonction du type d'appel de la méthode.
47    my $class = ref($this) || $this;
48
49
50    my $self = $class->SUPER::new( 
51        undef,
52        -1,
53        $params->{caption}, 
54        wxDefaultPosition, 
55        wxDefaultSize, 
56        wxDEFAULT_DIALOG_STYLE|
57        wxMAXIMIZE_BOX|
58        wxMINIMIZE_BOX
59    );
60
61    &main::image_prop_exif($self);
62
63    $self->properties(
64        $params->{properties}
65    );
66    $self->list(
67        $self->FindWindow($main::IMG_PROP_EXIF_LIST)
68    );
69
70    $self->list->SetSingleStyle(wxLC_NO_HEADER);
71
72    $self->{img_exif_prop_close} = $self->FindWindow($main::IMG_PROP_EXIF_CLOSE);
73
74    $self->{img_exif_prop_close}->SetLabel(
75        gettext("Close")
76    );
77
78    Wx::Event::EVT_BUTTON( $self, $self->{img_exif_prop_close}, \&OnClose );
79
80    $self->list->InsertColumn(0, gettext("Property"));
81    $self->list->InsertColumn(1, gettext("Value"));
82   
83    $self;
84}
85
86
87sub Refresh {
88    my ( $self ) = @_;
89
90    $self->list->Freeze;
91    $self->list->DeleteAllItems;
92    my $i=0;
93    map {
94        $self->list->InsertStringItem($i, $_->{label});
95        $self->list->SetItem($i, 1, $_->{value}->());
96        $i++;
97    }@{$self->properties};
98    $self->list->SetColumnWidth(0, wxLIST_AUTOSIZE );
99    $self->list->SetColumnWidth(1, wxLIST_AUTOSIZE );
100    $self->list->Thaw;
101}
102
103# call to destroy crashes with GTK
104sub OnClose {
105    my ( $self, $event ) = @_;
106   
107    $self->Hide;
108}
109
1101;
Note: See TracBrowser for help on using the repository browser.