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 | # +-----------------------------------------------------------------------+ |
---|
20 | package Uploader::GUI::wxDestinationCategoryDlg; |
---|
21 | use strict; |
---|
22 | use Wx qw/ |
---|
23 | wxDefaultSize |
---|
24 | wxDefaultPosition |
---|
25 | wxDIALOG_NO_PARENT |
---|
26 | wxDEFAULT_DIALOG_STYLE |
---|
27 | wxMAXIMIZE_BOX |
---|
28 | wxMINIMIZE_BOX |
---|
29 | wxID_CANCEL |
---|
30 | wxID_OK |
---|
31 | /; |
---|
32 | use base qw/Wx::Dialog Uploader::GUI::DlgCommon Class::Accessor::Fast/; |
---|
33 | use Wx::Event qw/ |
---|
34 | EVT_BUTTON |
---|
35 | /; |
---|
36 | |
---|
37 | __PACKAGE__->mk_accessors( |
---|
38 | qw/ |
---|
39 | btok |
---|
40 | / |
---|
41 | ); |
---|
42 | use Carp; |
---|
43 | use Uploader::GUI::wxCategoryTreeCtrl; |
---|
44 | |
---|
45 | sub new { |
---|
46 | my ($this, $params) = @_; |
---|
47 | #on recupere le nom de la classe en fonction du type d'appel de la méthode. |
---|
48 | my $class = ref($this) || $this; |
---|
49 | |
---|
50 | |
---|
51 | my $self = $class->SUPER::new( |
---|
52 | undef, |
---|
53 | -1, |
---|
54 | $params->{caption}, |
---|
55 | wxDefaultPosition, |
---|
56 | [450, 300], |
---|
57 | wxDIALOG_NO_PARENT| |
---|
58 | wxDEFAULT_DIALOG_STYLE| |
---|
59 | wxMAXIMIZE_BOX| |
---|
60 | wxMINIMIZE_BOX |
---|
61 | ); |
---|
62 | # load controls |
---|
63 | &main::DestinationCategory($self, $params ); |
---|
64 | |
---|
65 | $self->properties( |
---|
66 | $params->{properties} |
---|
67 | ); |
---|
68 | |
---|
69 | $self->InitLabels(); |
---|
70 | $self->InitChoices(); |
---|
71 | $self->SetProperties(); |
---|
72 | $self->InitHandler(); |
---|
73 | |
---|
74 | $self->init_event_handlers(); |
---|
75 | |
---|
76 | $self->btok( $self->FindWindow($main::DESTINATION_CATEGORIES_OK) ); |
---|
77 | $self->btok->Enable(0); |
---|
78 | |
---|
79 | $self; |
---|
80 | } |
---|
81 | |
---|
82 | |
---|
83 | sub init_event_handlers { |
---|
84 | my ( $self ) = @_; |
---|
85 | |
---|
86 | EVT_BUTTON( $self, $main::DESTINATION_CATEGORIES_OK, \&OnOK ); |
---|
87 | EVT_BUTTON( $self, $main::DESTINATION_CATEGORIES_CANCEL, \&OnCancel ); |
---|
88 | |
---|
89 | } |
---|
90 | |
---|
91 | # Update progress information |
---|
92 | |
---|
93 | sub OnOK { |
---|
94 | my ( $self, $event ) = @_; |
---|
95 | |
---|
96 | $self->EndModal(wxID_OK); |
---|
97 | } |
---|
98 | |
---|
99 | |
---|
100 | sub OnCancel { |
---|
101 | my ( $self, $event ) = @_; |
---|
102 | |
---|
103 | $self->ClearProperties; |
---|
104 | $self->EndModal(wxID_CANCEL); |
---|
105 | } |
---|
106 | |
---|
107 | 1; |
---|