source: extras/pLoader/trunk/src/Uploader/GUI/wxImageGrid.pm @ 2597

Last change on this file since 2597 was 2597, checked in by ronosman, 16 years ago

pLoader initial release

  • Property svn:eol-style set to LF
File size: 2.9 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::wxImageGrid;
21
22use strict;
23use base qw(Wx::Grid);
24
25sub new {
26  my $class = shift;
27  my $this = $class->SUPER::new( $_[0], -1 );
28
29  $this->CreateGrid( 3, 7 );
30  # set every cell read-only
31  for my $x ( 1 .. 7 ) {
32    for my $y ( 1 .. 3 ) {
33      $this->SetReadOnly( $y, $x, 1 ); # rows, cols
34    }
35  }
36$this->SetDefaultColSize(120);
37$this->SetDefaultRowSize(120);
38
39
40  $this->SetCellValue( 1, 5, "SoMe TeXt!" );
41  $this->SetCellRenderer( 1, 5, Wx::DemoModules::wxGridCER::CustomRenderer->new );
42  $this->SetReadOnly( 1, 5, 0 );
43
44  return $this;
45}
46
47sub add_to_tags { 'controls/grid' }
48sub title { 'Custom editors and renderers' }
49
50package Wx::DemoModules::wxGridCER::CustomRenderer;
51
52use strict;
53use base 'Wx::PlGridCellRenderer';
54use Wx qw/
55             wxBITMAP_TYPE_JPEG
56             wxBITMAP_TYPE_GIF
57             wxBITMAP_TYPE_PNG
58             wxBLACK_PEN
59             wxWHITE_BRUSH
60             wxSYS_DEFAULT_GUI_FONT
61         /;
62sub Draw {
63  my( $self, $grid, $attr, $dc, $rect, $row, $col, $sel ) = ( shift, @_ );
64
65  $self->SUPER::Draw( @_ );
66
67  $dc->SetPen( wxBLACK_PEN );
68  $dc->SetBrush( wxWHITE_BRUSH );
69  $dc->SetFont(Wx::SystemSettings::GetFont(wxSYS_DEFAULT_GUI_FONT ));
70#  $dc->DrawEllipse( $rect->x, $rect->y, $rect->width, $rect->height );
71#  $dc->DrawText( $grid->GetCellValue( $row, $col ), $rect->x, $rect->y );
72    my $img = Wx::Bitmap->new( "J:/uploader/test10066.jpg", wxBITMAP_TYPE_JPEG );
73  $dc->DrawBitmap( $img, 10+$rect->x, 10+$rect->y, 0 );
74
75
76}
77
78sub Clone {
79  my $self = shift;
80
81  return $self->new;
82}
83
84
851;
Note: See TracBrowser for help on using the repository browser.