Add libwx-perl
[pkg-perl] / deb-src / libwx-perl / libwx-perl-0.96 / ext / grid / XS / GridTable.xsp
1 #############################################################################
2 ## Name:        ext/grid/XS/GridTable.xsp
3 ## Purpose:     XS++ for Wx::PlGridTable
4 ## Author:      Mattia Barbon
5 ## Modified by:
6 ## Created:     02/08/2003
7 ## RCS-ID:      $Id: GridTable.xsp 2304 2007-12-24 17:25:51Z mbarbon $
8 ## Copyright:   (c) 2003-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 %module{Wx};
14
15 %typemap{wxPlGridTable*}{simple};
16 %typemap{wxGrid*}{simple};
17 %typemap{wxGridCellAttr*}{simple};
18 %typemap{wxGridCellAttr::wxAttrKind}{simple};
19
20 %file{cpp/gridtable.h};
21 %{
22
23 #include "cpp/v_cback.h"
24
25 class wxPlGridTable : public wxGridTableBase
26 {
27     WXPLI_DECLARE_DYNAMIC_CLASS( wxPlGridTable );
28     WXPLI_DECLARE_V_CBACK();
29 public:
30     wxPlGridTable( const char* package )
31         :m_callback( "Wx::GridTableBase" )
32     {
33         m_callback.SetSelf( wxPli_make_object( this, package ), true );
34     }
35
36     DEC_V_CBACK_INT__VOID( GetNumberRows );
37     DEC_V_CBACK_INT__VOID( GetNumberCols );
38     DEC_V_CBACK_BOOL__INT_INT( IsEmptyCell );
39     DEC_V_CBACK_WXSTRING__INT_INT( GetValue );
40     DEC_V_CBACK_VOID__INT_INT_WXSTRING( SetValue );
41     DEC_V_CBACK_WXSTRING__INT_INT( GetTypeName );
42     DEC_V_CBACK_BOOL__INT_INT_WXSTRING( CanGetValueAs );
43     DEC_V_CBACK_BOOL__INT_INT_WXSTRING( CanSetValueAs );
44     DEC_V_CBACK_LONG__INT_INT( GetValueAsLong );
45     DEC_V_CBACK_DOUBLE__INT_INT( GetValueAsDouble );
46     DEC_V_CBACK_BOOL__INT_INT( GetValueAsBool );
47     // DEC_V_CBACK_VOIDP__INT_INT_WXSTRING( GetValueAsCustom );
48     DEC_V_CBACK_VOID__INT_INT_LONG( SetValueAsLong );
49     DEC_V_CBACK_VOID__INT_INT_DOUBLE( SetValueAsDouble );
50     DEC_V_CBACK_VOID__INT_INT_BOOL( SetValueAsBool );
51     // DEC_V_CBACK_VOIDP_INT_INT_WXSTRING_VOIDP( SetValueAsCustom );
52     DEC_V_CBACK_VOID__WXGRID( SetView );
53     DEC_V_CBACK_WXGRID__VOID_const( GetView );
54     DEC_V_CBACK_VOID__VOID( Clear );
55     DEC_V_CBACK_BOOL__SIZET_SIZET( InsertRows );
56     DEC_V_CBACK_BOOL__SIZET( AppendRows );
57     DEC_V_CBACK_BOOL__SIZET_SIZET( DeleteRows );
58     DEC_V_CBACK_BOOL__SIZET_SIZET( InsertCols );
59     DEC_V_CBACK_BOOL__SIZET( AppendCols );
60     DEC_V_CBACK_BOOL__SIZET_SIZET( DeleteCols );
61     DEC_V_CBACK_WXSTRING__INT( GetRowLabelValue );
62     DEC_V_CBACK_WXSTRING__INT( GetColLabelValue );
63     DEC_V_CBACK_VOID__INT_WXSTRING( SetRowLabelValue );
64     DEC_V_CBACK_VOID__INT_WXSTRING( SetColLabelValue );
65 };
66
67 DEF_V_CBACK_INT__VOID_pure( wxPlGridTable, wxGridTableBase, GetNumberRows );
68 DEF_V_CBACK_INT__VOID_pure( wxPlGridTable, wxGridTableBase, GetNumberCols );
69 DEF_V_CBACK_BOOL__INT_INT_pure( wxPlGridTable, wxGridTableBase, IsEmptyCell );
70 DEF_V_CBACK_WXSTRING__INT_INT_pure( wxPlGridTable, wxGridTableBase, GetValue );
71 DEF_V_CBACK_VOID__INT_INT_WXSTRING_pure( wxPlGridTable, wxGridTableBase, SetValue );
72 DEF_V_CBACK_WXSTRING__INT_INT( wxPlGridTable, wxGridTableBase, GetTypeName );
73 DEF_V_CBACK_BOOL__INT_INT_WXSTRING( wxPlGridTable, wxGridTableBase, CanGetValueAs );
74 DEF_V_CBACK_BOOL__INT_INT_WXSTRING( wxPlGridTable, wxGridTableBase, CanSetValueAs );
75 DEF_V_CBACK_LONG__INT_INT( wxPlGridTable, wxGridTableBase, GetValueAsLong );
76 DEF_V_CBACK_DOUBLE__INT_INT( wxPlGridTable, wxGridTableBase, GetValueAsDouble );
77 DEF_V_CBACK_BOOL__INT_INT( wxPlGridTable, wxGridTableBase, GetValueAsBool );
78 // DEF_V_CBACK_VOIDP__INT_INT_WXSTRING( wxPlGridTable, wxGridTableBase, GetValueAsCustom );
79 DEF_V_CBACK_VOID__INT_INT_LONG( wxPlGridTable, wxGridTableBase, SetValueAsLong );
80 DEF_V_CBACK_VOID__INT_INT_DOUBLE( wxPlGridTable, wxGridTableBase, SetValueAsDouble );
81 DEF_V_CBACK_VOID__INT_INT_BOOL( wxPlGridTable, wxGridTableBase, SetValueAsBool );
82 // DEF_V_CBACK_VOIDP_INT_INT_WXSTRING_VOIDP( wxPlGridTable, wxGridTableBase, SetValueAsCustom );
83 DEF_V_CBACK_VOID__WXGRID( wxPlGridTable, wxGridTableBase, SetView );
84 DEF_V_CBACK_WXGRID__VOID_const( wxPlGridTable, wxGridTableBase, GetView );
85 DEF_V_CBACK_VOID__VOID( wxPlGridTable, wxGridTableBase, Clear );
86 DEF_V_CBACK_BOOL__SIZET_SIZET( wxPlGridTable, wxGridTableBase, InsertRows );
87 DEF_V_CBACK_BOOL__SIZET( wxPlGridTable, wxGridTableBase, AppendRows );
88 DEF_V_CBACK_BOOL__SIZET_SIZET( wxPlGridTable, wxGridTableBase, DeleteRows );
89 DEF_V_CBACK_BOOL__SIZET_SIZET( wxPlGridTable, wxGridTableBase, InsertCols );
90 DEF_V_CBACK_BOOL__SIZET( wxPlGridTable, wxGridTableBase, AppendCols );
91 DEF_V_CBACK_BOOL__SIZET_SIZET( wxPlGridTable, wxGridTableBase, DeleteCols );
92 DEF_V_CBACK_WXSTRING__INT( wxPlGridTable, wxGridTableBase, GetRowLabelValue );
93 DEF_V_CBACK_WXSTRING__INT( wxPlGridTable, wxGridTableBase, GetColLabelValue );
94 DEF_V_CBACK_VOID__INT_WXSTRING( wxPlGridTable, wxGridTableBase, SetRowLabelValue );
95 DEF_V_CBACK_VOID__INT_WXSTRING( wxPlGridTable, wxGridTableBase, SetColLabelValue );
96
97 WXPLI_IMPLEMENT_DYNAMIC_CLASS( wxPlGridTable, wxGridTableBase );
98
99 %}
100 %file{-};
101
102 #include "cpp/gridtable.h"
103
104 #define wxGridCellAttr__wxAttrKind wxGridCellAttr::wxAttrKind
105
106 %name{Wx::PlGridTable} class wxPlGridTable
107 {
108     wxPlGridTable()  %code{% RETVAL = new wxPlGridTable( CLASS ); %};
109
110     void Destroy() %code{% delete THIS; %};
111     wxString GetTypeName( int row, int col )
112         %code{% RETVAL = THIS->wxGridTableBase::GetTypeName( row, col );  %};
113     bool CanGetValueAs( int row, int col, const wxString& typeName )
114         %code{% RETVAL = THIS->wxGridTableBase::CanGetValueAs( row, col, typeName ); %};
115     bool CanSetValueAs( int row, int col, const wxString& typeName )
116         %code{% RETVAL = THIS->wxGridTableBase::CanSetValueAs( row, col, typeName ); %};
117     long GetValueAsLong( int row, int col )
118         %code{% RETVAL = THIS->wxGridTableBase::GetValueAsLong( row, col ); %};
119     double GetValueAsDouble( int row, int col )
120         %code{% RETVAL = THIS->wxGridTableBase::GetValueAsDouble( row, col ); %};
121     bool GetValueAsBool( int row, int col )
122         %code{% RETVAL = THIS->wxGridTableBase::GetValueAsBool( row, col ); %};
123     void SetValueAsLong( int row, int col, long value )
124         %code{% THIS->wxGridTableBase::SetValueAsLong( row, col, value ); %};
125     void SetValueAsDouble( int row, int col, double value )
126         %code{% THIS->wxGridTableBase::SetValueAsDouble( row, col, value ); %};
127     void SetValueAsBool( int row, int col, bool value )
128         %code{% THIS->wxGridTableBase::SetValueAsBool( row, col, value ); %};
129
130 ##  void* GetValueAsCustom( int row, int col, const wxString& typeName ) %code{%  %};
131 ##  void  SetValueAsCustom( int row, int col, const wxString& typeName, void* value ) %code{%  %};
132
133     void SetView( wxGrid *grid )
134         %code{% THIS->wxGridTableBase::SetView( grid ); %};
135     wxGrid* GetView()
136         %code{% RETVAL = THIS->wxGridTableBase::GetView(); %};
137
138     void Clear() %code{% THIS->wxGridTableBase::Clear(); %};
139     bool InsertRows( size_t pos = 0, size_t numRows = 1 )
140         %code{% RETVAL = THIS->wxGridTableBase::InsertRows( pos, numRows ); %};
141     bool AppendRows( size_t numRows = 1 )
142         %code{% RETVAL = THIS->wxGridTableBase::AppendRows( numRows ); %};
143     bool DeleteRows( size_t pos = 0, size_t numRows = 1 )
144         %code{% RETVAL = THIS->wxGridTableBase::DeleteRows( pos, numRows ); %};
145     bool InsertCols( size_t pos = 0, size_t numCols = 1 )
146         %code{% RETVAL = THIS->wxGridTableBase::InsertCols( pos, numCols ); %};
147     bool AppendCols( size_t numCols = 1 )
148         %code{% RETVAL = THIS->wxGridTableBase::AppendCols( numCols ); %};
149     bool DeleteCols( size_t pos = 0, size_t numCols = 1 )
150         %code{% RETVAL = THIS->wxGridTableBase::DeleteCols( pos, numCols ); %};
151
152     wxString GetRowLabelValue( int row )
153         %code{% RETVAL = THIS->wxGridTableBase::GetRowLabelValue( row ); %};
154     wxString GetColLabelValue( int col )
155         %code{% RETVAL = THIS->wxGridTableBase::GetColLabelValue( col ); %};
156     void SetRowLabelValue( int row, const wxString& value )
157         %code{% THIS->wxGridTableBase::SetRowLabelValue( row, value ); %};
158     void SetColLabelValue( int col, const wxString& value )
159         %code{% THIS->wxGridTableBase::SetColLabelValue( col, value ); %};
160 ##  void SetAttrProvider(wxGridCellAttrProvider *attrProvider) %code{%  %};
161 ##  wxGridCellAttrProvider *GetAttrProvider() const { RETVAL = m_attrProvider %code{%  %}; }
162     bool CanHaveAttributes()
163         %code{% RETVAL = THIS->wxGridTableBase::CanHaveAttributes(); %};
164     wxGridCellAttr *GetAttr( int row, int col,
165                              wxGridCellAttr::wxAttrKind  kind )
166         %code{% RETVAL = THIS->wxGridTableBase::GetAttr( row, col, kind ); %};
167     void SetAttr(wxGridCellAttr* attr, int row, int col)
168         %code{% THIS->wxGridTableBase::SetAttr( attr, row, col ); %};
169     void SetRowAttr(wxGridCellAttr *attr, int row)
170         %code{% THIS->wxGridTableBase::SetRowAttr( attr, row ); %};
171     void SetColAttr(wxGridCellAttr *attr, int col)
172         %code{% THIS->wxGridTableBase::SetColAttr( attr, col ); %};
173 };
174
175 ## Mark methods as implemented
176 %{
177 MODULE=Wx PACKAGE=Wx::GridTableBase
178 %}
179
180 #!sub wxGridTableBase
181 #!sub GetNumberRows
182 #!sub SetNumberRows
183 #!sub GetTypeName
184 #!sub CanGetValueAs
185 #!sub CanSetValueAs
186 #!sub GetValueAsLong
187 #!sub GetValueAsDouble
188 #!sub GetValueAsBool
189 #!sub SetValueAsLong
190 #!sub SetValueAsDouble
191 #!sub SetValueAsBool
192 #!sub SetView
193 #!sub GetView
194 #!sub Clear
195 #!sub IsEmptyCell
196 #!sub InsertRows
197 #!sub AppendRows
198 #!sub DeleteRows
199 #!sub InsertCols
200 #!sub AppendCols
201 #!sub DeleteCols
202 #!sub GetRowLabelValue
203 #!sub GetColLabelValue
204 #!sub SetRowLabelValue
205 #!sub SetColLabelValue
206 #!sub CanHaveAttributes
207 #!sub GetAttr
208 #!sub SetAttr
209 #!sub SetRowAttr
210 #!sub SetColAttr
211 #!sub GetValue
212 #!sub SetValue