source: extensions/pLoader/trunk/src/Uploader/GUI/wxHtmlWindow.pm @ 4717

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

Feature 1388 added : refactor getting started panel.

  • Property svn:eol-style set to LF
File size: 3.0 KB
Line 
1# +-----------------------------------------------------------------------+
2# | pLoader - a Perl photo uploader for Piwigo                            |
3# +-----------------------------------------------------------------------+
4# | Copyright(C) 2008      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::wxHtmlWindow;
21
22use strict;
23use Wx::Html;
24use base qw(Wx::Dialog);
25use Wx qw/
26             wxTheApp
27             wxDefaultSize
28             wxDefaultPosition
29             wxALIGN_CENTER_VERTICAL
30             wxALL
31             wxVERTICAL
32             wxLIST_AUTOSIZE
33             wxDEFAULT_DIALOG_STYLE
34             wxMAXIMIZE_BOX
35             wxMINIMIZE_BOX
36             wxRESIZE_BORDER
37             wxSTAY_ON_TOP
38             wxGROW
39         /;
40
41sub new {
42    my ($class, $params) = @_;
43
44    my $this = $class->SUPER::new(
45        undef,
46        -1,
47        $params->{caption},
48        wxDefaultPosition, 
49        wxDefaultSize,
50        wxDEFAULT_DIALOG_STYLE|
51        wxMAXIMIZE_BOX|
52        wxMINIMIZE_BOX|
53        wxSTAY_ON_TOP|
54        wxRESIZE_BORDER
55    );
56    $this->{sizev} = Wx::BoxSizer->new( wxVERTICAL );
57
58    $this->{html} = Wx::HtmlWindow->new(
59        $this,
60        -1,
61        wxDefaultPosition, 
62        $params->{size},
63    );
64
65
66    $this->{html}->SetPage(
67        $params->{html}
68    );
69
70    # layout
71    $this->{sizev}->Add( $this->{html}, 1, wxGROW|wxALIGN_CENTER_VERTICAL|wxALL, 2 );
72    $this->SetSizer( $this->{sizev} );
73    $this->{sizev}->SetSizeHints( $this );
74
75    Wx::Event::EVT_HTML_LINK_CLICKED( $this, $this->{html}, \&OnHtmlLinkClicked);
76
77  return $this;
78}
79
80sub InitHrefCallbacks {
81    my ( $self, $callbacks ) = @_;
82   
83    $callbacks ||={};
84    $self->{HrefCallbacks} = $callbacks ;       
85}
86
87sub OnHtmlLinkClicked {
88    my ( $self, $event ) = @_;
89
90    my $href = $event->GetLinkInfo->GetHref, "\n";
91
92    $self->{HrefCallbacks}->{$href}->() if exists $self->{HrefCallbacks}->{$href};
93}
94
95
961;
97
Note: See TracBrowser for help on using the repository browser.