Add libwx-perl
[pkg-perl] / deb-src / libwx-perl / libwx-perl-0.96 / debian / libwx-perl / usr / lib / perl5 / Wx / Grid.pm
1 #############################################################################
2 ## Name:        ext/grid/lib/Wx/Grid.pm
3 ## Purpose:     Wx::Grid (pulls in all Wx::Grid* stuff)
4 ## Author:      Mattia Barbon
5 ## Modified by:
6 ## Created:     04/12/2001
7 ## RCS-ID:      $Id: Grid.pm 2170 2007-08-17 22:53:11Z mbarbon $
8 ## Copyright:   (c) 2001-2002, 2004-2007 Mattia Barbon
9 ## Licence:     This program is free software; you can redistribute it and/or
10 ##              modify it under the same terms as Perl itself
11 #############################################################################
12
13 package Wx::Grid;
14
15 use Wx;
16 use strict;
17
18 use vars qw($VERSION);
19
20 $VERSION = '0.01';
21
22 Wx::load_dll( 'adv' );
23 Wx::wx_boot( 'Wx::Grid', $VERSION );
24
25 SetEvents();
26
27 #
28 # properly setup inheritance tree
29 #
30
31 no strict;
32
33 package Wx::Grid; @ISA = qw(Wx::ScrolledWindow);
34 package Wx::GridWindow; @ISA = qw(Wx::Grid);
35 package Wx::GridEvent; @ISA = qw(Wx::NotifyEvent);
36 package Wx::GridSizeEvent; @ISA = qw(Wx::NotifyEvent);
37 package Wx::GridRangeSelectEvent; @ISA = qw(Wx::NotifyEvent);
38 package Wx::GridEditorCreatedEvent; @ISA = qw(Wx::CommandEvent);
39
40 package Wx::GridCellRenderer;
41 package Wx::GridCellStringRenderer; @ISA = qw(Wx::GridCellRenderer);
42 package Wx::GridCellNumberRenderer; @ISA = qw(Wx::GridCellRenderer);
43 package Wx::GridCellFloatRenderer; @ISA = qw(Wx::GridCellRenderer);
44 package Wx::GridCellBoolRenderer; @ISA = qw(Wx::GridCellRenderer);
45 package Wx::GridCellAutoWrapStringRenderer; @ISA = qw(Wx::GridCellStringRenderer);
46 package Wx::GridCellEnumRenderer; @ISA = qw(Wx::GridCellStringRenderer);
47 package Wx::GridCellDateTimeRenderer; @ISA = qw(Wx::GridCellStringRenderer);
48 package Wx::PlGridCellRenderer; @ISA = qw(Wx::GridCellRenderer);
49
50 package Wx::GridCellEditor;
51 package Wx::GridCellEditorEvtHandler; @ISA = qw(Wx::EvtHandler);
52 package Wx::GridCellBoolEditor; @ISA = qw(Wx::GridCellEditor);
53 package Wx::GridCellTextEditor; @ISA = qw(Wx::GridCellEditor);
54 package Wx::GridCellFloatEditor; @ISA = qw(Wx::GridCellEditor);
55 package Wx::GridCellNumberEditor; @ISA = qw(Wx::GridCellEditor);
56 package Wx::GridCellChoiceEditor; @ISA = qw(Wx::GridCellEditor);
57 package Wx::GridCellAutoWrapStringEditor; @ISA = qw(Wx::GridCellTextEditor);
58 package Wx::GridCellEnumEditor; @ISA = qw(Wx::GridCellChoiceEditor);
59 package Wx::PlGridCellEditor; @ISA = qw(Wx::GridCellEditor);
60
61 package Wx::GridTableBase;
62 package Wx::PlGridTable; @ISA = qw(Wx::GridTableBase);
63
64 package Wx::Grid;
65
66 use strict;
67
68 # this is for make_ovl_list to find constants
69 sub CellToRect {
70   my $this = shift;
71
72   Wx::_match( @_, $Wx::_wgco, 1 ) && return $this->CellToRectCo( @_ );
73   Wx::_match( @_, $Wx::_n_n, 2 )  && return $this->CellToRectXY( @_ );
74   Wx::_croak Wx::_ovl_error;
75 }
76
77 sub _create_ovls {
78   my $name = shift;
79
80   no strict;
81   die $name unless defined &{$name . 'XY'} && defined &{$name . 'Co'};
82   use strict;
83
84   eval <<EOT;
85 sub ${name} {
86   my \$this = shift;
87
88   Wx::_match( \@_, \$Wx::_wgco, 1 ) && return \$this->${name}Co( \@_ );
89   Wx::_match( \@_, \$Wx::_n_n, 2 )  && return \$this->${name}XY( \@_ );
90   Wx::_croak Wx::_ovl_error;
91 }
92 EOT
93
94   die $@ if $@;
95 }
96
97 # for copytex.pl
98 #!sub GetCellValue
99 #!sub IsInSelection
100 #!sub IsVisible
101 #!sub MakeCellVisible
102 #!sub GetDefaultEditorForCell
103
104 foreach my $i ( qw(GetCellValue IsInSelection IsVisible MakeCellVisible
105                    GetDefaultEditorForCell) )
106   { _create_ovls( $i ); }
107
108 sub SelectBlock {
109   my $this = shift;
110
111   Wx::_match( @_, $Wx::_wgco_wgco_b, 3 ) && return $this->SelectBlockPP( @_ );
112   Wx::_match( @_, $Wx::_n_n_n_n_b, 5 )  && return $this->SelectBlockXYWH( @_ );
113   Wx::_croak Wx::_ovl_error;
114 }
115
116 sub SetCellValue {
117   my $this = shift;
118
119   Wx::_match( @_, $Wx::_wgco_s, 2 ) && return $this->SetCellValueCo( @_ );
120   Wx::_match( @_, $Wx::_n_n_s, 3 )  && return $this->SetCellValueXY( @_ );
121   Wx::_croak Wx::_ovl_error;
122 }
123
124 1;
125
126 # Local variables: #
127 # mode: cperl #
128 # End: #