]>
Commit | Line | Data |
---|---|---|
1e4a197e | 1 | //////////////////////////////////////////////////////////////////////////// |
f6bcfd97 BP |
2 | // Name: grid.i |
3 | // Purpose: SWIG definitions for the new wxGrid and related classes | |
4 | // | |
5 | // Author: Robin Dunn | |
6 | // | |
7 | // Created: 17-March-2000 | |
8 | // RCS-ID: $Id$ | |
9 | // Copyright: (c) 2000 by Total Control Software | |
10 | // Licence: wxWindows license | |
11 | ///////////////////////////////////////////////////////////////////////////// | |
12 | ||
c8fac2b6 RD |
13 | %define DOCSTRING |
14 | "Classes for implementing a spreadsheet-like control." | |
15 | %enddef | |
b2eb030f RD |
16 | |
17 | %module(package="wx", docstring=DOCSTRING) grid | |
c8fac2b6 | 18 | |
f6bcfd97 | 19 | |
f6bcfd97 | 20 | %{ |
d14a1e28 RD |
21 | #include "wx/wxPython/wxPython.h" |
22 | #include "wx/wxPython/pyclasses.h" | |
23 | #include "wx/wxPython/printfw.h" | |
24 | ||
f6bcfd97 | 25 | #include <wx/grid.h> |
19a97bd6 | 26 | #include <wx/generic/gridctrl.h> |
d14a1e28 | 27 | |
f6bcfd97 BP |
28 | %} |
29 | ||
f6bcfd97 | 30 | |
d14a1e28 | 31 | //--------------------------------------------------------------------------- |
f6bcfd97 | 32 | |
f6bcfd97 | 33 | %import windows.i |
54f9ee45 | 34 | %pythoncode { wx = _core } |
99109c0f | 35 | %pythoncode { __docfilter__ = wx.__DocFilter(globals()) } |
f6bcfd97 | 36 | |
b2dc1044 | 37 | |
d14a1e28 | 38 | %include _grid_rename.i |
137b5242 | 39 | |
b2dc1044 RD |
40 | MAKE_CONST_WXSTRING_NOSWIG(EmptyString); |
41 | MAKE_CONST_WXSTRING_NOSWIG(PanelNameStr); | |
42 | MAKE_CONST_WXSTRING2(DateTimeFormatStr, wxT("%c")); | |
43 | ||
44 | ||
f6bcfd97 | 45 | //--------------------------------------------------------------------------- |
a66212dc RD |
46 | // OOR related typemaps and helper functions |
47 | ||
6d450e1a RD |
48 | %typemap(out) wxGridCellRenderer* { $result = wxPyMake_wxGridCellRenderer($1, $owner); } |
49 | %typemap(out) wxGridCellEditor* { $result = wxPyMake_wxGridCellEditor($1, $owner); } | |
50 | %typemap(out) wxGridCellAttr* { $result = wxPyMake_wxGridCellAttr($1, $owner); } | |
51 | %typemap(out) wxGridCellAttrProvider* { $result = wxPyMake_wxGridCellAttrProvider($1, $owner); } | |
52 | %typemap(out) wxGridTableBase* { $result = wxPyMake_wxGridTableBase($1, $owner); } | |
a66212dc RD |
53 | |
54 | ||
55 | %{ | |
56 | ||
57 | #define wxPyMake_TEMPLATE(TYPE) \ | |
6d450e1a | 58 | PyObject* wxPyMake_##TYPE(TYPE* source, bool setThisOwn) { \ |
a66212dc RD |
59 | PyObject* target = NULL; \ |
60 | if (source) { \ | |
61 | /* Check if there is already a pointer to a Python object in the \ | |
62 | OOR data that we can use. */ \ | |
63 | wxPyOORClientData* data = (wxPyOORClientData*)source->GetClientObject(); \ | |
64 | if (data) { \ | |
65 | target = data->m_obj; \ | |
a77bf68f RD |
66 | if (target) \ |
67 | Py_INCREF(target); \ | |
a66212dc RD |
68 | } \ |
69 | /* Otherwise make a new wrapper for it the old fashioned way and \ | |
70 | give it the OOR treatment */ \ | |
71 | if (! target) { \ | |
6d450e1a | 72 | target = wxPyConstructObject(source, wxT(#TYPE), setThisOwn); \ |
a66212dc RD |
73 | if (target) \ |
74 | source->SetClientObject(new wxPyOORClientData(target)); \ | |
75 | } \ | |
76 | } else { /* source was NULL so return None. */ \ | |
77 | Py_INCREF(Py_None); target = Py_None; \ | |
78 | } \ | |
79 | return target; \ | |
80 | } \ | |
81 | ||
82 | ||
83 | wxPyMake_TEMPLATE(wxGridCellRenderer) | |
84 | wxPyMake_TEMPLATE(wxGridCellEditor) | |
85 | wxPyMake_TEMPLATE(wxGridCellAttr) | |
86 | wxPyMake_TEMPLATE(wxGridCellAttrProvider) | |
87 | wxPyMake_TEMPLATE(wxGridTableBase) | |
88 | ||
89 | %} | |
90 | ||
f6bcfd97 BP |
91 | //--------------------------------------------------------------------------- |
92 | // Macros, similar to what's in helpers.h, to aid in the creation of | |
93 | // virtual methods that are able to make callbacks to Python. Many of these | |
94 | // are specific to wxGrid and so are kept here to reduce the mess in helpers.h | |
95 | // a bit. | |
96 | ||
97 | ||
98 | %{ | |
9416aa89 RD |
99 | #define PYCALLBACK_GCA_INTINTKIND(PCLASS, CBNAME) \ |
100 | wxGridCellAttr* CBNAME(int a, int b, wxGridCellAttr::wxAttrKind c) { \ | |
101 | wxGridCellAttr* rval = NULL; \ | |
19a97bd6 | 102 | bool found; \ |
da32eb53 | 103 | bool blocked = wxPyBeginBlockThreads(); \ |
19a97bd6 | 104 | if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \ |
9416aa89 RD |
105 | PyObject* ro; \ |
106 | wxGridCellAttr* ptr; \ | |
107 | ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("(iii)", a, b, c)); \ | |
108 | if (ro) { \ | |
d14a1e28 | 109 | if (wxPyConvertSwigPtr(ro, (void **)&ptr, wxT("wxGridCellAttr"))) \ |
9416aa89 RD |
110 | rval = ptr; \ |
111 | Py_DECREF(ro); \ | |
112 | } \ | |
113 | } \ | |
da32eb53 | 114 | wxPyEndBlockThreads(blocked); \ |
19a97bd6 | 115 | if (! found) \ |
9416aa89 | 116 | rval = PCLASS::CBNAME(a, b, c); \ |
9416aa89 RD |
117 | return rval; \ |
118 | } \ | |
119 | wxGridCellAttr *base_##CBNAME(int a, int b, wxGridCellAttr::wxAttrKind c) { \ | |
120 | return PCLASS::CBNAME(a, b, c); \ | |
f6bcfd97 BP |
121 | } |
122 | ||
123 | ||
124 | ||
19a97bd6 RD |
125 | #define PYCALLBACK__GCAINTINT(PCLASS, CBNAME) \ |
126 | void CBNAME(wxGridCellAttr *attr, int a, int b) { \ | |
da32eb53 | 127 | bool blocked = wxPyBeginBlockThreads(); \ |
19a97bd6 RD |
128 | bool found; \ |
129 | if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \ | |
6d450e1a | 130 | PyObject* obj = wxPyMake_wxGridCellAttr(attr,false); \ |
a66212dc | 131 | wxPyCBH_callCallback(m_myInst, Py_BuildValue("(Oii)", obj, a, b)); \ |
19a97bd6 RD |
132 | Py_DECREF(obj); \ |
133 | } \ | |
da32eb53 | 134 | wxPyEndBlockThreads(blocked); \ |
19a97bd6 RD |
135 | if (! found) \ |
136 | PCLASS::CBNAME(attr, a, b); \ | |
137 | } \ | |
138 | void base_##CBNAME(wxGridCellAttr *attr, int a, int b) { \ | |
139 | PCLASS::CBNAME(attr, a, b); \ | |
f6bcfd97 BP |
140 | } |
141 | ||
142 | ||
143 | ||
19a97bd6 RD |
144 | #define PYCALLBACK__GCAINT(PCLASS, CBNAME) \ |
145 | void CBNAME(wxGridCellAttr *attr, int val) { \ | |
da32eb53 | 146 | bool blocked = wxPyBeginBlockThreads(); \ |
19a97bd6 RD |
147 | bool found; \ |
148 | if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \ | |
6d450e1a | 149 | PyObject* obj = wxPyMake_wxGridCellAttr(attr,false); \ |
19a97bd6 RD |
150 | wxPyCBH_callCallback(m_myInst, Py_BuildValue("(Oi)", obj, val)); \ |
151 | Py_DECREF(obj); \ | |
152 | } \ | |
da32eb53 | 153 | wxPyEndBlockThreads(blocked); \ |
19a97bd6 RD |
154 | if (! found) \ |
155 | PCLASS::CBNAME(attr, val); \ | |
156 | } \ | |
157 | void base_##CBNAME(wxGridCellAttr *attr, int val) { \ | |
158 | PCLASS::CBNAME(attr, val); \ | |
f6bcfd97 BP |
159 | } |
160 | ||
161 | ||
162 | ||
19a97bd6 RD |
163 | #define PYCALLBACK_INT__pure(CBNAME) \ |
164 | int CBNAME() { \ | |
da32eb53 | 165 | bool blocked = wxPyBeginBlockThreads(); \ |
19a97bd6 RD |
166 | int rval = 0; \ |
167 | if (wxPyCBH_findCallback(m_myInst, #CBNAME)) \ | |
168 | rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("()")); \ | |
da32eb53 | 169 | wxPyEndBlockThreads(blocked); \ |
19a97bd6 | 170 | return rval; \ |
f6bcfd97 BP |
171 | } |
172 | ||
173 | ||
174 | ||
19a97bd6 RD |
175 | #define PYCALLBACK_BOOL_INTINT_pure(CBNAME) \ |
176 | bool CBNAME(int a, int b) { \ | |
da32eb53 | 177 | bool blocked = wxPyBeginBlockThreads(); \ |
19a97bd6 RD |
178 | bool rval = 0; \ |
179 | if (wxPyCBH_findCallback(m_myInst, #CBNAME)) \ | |
180 | rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(ii)",a,b)); \ | |
da32eb53 | 181 | wxPyEndBlockThreads(blocked); \ |
19a97bd6 | 182 | return rval; \ |
f6bcfd97 BP |
183 | } |
184 | ||
185 | ||
19a97bd6 RD |
186 | #define PYCALLBACK_STRING_INTINT_pure(CBNAME) \ |
187 | wxString CBNAME(int a, int b) { \ | |
da32eb53 | 188 | bool blocked = wxPyBeginBlockThreads(); \ |
19a97bd6 RD |
189 | wxString rval; \ |
190 | if (wxPyCBH_findCallback(m_myInst, #CBNAME)) { \ | |
191 | PyObject* ro; \ | |
192 | ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("(ii)",a,b)); \ | |
193 | if (ro) { \ | |
a541c325 RD |
194 | rval = Py2wxString(ro); \ |
195 | Py_DECREF(ro); \ | |
19a97bd6 RD |
196 | } \ |
197 | } \ | |
da32eb53 | 198 | wxPyEndBlockThreads(blocked); \ |
19a97bd6 | 199 | return rval; \ |
f6bcfd97 BP |
200 | } |
201 | ||
202 | ||
19a97bd6 RD |
203 | #define PYCALLBACK__INTINTSTRING_pure(CBNAME) \ |
204 | void CBNAME(int a, int b, const wxString& c) { \ | |
da32eb53 | 205 | bool blocked = wxPyBeginBlockThreads(); \ |
a66212dc RD |
206 | if (wxPyCBH_findCallback(m_myInst, #CBNAME)) { \ |
207 | PyObject* s = wx2PyString(c); \ | |
208 | rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(iiO)",a,b,s));\ | |
209 | Py_DECREF(s); \ | |
210 | } \ | |
da32eb53 | 211 | wxPyEndBlockThreads(blocked); \ |
f6bcfd97 BP |
212 | } |
213 | ||
a541c325 | 214 | |
19a97bd6 RD |
215 | #define PYCALLBACK_STRING_INTINT(PCLASS, CBNAME) \ |
216 | wxString CBNAME(int a, int b) { \ | |
217 | bool found; \ | |
da32eb53 | 218 | bool blocked = wxPyBeginBlockThreads(); \ |
19a97bd6 RD |
219 | wxString rval; \ |
220 | if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \ | |
221 | PyObject* ro; \ | |
222 | ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("(ii)",a,b)); \ | |
223 | if (ro) { \ | |
a541c325 RD |
224 | rval = Py2wxString(ro); \ |
225 | Py_DECREF(ro); \ | |
19a97bd6 RD |
226 | } \ |
227 | } \ | |
da32eb53 | 228 | wxPyEndBlockThreads(blocked); \ |
19a97bd6 RD |
229 | if (! found) \ |
230 | rval = PCLASS::CBNAME(a, b); \ | |
231 | return rval; \ | |
232 | } \ | |
233 | wxString base_##CBNAME(int a, int b) { \ | |
234 | return PCLASS::CBNAME(a, b); \ | |
f6bcfd97 BP |
235 | } |
236 | ||
237 | ||
19a97bd6 RD |
238 | #define PYCALLBACK_BOOL_INTINTSTRING(PCLASS, CBNAME) \ |
239 | bool CBNAME(int a, int b, const wxString& c) { \ | |
36fd8ec3 | 240 | bool rval = 0; \ |
19a97bd6 | 241 | bool found; \ |
da32eb53 | 242 | bool blocked = wxPyBeginBlockThreads(); \ |
3b3ab7f6 | 243 | if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \ |
a66212dc RD |
244 | PyObject* s = wx2PyString(c); \ |
245 | rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(iiO)",a,b,s));\ | |
246 | Py_DECREF(s); \ | |
247 | } \ | |
da32eb53 | 248 | wxPyEndBlockThreads(blocked); \ |
19a97bd6 RD |
249 | if (! found) \ |
250 | rval = PCLASS::CBNAME(a,b,c); \ | |
251 | return rval; \ | |
252 | } \ | |
253 | bool base_##CBNAME(int a, int b, const wxString& c) { \ | |
254 | return PCLASS::CBNAME(a,b,c); \ | |
f6bcfd97 BP |
255 | } |
256 | ||
257 | ||
258 | ||
259 | ||
19a97bd6 RD |
260 | #define PYCALLBACK_LONG_INTINT(PCLASS, CBNAME) \ |
261 | long CBNAME(int a, int b) { \ | |
262 | long rval; \ | |
263 | bool found; \ | |
da32eb53 | 264 | bool blocked = wxPyBeginBlockThreads(); \ |
19a97bd6 RD |
265 | if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \ |
266 | rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(ii)", a,b)); \ | |
da32eb53 | 267 | wxPyEndBlockThreads(blocked); \ |
19a97bd6 RD |
268 | if (! found) \ |
269 | rval = PCLASS::CBNAME(a,b); \ | |
270 | return rval; \ | |
271 | } \ | |
272 | long base_##CBNAME(int a, int b) { \ | |
273 | return PCLASS::CBNAME(a,b); \ | |
f6bcfd97 BP |
274 | } |
275 | ||
276 | ||
277 | ||
19a97bd6 RD |
278 | #define PYCALLBACK_BOOL_INTINT(PCLASS, CBNAME) \ |
279 | bool CBNAME(int a, int b) { \ | |
36fd8ec3 | 280 | bool rval = 0; \ |
19a97bd6 | 281 | bool found; \ |
da32eb53 | 282 | bool blocked = wxPyBeginBlockThreads(); \ |
19a97bd6 RD |
283 | if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \ |
284 | rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(ii)", a,b)); \ | |
da32eb53 | 285 | wxPyEndBlockThreads(blocked); \ |
19a97bd6 RD |
286 | if (! found) \ |
287 | rval = PCLASS::CBNAME(a,b); \ | |
288 | return rval; \ | |
289 | } \ | |
290 | bool base_##CBNAME(int a, int b) { \ | |
291 | return PCLASS::CBNAME(a,b); \ | |
f6bcfd97 BP |
292 | } |
293 | ||
294 | ||
295 | ||
19a97bd6 RD |
296 | #define PYCALLBACK_DOUBLE_INTINT(PCLASS, CBNAME) \ |
297 | double CBNAME(int a, int b) { \ | |
298 | bool found; \ | |
da32eb53 | 299 | bool blocked = wxPyBeginBlockThreads(); \ |
19a97bd6 RD |
300 | double rval; \ |
301 | if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \ | |
302 | PyObject* ro; \ | |
303 | ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("(ii)",a,b)); \ | |
304 | if (ro) { \ | |
305 | PyObject* str = PyObject_Str(ro); \ | |
306 | rval = PyFloat_AsDouble(str); \ | |
307 | Py_DECREF(ro); Py_DECREF(str); \ | |
308 | } \ | |
309 | } \ | |
da32eb53 | 310 | wxPyEndBlockThreads(blocked); \ |
19a97bd6 RD |
311 | if (! found) \ |
312 | rval = PCLASS::CBNAME(a, b); \ | |
313 | return rval; \ | |
314 | } \ | |
315 | double base_##CBNAME(int a, int b) { \ | |
316 | return PCLASS::CBNAME(a, b); \ | |
f6bcfd97 BP |
317 | } |
318 | ||
319 | ||
320 | ||
19a97bd6 RD |
321 | #define PYCALLBACK__(PCLASS, CBNAME) \ |
322 | void CBNAME() { \ | |
323 | bool found; \ | |
da32eb53 | 324 | bool blocked = wxPyBeginBlockThreads(); \ |
19a97bd6 RD |
325 | if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \ |
326 | wxPyCBH_callCallback(m_myInst, Py_BuildValue("()")); \ | |
da32eb53 | 327 | wxPyEndBlockThreads(blocked); \ |
19a97bd6 RD |
328 | if (! found) \ |
329 | PCLASS::CBNAME(); \ | |
330 | } \ | |
331 | void base_##CBNAME() { \ | |
332 | PCLASS::CBNAME(); \ | |
f6bcfd97 BP |
333 | } |
334 | ||
335 | ||
336 | ||
337 | ||
19a97bd6 RD |
338 | #define PYCALLBACK_BOOL_SIZETSIZET(PCLASS, CBNAME) \ |
339 | bool CBNAME(size_t a, size_t b) { \ | |
36fd8ec3 | 340 | bool rval = 0; \ |
19a97bd6 | 341 | bool found; \ |
da32eb53 | 342 | bool blocked = wxPyBeginBlockThreads(); \ |
19a97bd6 RD |
343 | if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \ |
344 | rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(ii)", a,b)); \ | |
da32eb53 | 345 | wxPyEndBlockThreads(blocked); \ |
19a97bd6 RD |
346 | if (! found) \ |
347 | rval = PCLASS::CBNAME(a,b); \ | |
348 | return rval; \ | |
349 | } \ | |
350 | bool base_##CBNAME(size_t a, size_t b) { \ | |
351 | return PCLASS::CBNAME(a,b); \ | |
f6bcfd97 BP |
352 | } |
353 | ||
354 | ||
355 | ||
19a97bd6 RD |
356 | #define PYCALLBACK_BOOL_SIZET(PCLASS, CBNAME) \ |
357 | bool CBNAME(size_t a) { \ | |
36fd8ec3 | 358 | bool rval = 0; \ |
19a97bd6 | 359 | bool found; \ |
da32eb53 | 360 | bool blocked = wxPyBeginBlockThreads(); \ |
19a97bd6 RD |
361 | if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \ |
362 | rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(i)", a)); \ | |
da32eb53 | 363 | wxPyEndBlockThreads(blocked); \ |
19a97bd6 RD |
364 | if (! found) \ |
365 | rval = PCLASS::CBNAME(a); \ | |
366 | return rval; \ | |
367 | } \ | |
368 | bool base_##CBNAME(size_t a) { \ | |
369 | return PCLASS::CBNAME(a); \ | |
f6bcfd97 BP |
370 | } |
371 | ||
372 | ||
19a97bd6 RD |
373 | #define PYCALLBACK_STRING_INT(PCLASS, CBNAME) \ |
374 | wxString CBNAME(int a) { \ | |
375 | bool found; \ | |
da32eb53 | 376 | bool blocked = wxPyBeginBlockThreads(); \ |
19a97bd6 RD |
377 | wxString rval; \ |
378 | if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \ | |
379 | PyObject* ro; \ | |
380 | ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("(i)",a)); \ | |
381 | if (ro) { \ | |
a541c325 RD |
382 | rval = Py2wxString(ro); \ |
383 | Py_DECREF(ro); \ | |
19a97bd6 RD |
384 | } \ |
385 | } \ | |
da32eb53 | 386 | wxPyEndBlockThreads(blocked); \ |
19a97bd6 RD |
387 | if (! found) \ |
388 | rval = PCLASS::CBNAME(a); \ | |
389 | return rval; \ | |
390 | } \ | |
391 | wxString base_##CBNAME(int a) { \ | |
392 | return PCLASS::CBNAME(a); \ | |
f6bcfd97 BP |
393 | } |
394 | ||
395 | ||
19a97bd6 RD |
396 | #define PYCALLBACK__INTSTRING(PCLASS, CBNAME) \ |
397 | void CBNAME(int a, const wxString& c) { \ | |
398 | bool found; \ | |
da32eb53 | 399 | bool blocked = wxPyBeginBlockThreads(); \ |
85260f24 | 400 | if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \ |
a66212dc RD |
401 | PyObject* s = wx2PyString(c); \ |
402 | wxPyCBH_callCallback(m_myInst, Py_BuildValue("(iO)",a,s)); \ | |
403 | Py_DECREF(s); \ | |
404 | } \ | |
da32eb53 | 405 | wxPyEndBlockThreads(blocked); \ |
19a97bd6 RD |
406 | if (! found) \ |
407 | PCLASS::CBNAME(a,c); \ | |
408 | } \ | |
409 | void base_##CBNAME(int a, const wxString& c) { \ | |
410 | PCLASS::CBNAME(a,c); \ | |
f6bcfd97 BP |
411 | } |
412 | ||
413 | ||
414 | ||
415 | ||
19a97bd6 RD |
416 | #define PYCALLBACK_BOOL_(PCLASS, CBNAME) \ |
417 | bool CBNAME() { \ | |
36fd8ec3 | 418 | bool rval = 0; \ |
19a97bd6 | 419 | bool found; \ |
da32eb53 | 420 | bool blocked = wxPyBeginBlockThreads(); \ |
19a97bd6 RD |
421 | if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \ |
422 | rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("()")); \ | |
da32eb53 | 423 | wxPyEndBlockThreads(blocked); \ |
19a97bd6 RD |
424 | if (! found) \ |
425 | rval = PCLASS::CBNAME(); \ | |
426 | return rval; \ | |
427 | } \ | |
428 | bool base_##CBNAME() { \ | |
429 | return PCLASS::CBNAME(); \ | |
f6bcfd97 BP |
430 | } |
431 | ||
432 | ||
433 | ||
19a97bd6 RD |
434 | #define PYCALLBACK__SIZETINT(PCLASS, CBNAME) \ |
435 | void CBNAME(size_t a, int b) { \ | |
436 | bool found; \ | |
da32eb53 | 437 | bool blocked = wxPyBeginBlockThreads(); \ |
19a97bd6 RD |
438 | if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \ |
439 | wxPyCBH_callCallback(m_myInst, Py_BuildValue("(ii)", a,b)); \ | |
da32eb53 | 440 | wxPyEndBlockThreads(blocked); \ |
19a97bd6 RD |
441 | if (! found) \ |
442 | PCLASS::CBNAME(a,b); \ | |
443 | } \ | |
444 | void base_##CBNAME(size_t a, int b) { \ | |
445 | PCLASS::CBNAME(a,b); \ | |
f6bcfd97 BP |
446 | } |
447 | ||
448 | ||
449 | ||
450 | ||
19a97bd6 RD |
451 | #define PYCALLBACK__INTINTLONG(PCLASS, CBNAME) \ |
452 | void CBNAME(int a, int b, long c) { \ | |
453 | bool found; \ | |
da32eb53 | 454 | bool blocked = wxPyBeginBlockThreads(); \ |
19a97bd6 RD |
455 | if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \ |
456 | wxPyCBH_callCallback(m_myInst, Py_BuildValue("(iii)", a,b,c)); \ | |
da32eb53 | 457 | wxPyEndBlockThreads(blocked); \ |
19a97bd6 RD |
458 | if (! found) \ |
459 | PCLASS::CBNAME(a,b,c); \ | |
460 | } \ | |
461 | void base_##CBNAME(int a, int b, long c) { \ | |
462 | PCLASS::CBNAME(a,b,c); \ | |
f6bcfd97 BP |
463 | } |
464 | ||
465 | ||
466 | ||
467 | ||
19a97bd6 RD |
468 | #define PYCALLBACK__INTINTDOUBLE(PCLASS, CBNAME) \ |
469 | void CBNAME(int a, int b, double c) { \ | |
470 | bool found; \ | |
da32eb53 | 471 | bool blocked = wxPyBeginBlockThreads(); \ |
19a97bd6 RD |
472 | if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \ |
473 | wxPyCBH_callCallback(m_myInst, Py_BuildValue("(iif)", a,b,c)); \ | |
da32eb53 | 474 | wxPyEndBlockThreads(blocked); \ |
19a97bd6 RD |
475 | if (! found) \ |
476 | PCLASS::CBNAME(a,b,c); \ | |
477 | } \ | |
478 | void base_##CBNAME(int a, int b, double c) { \ | |
479 | PCLASS::CBNAME(a,b,c); \ | |
f6bcfd97 BP |
480 | } |
481 | ||
482 | ||
483 | ||
19a97bd6 RD |
484 | #define PYCALLBACK__INTINTBOOL(PCLASS, CBNAME) \ |
485 | void CBNAME(int a, int b, bool c) { \ | |
486 | bool found; \ | |
da32eb53 | 487 | bool blocked = wxPyBeginBlockThreads(); \ |
19a97bd6 RD |
488 | if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \ |
489 | wxPyCBH_callCallback(m_myInst, Py_BuildValue("(iii)", a,b,c)); \ | |
da32eb53 | 490 | wxPyEndBlockThreads(blocked); \ |
19a97bd6 RD |
491 | if (! found) \ |
492 | PCLASS::CBNAME(a,b,c); \ | |
493 | } \ | |
494 | void base_##CBNAME(int a, int b, bool c) { \ | |
495 | PCLASS::CBNAME(a,b,c); \ | |
f6bcfd97 BP |
496 | } |
497 | ||
498 | ||
499 | ||
500 | ||
33ff77f6 | 501 | %} |
f6bcfd97 | 502 | |
33ff77f6 | 503 | //--------------------------------------------------------------------------- |
f6bcfd97 | 504 | |
33ff77f6 RD |
505 | class wxGridCellCoords; |
506 | class wxGridCellAttr; | |
f6bcfd97 BP |
507 | |
508 | #define wxGRID_VALUE_STRING "string" | |
509 | #define wxGRID_VALUE_BOOL "bool" | |
510 | #define wxGRID_VALUE_NUMBER "long" | |
511 | #define wxGRID_VALUE_FLOAT "double" | |
512 | #define wxGRID_VALUE_CHOICE "choice" | |
513 | #define wxGRID_VALUE_TEXT "string" | |
514 | #define wxGRID_VALUE_LONG "long" | |
33ff77f6 RD |
515 | #define wxGRID_VALUE_CHOICEINT "choiceint" |
516 | #define wxGRID_VALUE_DATETIME "datetime" | |
517 | ||
f6bcfd97 | 518 | |
d14a1e28 RD |
519 | %immutable; |
520 | const wxGridCellCoords wxGridNoCellCoords; | |
521 | const wxRect wxGridNoCellRect; | |
522 | %mutable; | |
f6bcfd97 | 523 | |
3c6e3872 | 524 | |
a77bf68f RD |
525 | %{ |
526 | #define wxGRID_DEFAULT_NUMBER_ROWS WXGRID_DEFAULT_NUMBER_ROWS | |
527 | #define wxGRID_DEFAULT_NUMBER_COLS WXGRID_DEFAULT_NUMBER_COLS | |
528 | #define wxGRID_DEFAULT_ROW_HEIGHT WXGRID_DEFAULT_ROW_HEIGHT | |
529 | #define wxGRID_DEFAULT_COL_WIDTH WXGRID_DEFAULT_COL_WIDTH | |
530 | #define wxGRID_DEFAULT_COL_LABEL_HEIGHT WXGRID_DEFAULT_COL_LABEL_HEIGHT | |
531 | #define wxGRID_DEFAULT_ROW_LABEL_WIDTH WXGRID_DEFAULT_ROW_LABEL_WIDTH | |
532 | #define wxGRID_LABEL_EDGE_ZONE WXGRID_LABEL_EDGE_ZONE | |
533 | #define wxGRID_MIN_ROW_HEIGHT WXGRID_MIN_ROW_HEIGHT | |
534 | #define wxGRID_MIN_COL_WIDTH WXGRID_MIN_COL_WIDTH | |
535 | #define wxGRID_DEFAULT_SCROLLBAR_WIDTH WXGRID_DEFAULT_SCROLLBAR_WIDTH | |
536 | %} | |
3c6e3872 RD |
537 | |
538 | enum { | |
a77bf68f RD |
539 | wxGRID_DEFAULT_NUMBER_ROWS, |
540 | wxGRID_DEFAULT_NUMBER_COLS, | |
541 | wxGRID_DEFAULT_ROW_HEIGHT, | |
542 | wxGRID_DEFAULT_COL_WIDTH, | |
543 | wxGRID_DEFAULT_COL_LABEL_HEIGHT, | |
544 | wxGRID_DEFAULT_ROW_LABEL_WIDTH, | |
545 | wxGRID_LABEL_EDGE_ZONE, | |
546 | wxGRID_MIN_ROW_HEIGHT, | |
547 | wxGRID_MIN_COL_WIDTH, | |
548 | wxGRID_DEFAULT_SCROLLBAR_WIDTH | |
3c6e3872 RD |
549 | }; |
550 | ||
f6bcfd97 BP |
551 | |
552 | //--------------------------------------------------------------------------- | |
553 | // wxGridCellRenderer is an ABC, and several derived classes are available. | |
554 | // Classes implemented in Python should be derived from wxPyGridCellRenderer. | |
555 | ||
556 | ||
557 | class wxGridCellRenderer | |
558 | { | |
559 | public: | |
d14a1e28 | 560 | %extend { |
33ff77f6 | 561 | void _setOORInfo(PyObject* _self) { |
a77bf68f RD |
562 | if (!self->GetClientObject()) |
563 | self->SetClientObject(new wxPyOORClientData(_self)); | |
33ff77f6 RD |
564 | } |
565 | } | |
566 | ||
f6bcfd97 BP |
567 | void SetParameters(const wxString& params); |
568 | void IncRef(); | |
569 | void DecRef(); | |
570 | ||
571 | virtual void Draw(wxGrid& grid, | |
572 | wxGridCellAttr& attr, | |
573 | wxDC& dc, | |
574 | const wxRect& rect, | |
575 | int row, int col, | |
d14a1e28 | 576 | bool isSelected); |
f6bcfd97 BP |
577 | virtual wxSize GetBestSize(wxGrid& grid, |
578 | wxGridCellAttr& attr, | |
579 | wxDC& dc, | |
d14a1e28 RD |
580 | int row, int col); |
581 | virtual wxGridCellRenderer *Clone() const; | |
f6bcfd97 BP |
582 | }; |
583 | ||
584 | ||
585 | // The C++ version of wxPyGridCellRenderer | |
586 | %{ | |
587 | class wxPyGridCellRenderer : public wxGridCellRenderer | |
588 | { | |
589 | public: | |
590 | wxPyGridCellRenderer() : wxGridCellRenderer() {}; | |
591 | ||
592 | // Implement Python callback aware virtual methods | |
593 | void Draw(wxGrid& grid, wxGridCellAttr& attr, | |
594 | wxDC& dc, const wxRect& rect, | |
595 | int row, int col, bool isSelected) { | |
da32eb53 | 596 | bool blocked = wxPyBeginBlockThreads(); |
1e7ecb7b | 597 | if (wxPyCBH_findCallback(m_myInst, "Draw")) { |
6d450e1a RD |
598 | PyObject* go = wxPyMake_wxObject(&grid,false); |
599 | PyObject* dco = wxPyMake_wxObject(&dc,false); | |
600 | PyObject* ao = wxPyMake_wxGridCellAttr(&attr,false); | |
1e4a197e | 601 | PyObject* ro = wxPyConstructObject((void*)&rect, wxT("wxRect"), 0); |
a66212dc RD |
602 | |
603 | wxPyCBH_callCallback(m_myInst, Py_BuildValue("(OOOOiii)", go, ao, dco, ro, | |
604 | row, col, isSelected)); | |
605 | Py_DECREF(go); | |
606 | Py_DECREF(ao); | |
607 | Py_DECREF(dco); | |
608 | Py_DECREF(ro); | |
f6bcfd97 | 609 | } |
da32eb53 | 610 | wxPyEndBlockThreads(blocked); |
f6bcfd97 BP |
611 | } |
612 | ||
613 | wxSize GetBestSize(wxGrid& grid, wxGridCellAttr& attr, wxDC& dc, | |
614 | int row, int col) { | |
615 | wxSize rval; | |
da32eb53 | 616 | bool blocked = wxPyBeginBlockThreads(); |
1e7ecb7b | 617 | if (wxPyCBH_findCallback(m_myInst, "GetBestSize")) { |
f6bcfd97 BP |
618 | PyObject* ro; |
619 | wxSize* ptr; | |
6d450e1a RD |
620 | PyObject* go = wxPyMake_wxObject(&grid,false); |
621 | PyObject* dco = wxPyMake_wxObject(&dc,false); | |
622 | PyObject* ao = wxPyMake_wxGridCellAttr(&attr,false); | |
a66212dc RD |
623 | |
624 | ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("(OOOii)", | |
625 | go, ao, dco, | |
626 | row, col)); | |
627 | Py_DECREF(go); | |
628 | Py_DECREF(ao); | |
629 | Py_DECREF(dco); | |
630 | ||
f6bcfd97 | 631 | if (ro) { |
db0ff83e | 632 | const char* errmsg = "GetBestSize should return a 2-tuple of integers or a wxSize object."; |
d14a1e28 | 633 | if (wxPyConvertSwigPtr(ro, (void **)&ptr, wxT("wxSize"))) { |
f6bcfd97 | 634 | rval = *ptr; |
db0ff83e RD |
635 | } |
636 | else if (PySequence_Check(ro) && PyObject_Length(ro) == 2) { | |
637 | PyObject* o1 = PySequence_GetItem(ro, 0); | |
638 | PyObject* o2 = PySequence_GetItem(ro, 1); | |
639 | if (PyNumber_Check(o1) && PyNumber_Check(o2)) | |
640 | rval = wxSize(PyInt_AsLong(o1), PyInt_AsLong(o2)); | |
641 | else | |
642 | PyErr_SetString(PyExc_TypeError, errmsg); | |
643 | Py_DECREF(o1); | |
644 | Py_DECREF(o2); | |
645 | } | |
646 | else { | |
647 | PyErr_SetString(PyExc_TypeError, errmsg); | |
648 | } | |
f6bcfd97 BP |
649 | Py_DECREF(ro); |
650 | } | |
651 | } | |
da32eb53 | 652 | wxPyEndBlockThreads(blocked); |
f6bcfd97 BP |
653 | return rval; |
654 | } | |
655 | ||
656 | ||
657 | wxGridCellRenderer *Clone() const { | |
658 | wxGridCellRenderer* rval = NULL; | |
da32eb53 | 659 | bool blocked = wxPyBeginBlockThreads(); |
1e7ecb7b | 660 | if (wxPyCBH_findCallback(m_myInst, "Clone")) { |
f6bcfd97 BP |
661 | PyObject* ro; |
662 | wxGridCellRenderer* ptr; | |
1e7ecb7b | 663 | ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("()")); |
f6bcfd97 | 664 | if (ro) { |
d14a1e28 | 665 | if (wxPyConvertSwigPtr(ro, (void **)&ptr, wxT("wxGridCellRenderer"))) |
f6bcfd97 BP |
666 | rval = ptr; |
667 | Py_DECREF(ro); | |
668 | } | |
669 | } | |
da32eb53 | 670 | wxPyEndBlockThreads(blocked); |
f6bcfd97 BP |
671 | return rval; |
672 | } | |
673 | ||
674 | DEC_PYCALLBACK__STRING(SetParameters); | |
675 | ||
676 | PYPRIVATE; | |
677 | }; | |
678 | ||
679 | IMP_PYCALLBACK__STRING( wxPyGridCellRenderer, wxGridCellRenderer, SetParameters); | |
680 | ||
681 | %} | |
682 | ||
683 | ||
684 | // Let SWIG know about it so it can create the Python version | |
685 | class wxPyGridCellRenderer : public wxGridCellRenderer { | |
686 | public: | |
2b9048c5 | 687 | %pythonAppend wxPyGridCellRenderer "self._setCallbackInfo(self, PyGridCellRenderer);self._setOORInfo(self)" |
d14a1e28 | 688 | |
f6bcfd97 | 689 | wxPyGridCellRenderer(); |
0122b7e3 | 690 | void _setCallbackInfo(PyObject* self, PyObject* _class); |
f6bcfd97 BP |
691 | |
692 | void base_SetParameters(const wxString& params); | |
693 | }; | |
694 | ||
695 | //--------------------------------------------------------------------------- | |
696 | // Predefined Renderers | |
697 | ||
698 | class wxGridCellStringRenderer : public wxGridCellRenderer | |
699 | { | |
700 | public: | |
2b9048c5 | 701 | %pythonAppend wxGridCellStringRenderer "self._setOORInfo(self)" |
f6bcfd97 BP |
702 | wxGridCellStringRenderer(); |
703 | }; | |
704 | ||
705 | ||
706 | class wxGridCellNumberRenderer : public wxGridCellStringRenderer | |
707 | { | |
708 | public: | |
2b9048c5 | 709 | %pythonAppend wxGridCellNumberRenderer "self._setOORInfo(self)" |
f6bcfd97 BP |
710 | wxGridCellNumberRenderer(); |
711 | }; | |
712 | ||
713 | ||
714 | class wxGridCellFloatRenderer : public wxGridCellStringRenderer | |
715 | { | |
716 | public: | |
2b9048c5 | 717 | %pythonAppend wxGridCellFloatRenderer "self._setOORInfo(self)" |
f6bcfd97 BP |
718 | wxGridCellFloatRenderer(int width = -1, int precision = -1); |
719 | ||
720 | int GetWidth() const; | |
721 | void SetWidth(int width); | |
722 | int GetPrecision() const; | |
723 | void SetPrecision(int precision); | |
724 | }; | |
725 | ||
726 | ||
727 | class wxGridCellBoolRenderer : public wxGridCellRenderer | |
728 | { | |
729 | public: | |
2b9048c5 | 730 | %pythonAppend wxGridCellBoolRenderer "self._setOORInfo(self)" |
f6bcfd97 BP |
731 | wxGridCellBoolRenderer(); |
732 | }; | |
733 | ||
734 | ||
19a97bd6 RD |
735 | class wxGridCellDateTimeRenderer : public wxGridCellStringRenderer |
736 | { | |
737 | public: | |
2b9048c5 | 738 | %pythonAppend wxGridCellDateTimeRenderer "self._setOORInfo(self)" |
33ff77f6 RD |
739 | wxGridCellDateTimeRenderer(wxString outformat = wxPyDateTimeFormatStr, |
740 | wxString informat = wxPyDateTimeFormatStr); | |
19a97bd6 RD |
741 | }; |
742 | ||
743 | ||
744 | class wxGridCellEnumRenderer : public wxGridCellStringRenderer | |
745 | { | |
746 | public: | |
2b9048c5 | 747 | %pythonAppend wxGridCellEnumRenderer "self._setOORInfo(self)" |
33ff77f6 | 748 | wxGridCellEnumRenderer( const wxString& choices = wxPyEmptyString ); |
19a97bd6 RD |
749 | }; |
750 | ||
751 | ||
752 | class wxGridCellAutoWrapStringRenderer : public wxGridCellStringRenderer | |
753 | { | |
754 | public: | |
2b9048c5 | 755 | %pythonAppend wxGridCellAutoWrapStringRenderer "self._setOORInfo(self)" |
19a97bd6 RD |
756 | wxGridCellAutoWrapStringRenderer(); |
757 | }; | |
758 | ||
f6bcfd97 BP |
759 | |
760 | //--------------------------------------------------------------------------- | |
761 | // wxGridCellEditor is an ABC, and several derived classes are available. | |
762 | // Classes implemented in Python should be derived from wxPyGridCellEditor. | |
763 | ||
764 | class wxGridCellEditor | |
765 | { | |
766 | public: | |
d14a1e28 | 767 | %extend { |
33ff77f6 | 768 | void _setOORInfo(PyObject* _self) { |
a77bf68f RD |
769 | if (!self->GetClientObject()) |
770 | self->SetClientObject(new wxPyOORClientData(_self)); | |
33ff77f6 RD |
771 | } |
772 | } | |
773 | ||
f6bcfd97 BP |
774 | bool IsCreated(); |
775 | wxControl* GetControl(); | |
776 | void SetControl(wxControl* control); | |
777 | ||
1e4a197e RD |
778 | wxGridCellAttr* GetCellAttr(); |
779 | void SetCellAttr(wxGridCellAttr* attr); | |
780 | ||
f6bcfd97 BP |
781 | void SetParameters(const wxString& params); |
782 | void IncRef(); | |
783 | void DecRef(); | |
784 | ||
785 | virtual void Create(wxWindow* parent, | |
786 | wxWindowID id, | |
d14a1e28 RD |
787 | wxEvtHandler* evtHandler); |
788 | virtual void BeginEdit(int row, int col, wxGrid* grid); | |
789 | virtual bool EndEdit(int row, int col, wxGrid* grid); | |
790 | virtual void Reset(); | |
791 | virtual wxGridCellEditor *Clone() const; | |
f6bcfd97 BP |
792 | |
793 | virtual void SetSize(const wxRect& rect); | |
794 | virtual void Show(bool show, wxGridCellAttr *attr = NULL); | |
795 | virtual void PaintBackground(const wxRect& rectCell, wxGridCellAttr *attr); | |
796 | virtual bool IsAcceptedKey(wxKeyEvent& event); | |
797 | virtual void StartingKey(wxKeyEvent& event); | |
798 | virtual void StartingClick(); | |
799 | virtual void HandleReturn(wxKeyEvent& event); | |
800 | virtual void Destroy(); | |
801 | ||
802 | }; | |
803 | ||
804 | ||
805 | // The C++ version of wxPyGridCellEditor | |
806 | %{ | |
807 | class wxPyGridCellEditor : public wxGridCellEditor | |
808 | { | |
809 | public: | |
810 | wxPyGridCellEditor() : wxGridCellEditor() {} | |
811 | ||
812 | void Create(wxWindow* parent, wxWindowID id, wxEvtHandler* evtHandler) { | |
da32eb53 | 813 | bool blocked = wxPyBeginBlockThreads(); |
1e7ecb7b | 814 | if (wxPyCBH_findCallback(m_myInst, "Create")) { |
6d450e1a RD |
815 | PyObject* po = wxPyMake_wxObject(parent,false); |
816 | PyObject* eo = wxPyMake_wxObject(evtHandler,false); | |
a66212dc RD |
817 | |
818 | wxPyCBH_callCallback(m_myInst, Py_BuildValue("(OiO)", po, id, eo)); | |
819 | Py_DECREF(po); | |
820 | Py_DECREF(eo); | |
f6bcfd97 | 821 | } |
da32eb53 | 822 | wxPyEndBlockThreads(blocked); |
f6bcfd97 BP |
823 | } |
824 | ||
825 | ||
826 | void BeginEdit(int row, int col, wxGrid* grid) { | |
da32eb53 | 827 | bool blocked = wxPyBeginBlockThreads(); |
1e7ecb7b | 828 | if (wxPyCBH_findCallback(m_myInst, "BeginEdit")) { |
6d450e1a | 829 | PyObject* go = wxPyMake_wxObject(grid,false); |
a66212dc RD |
830 | wxPyCBH_callCallback(m_myInst, Py_BuildValue("(iiO)", row, col, go)); |
831 | Py_DECREF(go); | |
f6bcfd97 | 832 | } |
da32eb53 | 833 | wxPyEndBlockThreads(blocked); |
f6bcfd97 BP |
834 | } |
835 | ||
836 | ||
837 | bool EndEdit(int row, int col, wxGrid* grid) { | |
dd9f7fea | 838 | bool rv = False; |
da32eb53 | 839 | bool blocked = wxPyBeginBlockThreads(); |
1e7ecb7b | 840 | if (wxPyCBH_findCallback(m_myInst, "EndEdit")) { |
6d450e1a | 841 | PyObject* go = wxPyMake_wxObject(grid,false); |
a66212dc RD |
842 | rv = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(iiO)", row, col, go)); |
843 | Py_DECREF(go); | |
f6bcfd97 | 844 | } |
da32eb53 | 845 | wxPyEndBlockThreads(blocked); |
f6bcfd97 BP |
846 | return rv; |
847 | } | |
848 | ||
849 | ||
1e4a197e | 850 | wxGridCellEditor* Clone() const { |
f6bcfd97 | 851 | wxGridCellEditor* rval = NULL; |
da32eb53 | 852 | bool blocked = wxPyBeginBlockThreads(); |
1e7ecb7b | 853 | if (wxPyCBH_findCallback(m_myInst, "Clone")) { |
f6bcfd97 BP |
854 | PyObject* ro; |
855 | wxGridCellEditor* ptr; | |
1e7ecb7b | 856 | ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("()")); |
f6bcfd97 | 857 | if (ro) { |
d14a1e28 | 858 | if (wxPyConvertSwigPtr(ro, (void **)&ptr, wxT("wxGridCellEditor"))) |
f6bcfd97 BP |
859 | rval = ptr; |
860 | Py_DECREF(ro); | |
861 | } | |
862 | } | |
da32eb53 | 863 | wxPyEndBlockThreads(blocked); |
f6bcfd97 BP |
864 | return rval; |
865 | } | |
866 | ||
867 | ||
868 | void Show(bool show, wxGridCellAttr *attr) { | |
19a97bd6 | 869 | bool found; |
da32eb53 | 870 | bool blocked = wxPyBeginBlockThreads(); |
a66212dc | 871 | if ((found = wxPyCBH_findCallback(m_myInst, "Show"))) { |
6d450e1a | 872 | PyObject* ao = wxPyMake_wxGridCellAttr(attr,false); |
a66212dc RD |
873 | wxPyCBH_callCallback(m_myInst, Py_BuildValue("(iO)", show, ao)); |
874 | Py_DECREF(ao); | |
875 | } | |
da32eb53 | 876 | wxPyEndBlockThreads(blocked); |
19a97bd6 | 877 | if (! found) |
f6bcfd97 | 878 | wxGridCellEditor::Show(show, attr); |
f6bcfd97 BP |
879 | } |
880 | void base_Show(bool show, wxGridCellAttr *attr) { | |
881 | wxGridCellEditor::Show(show, attr); | |
882 | } | |
883 | ||
884 | ||
885 | void PaintBackground(const wxRect& rectCell, wxGridCellAttr *attr) { | |
a66212dc | 886 | bool found; |
da32eb53 | 887 | bool blocked = wxPyBeginBlockThreads(); |
a66212dc | 888 | if ((found = wxPyCBH_findCallback(m_myInst, "PaintBackground)"))) { |
6d450e1a | 889 | PyObject* ao = wxPyMake_wxGridCellAttr(attr,false); |
1e4a197e | 890 | PyObject* ro = wxPyConstructObject((void*)&rectCell, wxT("wxRect"), 0); |
a66212dc RD |
891 | |
892 | wxPyCBH_callCallback(m_myInst, Py_BuildValue("(OO)", ro, ao)); | |
893 | ||
894 | Py_DECREF(ro); | |
895 | Py_DECREF(ao); | |
896 | } | |
da32eb53 | 897 | wxPyEndBlockThreads(blocked); |
19a97bd6 | 898 | if (! found) |
f6bcfd97 | 899 | wxGridCellEditor::PaintBackground(rectCell, attr); |
f6bcfd97 BP |
900 | } |
901 | void base_PaintBackground(const wxRect& rectCell, wxGridCellAttr *attr) { | |
902 | wxGridCellEditor::PaintBackground(rectCell, attr); | |
903 | } | |
904 | ||
905 | ||
906 | DEC_PYCALLBACK___pure(Reset); | |
907 | DEC_PYCALLBACK__constany(SetSize, wxRect); | |
908 | DEC_PYCALLBACK_bool_any(IsAcceptedKey, wxKeyEvent); | |
909 | DEC_PYCALLBACK__any(StartingKey, wxKeyEvent); | |
910 | DEC_PYCALLBACK__any(HandleReturn, wxKeyEvent); | |
911 | DEC_PYCALLBACK__(StartingClick); | |
912 | DEC_PYCALLBACK__(Destroy); | |
913 | DEC_PYCALLBACK__STRING(SetParameters); | |
2d138379 | 914 | DEC_PYCALLBACK_STRING__constpure(GetValue); |
f6bcfd97 BP |
915 | |
916 | PYPRIVATE; | |
917 | }; | |
918 | ||
919 | ||
920 | IMP_PYCALLBACK__STRING( wxPyGridCellEditor, wxGridCellEditor, SetParameters); | |
921 | IMP_PYCALLBACK___pure(wxPyGridCellEditor, wxGridCellEditor, Reset); | |
922 | IMP_PYCALLBACK__constany(wxPyGridCellEditor, wxGridCellEditor, SetSize, wxRect); | |
923 | IMP_PYCALLBACK_bool_any(wxPyGridCellEditor, wxGridCellEditor, IsAcceptedKey, wxKeyEvent); | |
924 | IMP_PYCALLBACK__any(wxPyGridCellEditor, wxGridCellEditor, StartingKey, wxKeyEvent); | |
925 | IMP_PYCALLBACK__any(wxPyGridCellEditor, wxGridCellEditor, HandleReturn, wxKeyEvent); | |
926 | IMP_PYCALLBACK__(wxPyGridCellEditor, wxGridCellEditor, StartingClick); | |
927 | IMP_PYCALLBACK__(wxPyGridCellEditor, wxGridCellEditor, Destroy); | |
2d138379 | 928 | IMP_PYCALLBACK_STRING__constpure(wxPyGridCellEditor, wxGridCellEditor, GetValue); |
f6bcfd97 BP |
929 | |
930 | %} | |
931 | ||
932 | ||
933 | // Let SWIG know about it so it can create the Python version | |
934 | class wxPyGridCellEditor : public wxGridCellEditor { | |
935 | public: | |
2b9048c5 | 936 | %pythonAppend wxPyGridCellEditor "self._setCallbackInfo(self, PyGridCellEditor);self._setOORInfo(self)" |
8826712e | 937 | |
f6bcfd97 | 938 | wxPyGridCellEditor(); |
0122b7e3 | 939 | void _setCallbackInfo(PyObject* self, PyObject* _class); |
f6bcfd97 BP |
940 | |
941 | void base_SetSize(const wxRect& rect); | |
942 | void base_Show(bool show, wxGridCellAttr *attr = NULL); | |
943 | void base_PaintBackground(const wxRect& rectCell, wxGridCellAttr *attr); | |
877d6bae | 944 | bool base_IsAcceptedKey(wxKeyEvent& event); |
f6bcfd97 BP |
945 | void base_StartingKey(wxKeyEvent& event); |
946 | void base_StartingClick(); | |
947 | void base_HandleReturn(wxKeyEvent& event); | |
948 | void base_Destroy(); | |
949 | void base_SetParameters(const wxString& params); | |
950 | }; | |
951 | ||
952 | //--------------------------------------------------------------------------- | |
953 | // Predefined Editors | |
954 | ||
955 | class wxGridCellTextEditor : public wxGridCellEditor | |
956 | { | |
957 | public: | |
2b9048c5 | 958 | %pythonAppend wxGridCellTextEditor "self._setOORInfo(self)" |
f6bcfd97 | 959 | wxGridCellTextEditor(); |
2d138379 | 960 | virtual wxString GetValue(); |
f6bcfd97 BP |
961 | }; |
962 | ||
963 | ||
964 | class wxGridCellNumberEditor : public wxGridCellTextEditor | |
965 | { | |
966 | public: | |
2b9048c5 | 967 | %pythonAppend wxGridCellNumberEditor "self._setOORInfo(self)" |
f6bcfd97 | 968 | wxGridCellNumberEditor(int min = -1, int max = -1); |
2d138379 | 969 | virtual wxString GetValue(); |
f6bcfd97 BP |
970 | }; |
971 | ||
972 | ||
973 | class wxGridCellFloatEditor : public wxGridCellTextEditor | |
974 | { | |
975 | public: | |
2b9048c5 | 976 | %pythonAppend wxGridCellFloatEditor "self._setOORInfo(self)" |
0c020826 | 977 | wxGridCellFloatEditor(int width = -1, int precision = -1); |
2d138379 | 978 | virtual wxString GetValue(); |
f6bcfd97 BP |
979 | }; |
980 | ||
981 | ||
982 | class wxGridCellBoolEditor : public wxGridCellEditor | |
983 | { | |
984 | public: | |
2b9048c5 | 985 | %pythonAppend wxGridCellBoolEditor "self._setOORInfo(self)" |
f6bcfd97 | 986 | wxGridCellBoolEditor(); |
2d138379 | 987 | virtual wxString GetValue(); |
f6bcfd97 BP |
988 | }; |
989 | ||
990 | class wxGridCellChoiceEditor : public wxGridCellEditor | |
991 | { | |
992 | public: | |
2b9048c5 | 993 | %pythonAppend wxGridCellChoiceEditor "self._setOORInfo(self)" |
7722248d RD |
994 | wxGridCellChoiceEditor(int choices = 0, |
995 | const wxString* choices_array = NULL, | |
dd9f7fea | 996 | bool allowOthers = False); |
2d138379 | 997 | virtual wxString GetValue(); |
f6bcfd97 BP |
998 | }; |
999 | ||
19a97bd6 RD |
1000 | |
1001 | class wxGridCellEnumEditor : public wxGridCellChoiceEditor | |
1002 | { | |
1003 | public: | |
2b9048c5 | 1004 | %pythonAppend wxGridCellEnumEditor "self._setOORInfo(self)" |
33ff77f6 | 1005 | wxGridCellEnumEditor( const wxString& choices = wxPyEmptyString ); |
2d138379 | 1006 | virtual wxString GetValue(); |
19a97bd6 RD |
1007 | }; |
1008 | ||
1009 | ||
1010 | class wxGridCellAutoWrapStringEditor : public wxGridCellTextEditor | |
1011 | { | |
1012 | public: | |
2b9048c5 | 1013 | %pythonAppend wxGridCellAutoWrapStringEditor "self._setOORInfo(self)" |
19a97bd6 | 1014 | wxGridCellAutoWrapStringEditor(); |
2d138379 | 1015 | virtual wxString GetValue(); |
19a97bd6 RD |
1016 | }; |
1017 | ||
1018 | ||
1019 | ||
f6bcfd97 BP |
1020 | //--------------------------------------------------------------------------- |
1021 | ||
1022 | ||
1023 | class wxGridCellAttr | |
1024 | { | |
1025 | public: | |
9416aa89 RD |
1026 | enum wxAttrKind |
1027 | { | |
1028 | Any, | |
1029 | Default, | |
1030 | Cell, | |
1031 | Row, | |
1032 | Col, | |
1033 | Merged | |
1034 | }; | |
1035 | ||
d14a1e28 | 1036 | %extend { |
33ff77f6 | 1037 | void _setOORInfo(PyObject* _self) { |
a77bf68f RD |
1038 | if (!self->GetClientObject()) |
1039 | self->SetClientObject(new wxPyOORClientData(_self)); | |
33ff77f6 RD |
1040 | } |
1041 | } | |
8826712e | 1042 | |
2b9048c5 | 1043 | %pythonAppend wxGridCellAttr "self._setOORInfo(self)" |
33ff77f6 | 1044 | |
b5a5d647 | 1045 | wxGridCellAttr(wxGridCellAttr *attrDefault = NULL); |
a77bf68f | 1046 | |
f6bcfd97 | 1047 | wxGridCellAttr *Clone() const; |
9416aa89 | 1048 | void MergeWith(wxGridCellAttr *mergefrom); |
f6bcfd97 BP |
1049 | void IncRef(); |
1050 | void DecRef(); | |
1051 | void SetTextColour(const wxColour& colText); | |
1052 | void SetBackgroundColour(const wxColour& colBack); | |
1053 | void SetFont(const wxFont& font); | |
1054 | void SetAlignment(int hAlign, int vAlign); | |
fd512ba2 | 1055 | void SetSize(int num_rows, int num_cols); |
dd9f7fea RD |
1056 | void SetOverflow( bool allow = True ); |
1057 | void SetReadOnly(bool isReadOnly = True); | |
f6bcfd97 BP |
1058 | |
1059 | void SetRenderer(wxGridCellRenderer *renderer); | |
1060 | void SetEditor(wxGridCellEditor* editor); | |
9416aa89 | 1061 | void SetKind(wxAttrKind kind); |
f6bcfd97 BP |
1062 | |
1063 | bool HasTextColour() const; | |
1064 | bool HasBackgroundColour() const; | |
1065 | bool HasFont() const; | |
1066 | bool HasAlignment() const; | |
1067 | bool HasRenderer() const; | |
1068 | bool HasEditor() const; | |
9416aa89 | 1069 | bool HasReadWriteMode() const; |
3ef86e32 | 1070 | bool HasOverflowMode() const; |
f6bcfd97 | 1071 | |
c5943253 RD |
1072 | wxColour GetTextColour() const; |
1073 | wxColour GetBackgroundColour() const; | |
1074 | wxFont GetFont() const; | |
322913ce RD |
1075 | |
1076 | DocDeclA( | |
1077 | void, GetAlignment(int *OUTPUT, int *OUTPUT) const, | |
1078 | "GetAlignment() -> (hAlign, vAlign)"); | |
8826712e | 1079 | |
322913ce RD |
1080 | DocDeclA( |
1081 | void, GetSize(int *OUTPUT, int *OUTPUT) const, | |
1082 | "GetSize() -> (num_rows, num_cols)"); | |
1083 | ||
fd512ba2 | 1084 | bool GetOverflow() const; |
f6bcfd97 BP |
1085 | wxGridCellRenderer *GetRenderer(wxGrid* grid, int row, int col) const; |
1086 | wxGridCellEditor *GetEditor(wxGrid* grid, int row, int col) const; | |
1087 | ||
1088 | bool IsReadOnly() const; | |
fa003c13 | 1089 | wxAttrKind GetKind(); |
f6bcfd97 BP |
1090 | void SetDefAttr(wxGridCellAttr* defAttr); |
1091 | }; | |
1092 | ||
1093 | //--------------------------------------------------------------------------- | |
1094 | ||
1095 | class wxGridCellAttrProvider | |
1096 | { | |
1097 | public: | |
2b9048c5 | 1098 | %pythonAppend wxGridCellAttrProvider "self._setOORInfo(self)" |
f6bcfd97 BP |
1099 | wxGridCellAttrProvider(); |
1100 | // ???? virtual ~wxGridCellAttrProvider(); | |
33ff77f6 | 1101 | |
d14a1e28 | 1102 | %extend { |
33ff77f6 | 1103 | void _setOORInfo(PyObject* _self) { |
a77bf68f RD |
1104 | if (!self->GetClientObject()) |
1105 | self->SetClientObject(new wxPyOORClientData(_self)); | |
33ff77f6 RD |
1106 | } |
1107 | } | |
f6bcfd97 | 1108 | |
9416aa89 RD |
1109 | wxGridCellAttr *GetAttr(int row, int col, |
1110 | wxGridCellAttr::wxAttrKind kind) const; | |
f6bcfd97 BP |
1111 | void SetAttr(wxGridCellAttr *attr, int row, int col); |
1112 | void SetRowAttr(wxGridCellAttr *attr, int row); | |
1113 | void SetColAttr(wxGridCellAttr *attr, int col); | |
1114 | ||
1115 | void UpdateAttrRows( size_t pos, int numRows ); | |
1116 | void UpdateAttrCols( size_t pos, int numCols ); | |
1117 | ||
1118 | }; | |
1119 | ||
1120 | ||
1121 | // A Python-aware version | |
1122 | %{ | |
1123 | class wxPyGridCellAttrProvider : public wxGridCellAttrProvider | |
1124 | { | |
1125 | public: | |
1126 | wxPyGridCellAttrProvider() : wxGridCellAttrProvider() {}; | |
1127 | ||
9416aa89 | 1128 | PYCALLBACK_GCA_INTINTKIND(wxGridCellAttrProvider, GetAttr); |
f6bcfd97 BP |
1129 | PYCALLBACK__GCAINTINT(wxGridCellAttrProvider, SetAttr); |
1130 | PYCALLBACK__GCAINT(wxGridCellAttrProvider, SetRowAttr); | |
1131 | PYCALLBACK__GCAINT(wxGridCellAttrProvider, SetColAttr); | |
1132 | ||
1133 | PYPRIVATE; | |
1134 | }; | |
1135 | %} | |
1136 | ||
1137 | ||
1138 | // The python-aware version get's SWIGified | |
1139 | class wxPyGridCellAttrProvider : public wxGridCellAttrProvider | |
1140 | { | |
1141 | public: | |
2b9048c5 | 1142 | %pythonAppend wxPyGridCellAttrProvider "self._setCallbackInfo(self, PyGridCellAttrProvider)" |
f6bcfd97 | 1143 | wxPyGridCellAttrProvider(); |
0122b7e3 | 1144 | void _setCallbackInfo(PyObject* self, PyObject* _class); |
f6bcfd97 | 1145 | |
9416aa89 RD |
1146 | wxGridCellAttr *base_GetAttr(int row, int col, |
1147 | wxGridCellAttr::wxAttrKind kind); | |
f6bcfd97 BP |
1148 | void base_SetAttr(wxGridCellAttr *attr, int row, int col); |
1149 | void base_SetRowAttr(wxGridCellAttr *attr, int row); | |
1150 | void base_SetColAttr(wxGridCellAttr *attr, int col); | |
1151 | }; | |
1152 | ||
1153 | ||
1154 | //--------------------------------------------------------------------------- | |
1155 | // Grid Table Base class and Python aware version | |
1156 | ||
1157 | ||
9416aa89 | 1158 | class wxGridTableBase : public wxObject |
f6bcfd97 BP |
1159 | { |
1160 | public: | |
1161 | // wxGridTableBase(); This is an ABC | |
1162 | //~wxGridTableBase(); | |
1163 | ||
d14a1e28 | 1164 | %extend { |
33ff77f6 | 1165 | void _setOORInfo(PyObject* _self) { |
a77bf68f RD |
1166 | if (!self->GetClientObject()) |
1167 | self->SetClientObject(new wxPyOORClientData(_self)); | |
33ff77f6 RD |
1168 | } |
1169 | } | |
1170 | ||
f6bcfd97 BP |
1171 | void SetAttrProvider(wxGridCellAttrProvider *attrProvider); |
1172 | wxGridCellAttrProvider *GetAttrProvider() const; | |
1173 | void SetView( wxGrid *grid ); | |
1174 | wxGrid * GetView() const; | |
1175 | ||
1176 | ||
1177 | // pure virtuals | |
d14a1e28 RD |
1178 | virtual int GetNumberRows(); |
1179 | virtual int GetNumberCols(); | |
1180 | virtual bool IsEmptyCell( int row, int col ); | |
1181 | virtual wxString GetValue( int row, int col ); | |
1182 | virtual void SetValue( int row, int col, const wxString& value ); | |
f6bcfd97 BP |
1183 | |
1184 | // virtuals overridable in wxPyGridTableBase | |
1185 | virtual wxString GetTypeName( int row, int col ); | |
1186 | virtual bool CanGetValueAs( int row, int col, const wxString& typeName ); | |
1187 | virtual bool CanSetValueAs( int row, int col, const wxString& typeName ); | |
1188 | virtual long GetValueAsLong( int row, int col ); | |
1189 | virtual double GetValueAsDouble( int row, int col ); | |
1190 | virtual bool GetValueAsBool( int row, int col ); | |
1191 | virtual void SetValueAsLong( int row, int col, long value ); | |
1192 | virtual void SetValueAsDouble( int row, int col, double value ); | |
1193 | virtual void SetValueAsBool( int row, int col, bool value ); | |
1194 | ||
1195 | //virtual void* GetValueAsCustom( int row, int col, const wxString& typeName ); | |
1196 | //virtual void SetValueAsCustom( int row, int col, const wxString& typeName, void* value ); | |
1197 | ||
1198 | ||
1199 | virtual void Clear(); | |
1200 | virtual bool InsertRows( size_t pos = 0, size_t numRows = 1 ); | |
1201 | virtual bool AppendRows( size_t numRows = 1 ); | |
1202 | virtual bool DeleteRows( size_t pos = 0, size_t numRows = 1 ); | |
1203 | virtual bool InsertCols( size_t pos = 0, size_t numCols = 1 ); | |
1204 | virtual bool AppendCols( size_t numCols = 1 ); | |
1205 | virtual bool DeleteCols( size_t pos = 0, size_t numCols = 1 ); | |
1206 | ||
1207 | virtual wxString GetRowLabelValue( int row ); | |
1208 | virtual wxString GetColLabelValue( int col ); | |
1209 | virtual void SetRowLabelValue( int row, const wxString& value ); | |
1210 | virtual void SetColLabelValue( int col, const wxString& value ); | |
1211 | ||
1212 | virtual bool CanHaveAttributes(); | |
1213 | ||
9416aa89 RD |
1214 | virtual wxGridCellAttr *GetAttr( int row, int col, |
1215 | wxGridCellAttr::wxAttrKind kind); | |
f6bcfd97 BP |
1216 | virtual void SetAttr(wxGridCellAttr* attr, int row, int col); |
1217 | virtual void SetRowAttr(wxGridCellAttr *attr, int row); | |
1218 | virtual void SetColAttr(wxGridCellAttr *attr, int col); | |
1219 | ||
1220 | }; | |
1221 | ||
1222 | ||
1223 | ||
1224 | // Python-aware version | |
1225 | %{ | |
1226 | class wxPyGridTableBase : public wxGridTableBase | |
1227 | { | |
1228 | public: | |
1229 | wxPyGridTableBase() : wxGridTableBase() {} | |
1230 | ||
1231 | PYCALLBACK_INT__pure(GetNumberRows); | |
1232 | PYCALLBACK_INT__pure(GetNumberCols); | |
1233 | PYCALLBACK_BOOL_INTINT_pure(IsEmptyCell); | |
1234 | PYCALLBACK_STRING_INTINT(wxGridTableBase, GetTypeName); | |
1235 | PYCALLBACK_BOOL_INTINTSTRING(wxGridTableBase, CanGetValueAs); | |
1236 | PYCALLBACK_BOOL_INTINTSTRING(wxGridTableBase, CanSetValueAs); | |
1237 | PYCALLBACK__(wxGridTableBase, Clear); | |
1238 | PYCALLBACK_BOOL_SIZETSIZET(wxGridTableBase, InsertRows); | |
1239 | PYCALLBACK_BOOL_SIZETSIZET(wxGridTableBase, DeleteRows); | |
1240 | PYCALLBACK_BOOL_SIZETSIZET(wxGridTableBase, InsertCols); | |
1241 | PYCALLBACK_BOOL_SIZETSIZET(wxGridTableBase, DeleteCols); | |
1242 | PYCALLBACK_BOOL_SIZET(wxGridTableBase, AppendRows); | |
1243 | PYCALLBACK_BOOL_SIZET(wxGridTableBase, AppendCols); | |
1244 | PYCALLBACK_STRING_INT(wxGridTableBase, GetRowLabelValue); | |
1245 | PYCALLBACK_STRING_INT(wxGridTableBase, GetColLabelValue); | |
1246 | PYCALLBACK__INTSTRING(wxGridTableBase, SetRowLabelValue); | |
1247 | PYCALLBACK__INTSTRING(wxGridTableBase, SetColLabelValue); | |
1248 | PYCALLBACK_BOOL_(wxGridTableBase, CanHaveAttributes); | |
9416aa89 | 1249 | PYCALLBACK_GCA_INTINTKIND(wxGridTableBase, GetAttr); |
f6bcfd97 BP |
1250 | PYCALLBACK__GCAINTINT(wxGridTableBase, SetAttr); |
1251 | PYCALLBACK__GCAINT(wxGridTableBase, SetRowAttr); | |
1252 | PYCALLBACK__GCAINT(wxGridTableBase, SetColAttr); | |
1253 | ||
1254 | ||
f6bcfd97 | 1255 | wxString GetValue(int row, int col) { |
da32eb53 | 1256 | bool blocked = wxPyBeginBlockThreads(); |
f6bcfd97 | 1257 | wxString rval; |
1e7ecb7b | 1258 | if (wxPyCBH_findCallback(m_myInst, "GetValue")) { |
f6bcfd97 | 1259 | PyObject* ro; |
1e7ecb7b | 1260 | ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("(ii)",row,col)); |
f6bcfd97 | 1261 | if (ro) { |
8826712e RD |
1262 | if (!PyString_Check(ro) && !PyUnicode_Check(ro)) { |
1263 | PyObject* old = ro; | |
1264 | ro = PyObject_Str(ro); | |
1265 | Py_DECREF(old); | |
1266 | } | |
a541c325 | 1267 | rval = Py2wxString(ro); |
f6bcfd97 BP |
1268 | Py_DECREF(ro); |
1269 | } | |
1270 | } | |
da32eb53 | 1271 | wxPyEndBlockThreads(blocked); |
f6bcfd97 BP |
1272 | return rval; |
1273 | } | |
1274 | ||
1275 | void SetValue(int row, int col, const wxString& val) { | |
da32eb53 | 1276 | bool blocked = wxPyBeginBlockThreads(); |
c8bc7bb8 | 1277 | if (wxPyCBH_findCallback(m_myInst, "SetValue")) { |
a66212dc RD |
1278 | PyObject* s = wx2PyString(val); |
1279 | wxPyCBH_callCallback(m_myInst, Py_BuildValue("(iiO)",row,col,s)); | |
1280 | Py_DECREF(s); | |
c8bc7bb8 | 1281 | } |
da32eb53 | 1282 | wxPyEndBlockThreads(blocked); |
f6bcfd97 BP |
1283 | } |
1284 | ||
1285 | ||
1286 | // Map the Get/Set methods for the standard non-string types to | |
1287 | // the GetValue and SetValue python methods. | |
1288 | long GetValueAsLong( int row, int col ) { | |
1289 | long rval = 0; | |
da32eb53 | 1290 | bool blocked = wxPyBeginBlockThreads(); |
1e7ecb7b | 1291 | if (wxPyCBH_findCallback(m_myInst, "GetValue")) { |
f6bcfd97 BP |
1292 | PyObject* ro; |
1293 | PyObject* num; | |
1e7ecb7b | 1294 | ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("(ii)", row, col)); |
f6bcfd97 BP |
1295 | if (ro && PyNumber_Check(ro)) { |
1296 | num = PyNumber_Int(ro); | |
1297 | if (num) { | |
1298 | rval = PyInt_AsLong(num); | |
1299 | Py_DECREF(num); | |
1300 | } | |
1301 | Py_DECREF(ro); | |
1302 | } | |
1303 | } | |
da32eb53 | 1304 | wxPyEndBlockThreads(blocked); |
f6bcfd97 BP |
1305 | return rval; |
1306 | } | |
1307 | ||
1308 | double GetValueAsDouble( int row, int col ) { | |
1309 | double rval = 0.0; | |
da32eb53 | 1310 | bool blocked = wxPyBeginBlockThreads(); |
1e7ecb7b | 1311 | if (wxPyCBH_findCallback(m_myInst, "GetValue")) { |
f6bcfd97 BP |
1312 | PyObject* ro; |
1313 | PyObject* num; | |
1e7ecb7b | 1314 | ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("(ii)", row, col)); |
f6bcfd97 BP |
1315 | if (ro && PyNumber_Check(ro)) { |
1316 | num = PyNumber_Float(ro); | |
1317 | if (num) { | |
1318 | rval = PyFloat_AsDouble(num); | |
1319 | Py_DECREF(num); | |
1320 | } | |
1321 | Py_DECREF(ro); | |
1322 | } | |
1323 | } | |
da32eb53 | 1324 | wxPyEndBlockThreads(blocked); |
f6bcfd97 BP |
1325 | return rval; |
1326 | } | |
1327 | ||
1328 | bool GetValueAsBool( int row, int col ) { | |
1329 | return (bool)GetValueAsLong(row, col); | |
1330 | } | |
1331 | ||
1332 | void SetValueAsLong( int row, int col, long value ) { | |
da32eb53 | 1333 | bool blocked = wxPyBeginBlockThreads(); |
1e7ecb7b RD |
1334 | if (wxPyCBH_findCallback(m_myInst, "SetValue")) { |
1335 | wxPyCBH_callCallback(m_myInst, Py_BuildValue("(iii)", row, col, value)); | |
f6bcfd97 | 1336 | } |
da32eb53 | 1337 | wxPyEndBlockThreads(blocked); |
f6bcfd97 BP |
1338 | } |
1339 | ||
1340 | void SetValueAsDouble( int row, int col, double value ) { | |
da32eb53 | 1341 | bool blocked = wxPyBeginBlockThreads(); |
1e7ecb7b RD |
1342 | if (wxPyCBH_findCallback(m_myInst, "SetValue")) { |
1343 | wxPyCBH_callCallback(m_myInst, Py_BuildValue("(iid)", row, col, value)); | |
f6bcfd97 | 1344 | } |
da32eb53 | 1345 | wxPyEndBlockThreads(blocked); |
f6bcfd97 BP |
1346 | } |
1347 | ||
1348 | void SetValueAsBool( int row, int col, bool value ) { | |
1349 | SetValueAsLong( row, col, (long)value ); | |
1350 | } | |
1351 | ||
1352 | ||
1353 | PYPRIVATE; | |
1354 | }; | |
1355 | %} | |
1356 | ||
1357 | ||
1358 | // The python-aware version get's SWIGified | |
1359 | class wxPyGridTableBase : public wxGridTableBase | |
1360 | { | |
1361 | public: | |
2b9048c5 | 1362 | %pythonAppend wxPyGridTableBase "self._setCallbackInfo(self, PyGridTableBase);self._setOORInfo(self)" |
f6bcfd97 | 1363 | wxPyGridTableBase(); |
0122b7e3 | 1364 | void _setCallbackInfo(PyObject* self, PyObject* _class); |
f6bcfd97 | 1365 | |
d14a1e28 | 1366 | %extend { void Destroy() { delete self; } } |
f6bcfd97 BP |
1367 | |
1368 | wxString base_GetTypeName( int row, int col ); | |
1369 | bool base_CanGetValueAs( int row, int col, const wxString& typeName ); | |
1370 | bool base_CanSetValueAs( int row, int col, const wxString& typeName ); | |
1371 | void base_Clear(); | |
1372 | bool base_InsertRows( size_t pos = 0, size_t numRows = 1 ); | |
1373 | bool base_AppendRows( size_t numRows = 1 ); | |
1374 | bool base_DeleteRows( size_t pos = 0, size_t numRows = 1 ); | |
1375 | bool base_InsertCols( size_t pos = 0, size_t numCols = 1 ); | |
1376 | bool base_AppendCols( size_t numCols = 1 ); | |
1377 | bool base_DeleteCols( size_t pos = 0, size_t numCols = 1 ); | |
1378 | wxString base_GetRowLabelValue( int row ); | |
1379 | wxString base_GetColLabelValue( int col ); | |
1380 | void base_SetRowLabelValue( int row, const wxString& value ); | |
1381 | void base_SetColLabelValue( int col, const wxString& value ); | |
1382 | bool base_CanHaveAttributes(); | |
9416aa89 RD |
1383 | wxGridCellAttr *base_GetAttr( int row, int col, |
1384 | wxGridCellAttr::wxAttrKind kind ); | |
f6bcfd97 BP |
1385 | void base_SetAttr(wxGridCellAttr* attr, int row, int col); |
1386 | void base_SetRowAttr(wxGridCellAttr *attr, int row); | |
1387 | void base_SetColAttr(wxGridCellAttr *attr, int col); | |
1388 | }; | |
1389 | ||
1390 | ||
1391 | //--------------------------------------------------------------------------- | |
1392 | // Predefined Tables | |
1393 | ||
1394 | class wxGridStringTable : public wxGridTableBase | |
1395 | { | |
1396 | public: | |
2b9048c5 | 1397 | %pythonAppend wxGridStringTable "self._setOORInfo(self)" |
f6bcfd97 BP |
1398 | wxGridStringTable( int numRows=0, int numCols=0 ); |
1399 | }; | |
1400 | ||
1401 | //--------------------------------------------------------------------------- | |
1402 | // The Table can pass messages to the grid to tell it to update itself if | |
1403 | // something has changed. | |
1404 | ||
1405 | enum wxGridTableRequest | |
1406 | { | |
1407 | wxGRIDTABLE_REQUEST_VIEW_GET_VALUES = 2000, | |
1408 | wxGRIDTABLE_REQUEST_VIEW_SEND_VALUES, | |
1409 | wxGRIDTABLE_NOTIFY_ROWS_INSERTED, | |
1410 | wxGRIDTABLE_NOTIFY_ROWS_APPENDED, | |
1411 | wxGRIDTABLE_NOTIFY_ROWS_DELETED, | |
1412 | wxGRIDTABLE_NOTIFY_COLS_INSERTED, | |
1413 | wxGRIDTABLE_NOTIFY_COLS_APPENDED, | |
1414 | wxGRIDTABLE_NOTIFY_COLS_DELETED | |
1415 | }; | |
1416 | ||
1417 | ||
1418 | class wxGridTableMessage | |
1419 | { | |
1420 | public: | |
1421 | wxGridTableMessage( wxGridTableBase *table, int id, | |
1422 | int comInt1 = -1, | |
1423 | int comInt2 = -1 ); | |
1424 | ~wxGridTableMessage(); | |
1425 | ||
1426 | void SetTableObject( wxGridTableBase *table ); | |
1427 | wxGridTableBase * GetTableObject() const; | |
1428 | void SetId( int id ); | |
1429 | int GetId(); | |
1430 | void SetCommandInt( int comInt1 ); | |
1431 | int GetCommandInt(); | |
1432 | void SetCommandInt2( int comInt2 ); | |
1433 | int GetCommandInt2(); | |
1434 | }; | |
1435 | ||
1436 | ||
1437 | //--------------------------------------------------------------------------- | |
1438 | ||
d14a1e28 | 1439 | |
f6bcfd97 | 1440 | // Typemap to allow conversion of sequence objects to wxGridCellCoords... |
d14a1e28 RD |
1441 | %typemap(in) wxGridCellCoords& (wxGridCellCoords temp) { |
1442 | $1 = &temp; | |
1443 | if (! wxGridCellCoords_helper($input, &$1)) SWIG_fail; | |
1444 | } | |
1445 | %typemap(typecheck, precedence=SWIG_TYPECHECK_POINTER) wxGridCellCoords& { | |
1446 | $1 = wxGridCellCoords_typecheck($input); | |
f6bcfd97 BP |
1447 | } |
1448 | ||
d14a1e28 | 1449 | |
f6bcfd97 BP |
1450 | // ...and here is the associated helper. |
1451 | %{ | |
1452 | bool wxGridCellCoords_helper(PyObject* source, wxGridCellCoords** obj) { | |
1453 | ||
22faec7d RD |
1454 | if (source == Py_None) { |
1455 | **obj = wxGridCellCoords(-1,-1); | |
1456 | return True; | |
1457 | } | |
1458 | ||
f6bcfd97 | 1459 | // If source is an object instance then it may already be the right type |
d14a1e28 | 1460 | if (wxPySwigInstance_Check(source)) { |
f6bcfd97 | 1461 | wxGridCellCoords* ptr; |
d14a1e28 | 1462 | if (! wxPyConvertSwigPtr(source, (void **)&ptr, wxT("wxGridCellCoords"))) |
f6bcfd97 BP |
1463 | goto error; |
1464 | *obj = ptr; | |
dd9f7fea | 1465 | return True; |
f6bcfd97 BP |
1466 | } |
1467 | // otherwise a 2-tuple of integers is expected | |
1468 | else if (PySequence_Check(source) && PyObject_Length(source) == 2) { | |
1469 | PyObject* o1 = PySequence_GetItem(source, 0); | |
1470 | PyObject* o2 = PySequence_GetItem(source, 1); | |
d14a1e28 RD |
1471 | if (!PyNumber_Check(o1) || !PyNumber_Check(o2)) { |
1472 | Py_DECREF(o1); | |
1473 | Py_DECREF(o2); | |
1474 | goto error; | |
1475 | } | |
f6bcfd97 | 1476 | **obj = wxGridCellCoords(PyInt_AsLong(o1), PyInt_AsLong(o2)); |
d14a1e28 RD |
1477 | Py_DECREF(o1); |
1478 | Py_DECREF(o2); | |
dd9f7fea | 1479 | return True; |
f6bcfd97 BP |
1480 | } |
1481 | ||
1482 | error: | |
1483 | PyErr_SetString(PyExc_TypeError, "Expected a 2-tuple of integers or a wxGridCellCoords object."); | |
dd9f7fea | 1484 | return False; |
f6bcfd97 | 1485 | } |
f6bcfd97 | 1486 | |
1e4a197e | 1487 | |
d14a1e28 RD |
1488 | bool wxGridCellCoords_typecheck(PyObject* source) { |
1489 | void* ptr; | |
8826712e | 1490 | |
d14a1e28 RD |
1491 | if (wxPySwigInstance_Check(source) && |
1492 | wxPyConvertSwigPtr(source, (void **)&ptr, wxT("wxGridCellCoords"))) | |
dd9f7fea | 1493 | return True; |
1e4a197e | 1494 | |
d14a1e28 RD |
1495 | PyErr_Clear(); |
1496 | if (PySequence_Check(source) && PySequence_Length(source) == 2) | |
dd9f7fea | 1497 | return True; |
8826712e | 1498 | |
dd9f7fea | 1499 | return False; |
1e4a197e | 1500 | } |
d14a1e28 RD |
1501 | %} |
1502 | ||
1e4a197e | 1503 | |
d14a1e28 RD |
1504 | // Typemap to convert an array of cells coords to a list of tuples... |
1505 | %typemap(out) wxGridCellCoordsArray { | |
1506 | $result = wxGridCellCoordsArray_helper($1); | |
1e4a197e RD |
1507 | } |
1508 | ||
d14a1e28 RD |
1509 | // %typemap(ret) wxGridCellCoordsArray { |
1510 | // delete $1; | |
1511 | // } | |
1512 | ||
1e4a197e RD |
1513 | |
1514 | // ...and the helper function for the above typemap. | |
1515 | %{ | |
d14a1e28 | 1516 | PyObject* wxGridCellCoordsArray_helper(const wxGridCellCoordsArray& source) |
1e4a197e RD |
1517 | { |
1518 | PyObject* list = PyList_New(0); | |
1519 | size_t idx; | |
d14a1e28 RD |
1520 | for (idx = 0; idx < source.GetCount(); idx += 1) { |
1521 | wxGridCellCoords& coord = source.Item(idx); | |
1e4a197e RD |
1522 | PyObject* tup = PyTuple_New(2); |
1523 | PyTuple_SET_ITEM(tup, 0, PyInt_FromLong(coord.GetRow())); | |
1524 | PyTuple_SET_ITEM(tup, 1, PyInt_FromLong(coord.GetCol())); | |
1525 | PyList_Append(list, tup); | |
1526 | Py_DECREF(tup); | |
1527 | } | |
1528 | return list; | |
1529 | } | |
1530 | %} | |
1531 | ||
22faec7d RD |
1532 | |
1533 | ||
1534 | ||
1535 | ||
1536 | class wxGridCellCoords | |
1537 | { | |
1538 | public: | |
1539 | wxGridCellCoords( int r=-1, int c=-1 ); | |
1540 | ~wxGridCellCoords(); | |
1541 | ||
1542 | int GetRow() const; | |
1543 | void SetRow( int n ); | |
1544 | int GetCol() const; | |
1545 | void SetCol( int n ); | |
1546 | void Set( int row, int col ); | |
1547 | ||
1548 | bool operator==( const wxGridCellCoords& other ) const; | |
1549 | bool operator!=( const wxGridCellCoords& other ) const; | |
1550 | ||
1551 | %extend { | |
d07d2bc9 | 1552 | PyObject* Get() { |
22faec7d RD |
1553 | PyObject* tup = PyTuple_New(2); |
1554 | PyTuple_SET_ITEM(tup, 0, PyInt_FromLong(self->GetRow())); | |
1555 | PyTuple_SET_ITEM(tup, 1, PyInt_FromLong(self->GetCol())); | |
1556 | return tup; | |
1557 | } | |
1558 | } | |
1559 | %pythoncode { | |
d07d2bc9 RD |
1560 | asTuple = wx._deprecated(Get, "asTuple is deprecated, use `Get` instead") |
1561 | def __str__(self): return str(self.Get()) | |
1562 | def __repr__(self): return 'wxGridCellCoords'+str(self.Get()) | |
1563 | def __len__(self): return len(self.Get()) | |
22faec7d RD |
1564 | def __getitem__(self, index): return self.asTuple()[index] |
1565 | def __setitem__(self, index, val): | |
1566 | if index == 0: self.SetRow(val) | |
1567 | elif index == 1: self.SetCol(val) | |
1568 | else: raise IndexError | |
1569 | } | |
1570 | ||
1571 | }; | |
1572 | ||
1573 | ||
f6bcfd97 BP |
1574 | //--------------------------------------------------------------------------- |
1575 | //--------------------------------------------------------------------------- | |
1576 | // The grid itself | |
1577 | ||
1578 | ||
1579 | // Fool SWIG into treating this enum as an int | |
1580 | typedef int WXGRIDSELECTIONMODES; | |
1581 | ||
1582 | // but let the C++ code know what it really is. | |
1583 | %{ | |
1584 | typedef wxGrid::wxGridSelectionModes WXGRIDSELECTIONMODES; | |
1585 | %} | |
1586 | ||
1587 | ||
1588 | ||
ab1f7d2a RD |
1589 | MustHaveApp(wxGrid); |
1590 | ||
f6bcfd97 BP |
1591 | class wxGrid : public wxScrolledWindow |
1592 | { | |
1593 | public: | |
2b9048c5 | 1594 | %pythonAppend wxGrid "self._setOORInfo(self)" |
b39c3fa0 | 1595 | %typemap(out) wxGrid*; // turn off this typemap |
d14a1e28 | 1596 | |
f6bcfd97 | 1597 | wxGrid( wxWindow *parent, |
d5573410 | 1598 | wxWindowID id=-1, |
f6bcfd97 BP |
1599 | const wxPoint& pos = wxDefaultPosition, |
1600 | const wxSize& size = wxDefaultSize, | |
1601 | long style = wxWANTS_CHARS, | |
137b5242 | 1602 | const wxString& name = wxPyPanelNameStr); |
f6bcfd97 | 1603 | |
ae662096 | 1604 | %name(PreGrid) wxGrid(); |
8826712e | 1605 | |
b39c3fa0 RD |
1606 | |
1607 | // Turn it back on again | |
1608 | %typemap(out) wxGrid* { $result = wxPyMake_wxObject($1, $owner); } | |
1609 | ||
8826712e | 1610 | |
ae662096 | 1611 | bool Create( wxWindow *parent, |
d5573410 | 1612 | wxWindowID id=-1, |
ae662096 RD |
1613 | const wxPoint& pos = wxDefaultPosition, |
1614 | const wxSize& size = wxDefaultSize, | |
1615 | long style = wxWANTS_CHARS, | |
1616 | const wxString& name = wxPyPanelNameStr ); | |
f6bcfd97 | 1617 | |
8826712e | 1618 | |
ef6c08e5 RD |
1619 | enum wxGridSelectionModes { |
1620 | wxGridSelectCells, | |
1621 | wxGridSelectRows, | |
1622 | wxGridSelectColumns | |
1623 | }; | |
1624 | %pythoncode { | |
1625 | SelectCells = wxGridSelectCells | |
1626 | SelectRows = wxGridSelectRows | |
601c78c6 | 1627 | SelectColumns = wxGridSelectColumns |
ef6c08e5 | 1628 | } |
f6bcfd97 BP |
1629 | |
1630 | bool CreateGrid( int numRows, int numCols, | |
1631 | WXGRIDSELECTIONMODES selmode = wxGrid::wxGridSelectCells ); | |
1632 | void SetSelectionMode(WXGRIDSELECTIONMODES selmode); | |
1e6796a0 | 1633 | WXGRIDSELECTIONMODES GetSelectionMode(); |
f6bcfd97 BP |
1634 | |
1635 | ||
1636 | // ------ grid dimensions | |
1637 | // | |
1638 | int GetNumberRows(); | |
1639 | int GetNumberCols(); | |
1640 | ||
1641 | ||
f6bcfd97 BP |
1642 | bool ProcessTableMessage( wxGridTableMessage& ); |
1643 | ||
1644 | ||
1645 | wxGridTableBase * GetTable() const; | |
dd9f7fea | 1646 | bool SetTable( wxGridTableBase *table, bool takeOwnership=False, |
f6bcfd97 BP |
1647 | WXGRIDSELECTIONMODES selmode = |
1648 | wxGrid::wxGridSelectCells ); | |
1649 | ||
1650 | void ClearGrid(); | |
dd9f7fea RD |
1651 | bool InsertRows( int pos = 0, int numRows = 1, bool updateLabels=True ); |
1652 | bool AppendRows( int numRows = 1, bool updateLabels=True ); | |
1653 | bool DeleteRows( int pos = 0, int numRows = 1, bool updateLabels=True ); | |
1654 | bool InsertCols( int pos = 0, int numCols = 1, bool updateLabels=True ); | |
1655 | bool AppendCols( int numCols = 1, bool updateLabels=True ); | |
1656 | bool DeleteCols( int pos = 0, int numCols = 1, bool updateLabels=True ); | |
f6bcfd97 | 1657 | |
f6bcfd97 BP |
1658 | |
1659 | // this function is called when the current cell highlight must be redrawn | |
1660 | // and may be overridden by the user | |
1661 | virtual void DrawCellHighlight( wxDC& dc, const wxGridCellAttr *attr ); | |
1662 | ||
f6bcfd97 BP |
1663 | |
1664 | // ------ Cell text drawing functions | |
1665 | // | |
1666 | void DrawTextRectangle( wxDC& dc, const wxString&, const wxRect&, | |
1667 | int horizontalAlignment = wxLEFT, | |
1e4a197e RD |
1668 | int verticalAlignment = wxTOP, |
1669 | int textOrientation = wxHORIZONTAL ); | |
f6bcfd97 | 1670 | |
b37c7e1d RD |
1671 | // // Split a string containing newline chararcters into an array of |
1672 | // // strings and return the number of lines | |
1673 | // // | |
1674 | // void StringToLines( const wxString& value, wxArrayString& lines ); | |
f6bcfd97 | 1675 | |
322913ce RD |
1676 | DocDeclA( |
1677 | void, GetTextBoxSize( wxDC& dc, wxArrayString& lines, | |
1678 | long *OUTPUT, long *OUTPUT ), | |
1679 | "GetTextBoxSize(DC dc, list lines) -> (width, height)"); | |
f6bcfd97 BP |
1680 | |
1681 | ||
1682 | // ------ | |
1683 | // Code that does a lot of grid modification can be enclosed | |
1684 | // between BeginBatch() and EndBatch() calls to avoid screen | |
1685 | // flicker | |
1686 | // | |
1687 | void BeginBatch(); | |
1688 | void EndBatch(); | |
1689 | int GetBatchCount(); | |
edf2f43e | 1690 | void ForceRefresh(); |
f6bcfd97 BP |
1691 | |
1692 | ||
1693 | // ------ edit control functions | |
1694 | // | |
fd512ba2 | 1695 | bool IsEditable(); |
f6bcfd97 BP |
1696 | void EnableEditing( bool edit ); |
1697 | ||
dd9f7fea | 1698 | void EnableCellEditControl( bool enable = True ); |
f6bcfd97 BP |
1699 | void DisableCellEditControl(); |
1700 | bool CanEnableCellControl() const; | |
1701 | bool IsCellEditControlEnabled() const; | |
1702 | bool IsCellEditControlShown() const; | |
1703 | ||
1704 | bool IsCurrentCellReadOnly() const; | |
1705 | ||
1706 | void ShowCellEditControl(); | |
1707 | void HideCellEditControl(); | |
1708 | void SaveEditControlValue(); | |
1709 | ||
1710 | ||
1711 | // ------ grid location functions | |
1712 | // Note that all of these functions work with the logical coordinates of | |
1713 | // grid cells and labels so you will need to convert from device | |
1714 | // coordinates for mouse events etc. | |
1715 | // | |
1716 | ||
1717 | //void XYToCell( int x, int y, wxGridCellCoords& ); | |
d14a1e28 RD |
1718 | %extend { |
1719 | wxGridCellCoords XYToCell(int x, int y) { | |
f6bcfd97 BP |
1720 | wxGridCellCoords rv; |
1721 | self->XYToCell(x, y, rv); | |
d14a1e28 | 1722 | return rv; |
f6bcfd97 BP |
1723 | } |
1724 | } | |
1725 | ||
1726 | int YToRow( int y ); | |
1727 | int XToCol( int x ); | |
1728 | ||
1729 | int YToEdgeOfRow( int y ); | |
1730 | int XToEdgeOfCol( int x ); | |
1731 | ||
1732 | wxRect CellToRect( int row, int col ); | |
1733 | // TODO: ??? wxRect CellToRect( const wxGridCellCoords& coords ); | |
1734 | ||
1735 | ||
1736 | int GetGridCursorRow(); | |
1737 | int GetGridCursorCol(); | |
1738 | ||
1739 | // check to see if a cell is either wholly visible (the default arg) or | |
1740 | // at least partially visible in the grid window | |
1741 | // | |
dd9f7fea RD |
1742 | bool IsVisible( int row, int col, bool wholeCellVisible = True ); |
1743 | // TODO: ??? bool IsVisible( const wxGridCellCoords& coords, bool wholeCellVisible = True ); | |
f6bcfd97 BP |
1744 | void MakeCellVisible( int row, int col ); |
1745 | // TODO: ??? void MakeCellVisible( const wxGridCellCoords& coords ); | |
1746 | ||
1747 | ||
1748 | // ------ grid cursor movement functions | |
1749 | // | |
1750 | void SetGridCursor( int row, int col ); | |
1751 | bool MoveCursorUp( bool expandSelection ); | |
1752 | bool MoveCursorDown( bool expandSelection ); | |
1753 | bool MoveCursorLeft( bool expandSelection ); | |
1754 | bool MoveCursorRight( bool expandSelection ); | |
1755 | bool MovePageDown(); | |
1756 | bool MovePageUp(); | |
1757 | bool MoveCursorUpBlock( bool expandSelection ); | |
1758 | bool MoveCursorDownBlock( bool expandSelection ); | |
1759 | bool MoveCursorLeftBlock( bool expandSelection ); | |
1760 | bool MoveCursorRightBlock( bool expandSelection ); | |
1761 | ||
1762 | ||
1763 | // ------ label and gridline formatting | |
1764 | // | |
1765 | int GetDefaultRowLabelSize(); | |
1766 | int GetRowLabelSize(); | |
1767 | int GetDefaultColLabelSize(); | |
1768 | int GetColLabelSize(); | |
1769 | wxColour GetLabelBackgroundColour(); | |
1770 | wxColour GetLabelTextColour(); | |
1771 | wxFont GetLabelFont(); | |
322913ce RD |
1772 | |
1773 | DocDeclA( | |
1774 | void, GetRowLabelAlignment( int *OUTPUT, int *OUTPUT ), | |
1775 | "GetRowLabelAlignment() -> (horiz, vert)"); | |
8826712e | 1776 | |
322913ce RD |
1777 | DocDeclA( |
1778 | void, GetColLabelAlignment( int *OUTPUT, int *OUTPUT ), | |
1779 | "GetColLabelAlignment() -> (horiz, vert)"); | |
1780 | ||
1e4a197e | 1781 | int GetColLabelTextOrientation(); |
f6bcfd97 BP |
1782 | wxString GetRowLabelValue( int row ); |
1783 | wxString GetColLabelValue( int col ); | |
1784 | wxColour GetGridLineColour(); | |
1785 | wxColour GetCellHighlightColour(); | |
9416aa89 RD |
1786 | int GetCellHighlightPenWidth(); |
1787 | int GetCellHighlightROPenWidth(); | |
f6bcfd97 BP |
1788 | |
1789 | void SetRowLabelSize( int width ); | |
1790 | void SetColLabelSize( int height ); | |
1791 | void SetLabelBackgroundColour( const wxColour& ); | |
1792 | void SetLabelTextColour( const wxColour& ); | |
1793 | void SetLabelFont( const wxFont& ); | |
1794 | void SetRowLabelAlignment( int horiz, int vert ); | |
1795 | void SetColLabelAlignment( int horiz, int vert ); | |
1e4a197e | 1796 | void SetColLabelTextOrientation( int textOrientation ); |
f6bcfd97 BP |
1797 | void SetRowLabelValue( int row, const wxString& ); |
1798 | void SetColLabelValue( int col, const wxString& ); | |
1799 | void SetGridLineColour( const wxColour& ); | |
1800 | void SetCellHighlightColour( const wxColour& ); | |
9416aa89 RD |
1801 | void SetCellHighlightPenWidth(int width); |
1802 | void SetCellHighlightROPenWidth(int width); | |
f6bcfd97 | 1803 | |
dd9f7fea | 1804 | void EnableDragRowSize( bool enable = True ); |
f6bcfd97 BP |
1805 | void DisableDragRowSize(); |
1806 | bool CanDragRowSize(); | |
dd9f7fea | 1807 | void EnableDragColSize( bool enable = True ); |
f6bcfd97 BP |
1808 | void DisableDragColSize(); |
1809 | bool CanDragColSize(); | |
dd9f7fea | 1810 | void EnableDragGridSize(bool enable = True); |
f6bcfd97 BP |
1811 | void DisableDragGridSize(); |
1812 | bool CanDragGridSize(); | |
1813 | ||
79dbea21 RD |
1814 | void EnableDragCell( bool enable = True ); |
1815 | void DisableDragCell(); | |
1816 | bool CanDragCell(); | |
1817 | ||
f6bcfd97 | 1818 | // this sets the specified attribute for all cells in this row/col |
fd512ba2 | 1819 | void SetAttr(int row, int col, wxGridCellAttr *attr); |
f6bcfd97 BP |
1820 | void SetRowAttr(int row, wxGridCellAttr *attr); |
1821 | void SetColAttr(int col, wxGridCellAttr *attr); | |
1822 | ||
1823 | // shortcuts for setting the column parameters | |
1824 | ||
1825 | // set the format for the data in the column: default is string | |
1826 | void SetColFormatBool(int col); | |
1827 | void SetColFormatNumber(int col); | |
1828 | void SetColFormatFloat(int col, int width = -1, int precision = -1); | |
1829 | void SetColFormatCustom(int col, const wxString& typeName); | |
1830 | ||
dd9f7fea | 1831 | void EnableGridLines( bool enable = True ); |
f6bcfd97 BP |
1832 | bool GridLinesEnabled(); |
1833 | ||
1834 | // ------ row and col formatting | |
1835 | // | |
1836 | int GetDefaultRowSize(); | |
1837 | int GetRowSize( int row ); | |
1838 | int GetDefaultColSize(); | |
1839 | int GetColSize( int col ); | |
1840 | wxColour GetDefaultCellBackgroundColour(); | |
1841 | wxColour GetCellBackgroundColour( int row, int col ); | |
1842 | wxColour GetDefaultCellTextColour(); | |
1843 | wxColour GetCellTextColour( int row, int col ); | |
1844 | wxFont GetDefaultCellFont(); | |
1845 | wxFont GetCellFont( int row, int col ); | |
322913ce RD |
1846 | |
1847 | DocDeclA( | |
1848 | void, GetDefaultCellAlignment( int *OUTPUT, int *OUTPUT ), | |
1849 | "GetDefaultCellAlignment() -> (horiz, vert)"); | |
8826712e | 1850 | |
322913ce RD |
1851 | DocDeclA( |
1852 | void, GetCellAlignment( int row, int col, int *OUTPUT, int *OUTPUT ), | |
1853 | "GetCellAlignment() -> (horiz, vert)"); | |
1854 | ||
fd512ba2 RD |
1855 | bool GetDefaultCellOverflow(); |
1856 | bool GetCellOverflow( int row, int col ); | |
322913ce RD |
1857 | |
1858 | DocDeclA( | |
1859 | void, GetCellSize( int row, int col, int *OUTPUT, int *OUTPUT ), | |
1860 | "GetCellSize(int row, int col) -> (num_rows, num_cols)"); | |
f6bcfd97 | 1861 | |
dd9f7fea | 1862 | void SetDefaultRowSize( int height, bool resizeExistingRows = False ); |
f6bcfd97 | 1863 | void SetRowSize( int row, int height ); |
dd9f7fea | 1864 | void SetDefaultColSize( int width, bool resizeExistingCols = False ); |
f6bcfd97 BP |
1865 | |
1866 | void SetColSize( int col, int width ); | |
1867 | ||
1868 | // automatically size the column or row to fit to its contents, if | |
dd9f7fea | 1869 | // setAsMin is True, this optimal width will also be set as minimal width |
f6bcfd97 | 1870 | // for this column |
dd9f7fea RD |
1871 | void AutoSizeColumn( int col, bool setAsMin = True ); |
1872 | void AutoSizeRow( int row, bool setAsMin = True ); | |
f6bcfd97 BP |
1873 | |
1874 | ||
1875 | // auto size all columns (very ineffective for big grids!) | |
dd9f7fea RD |
1876 | void AutoSizeColumns( bool setAsMin = True ); |
1877 | void AutoSizeRows( bool setAsMin = True ); | |
f6bcfd97 BP |
1878 | |
1879 | // auto size the grid, that is make the columns/rows of the "right" size | |
1880 | // and also set the grid size to just fit its contents | |
1881 | void AutoSize(); | |
1882 | ||
1e4a197e RD |
1883 | // autosize row height depending on label text |
1884 | void AutoSizeRowLabelSize( int row ); | |
1885 | ||
1886 | // autosize column width depending on label text | |
1887 | void AutoSizeColLabelSize( int col ); | |
1888 | ||
1889 | ||
f6bcfd97 BP |
1890 | // column won't be resized to be lesser width - this must be called during |
1891 | // the grid creation because it won't resize the column if it's already | |
1892 | // narrower than the minimal width | |
1893 | void SetColMinimalWidth( int col, int width ); | |
1894 | void SetRowMinimalHeight( int row, int width ); | |
1895 | ||
1fded56b RD |
1896 | void SetColMinimalAcceptableWidth( int width ); |
1897 | void SetRowMinimalAcceptableHeight( int width ); | |
1898 | int GetColMinimalAcceptableWidth() const; | |
1899 | int GetRowMinimalAcceptableHeight() const; | |
1900 | ||
f6bcfd97 BP |
1901 | void SetDefaultCellBackgroundColour( const wxColour& ); |
1902 | void SetCellBackgroundColour( int row, int col, const wxColour& ); | |
1903 | void SetDefaultCellTextColour( const wxColour& ); | |
1904 | ||
1905 | void SetCellTextColour( int row, int col, const wxColour& ); | |
1906 | void SetDefaultCellFont( const wxFont& ); | |
1907 | void SetCellFont( int row, int col, const wxFont& ); | |
1908 | void SetDefaultCellAlignment( int horiz, int vert ); | |
1909 | void SetCellAlignment( int row, int col, int horiz, int vert ); | |
fd512ba2 RD |
1910 | void SetDefaultCellOverflow( bool allow ); |
1911 | void SetCellOverflow( int row, int col, bool allow ); | |
1912 | void SetCellSize( int row, int col, int num_rows, int num_cols ); | |
f6bcfd97 BP |
1913 | |
1914 | // takes ownership of the pointer | |
1915 | void SetDefaultRenderer(wxGridCellRenderer *renderer); | |
1916 | void SetCellRenderer(int row, int col, wxGridCellRenderer *renderer); | |
1917 | wxGridCellRenderer *GetDefaultRenderer() const; | |
1918 | wxGridCellRenderer* GetCellRenderer(int row, int col); | |
1919 | ||
1920 | // takes ownership of the pointer | |
1921 | void SetDefaultEditor(wxGridCellEditor *editor); | |
1922 | void SetCellEditor(int row, int col, wxGridCellEditor *editor); | |
1923 | wxGridCellEditor *GetDefaultEditor() const; | |
1924 | wxGridCellEditor* GetCellEditor(int row, int col); | |
1925 | ||
1926 | ||
1927 | ||
1928 | // ------ cell value accessors | |
1929 | // | |
1930 | wxString GetCellValue( int row, int col ); | |
1931 | // TODO: ??? wxString GetCellValue( const wxGridCellCoords& coords ) | |
1932 | ||
1933 | void SetCellValue( int row, int col, const wxString& s ); | |
1934 | // TODO: ??? void SetCellValue( const wxGridCellCoords& coords, const wxString& s ) | |
1935 | ||
dd9f7fea | 1936 | // returns True if the cell can't be edited |
f6bcfd97 BP |
1937 | bool IsReadOnly(int row, int col) const; |
1938 | ||
1939 | // make the cell editable/readonly | |
dd9f7fea | 1940 | void SetReadOnly(int row, int col, bool isReadOnly = True); |
f6bcfd97 BP |
1941 | |
1942 | // ------ selections of blocks of cells | |
1943 | // | |
dd9f7fea RD |
1944 | void SelectRow( int row, bool addToSelected = False ); |
1945 | void SelectCol( int col, bool addToSelected = False ); | |
f6bcfd97 | 1946 | |
c368d904 | 1947 | void SelectBlock( int topRow, int leftCol, int bottomRow, int rightCol, |
dd9f7fea | 1948 | bool addToSelected = False ); |
f6bcfd97 BP |
1949 | // TODO: ??? void SelectBlock( const wxGridCellCoords& topLeft, |
1950 | // TODO: ??? const wxGridCellCoords& bottomRight ) | |
1951 | ||
1952 | void SelectAll(); | |
1953 | bool IsSelection(); | |
1954 | void ClearSelection(); | |
1955 | bool IsInSelection( int row, int col ); | |
1956 | // TODO: ??? bool IsInSelection( const wxGridCellCoords& coords ) | |
1957 | ||
1e4a197e RD |
1958 | const wxGridCellCoordsArray GetSelectedCells() const; |
1959 | const wxGridCellCoordsArray GetSelectionBlockTopLeft() const; | |
1960 | const wxGridCellCoordsArray GetSelectionBlockBottomRight() const; | |
1961 | const wxArrayInt GetSelectedRows() const; | |
1962 | const wxArrayInt GetSelectedCols() const; | |
1963 | ||
1964 | void DeselectRow( int row ); | |
1965 | void DeselectCol( int col ); | |
1966 | void DeselectCell( int row, int col ); | |
1e6796a0 | 1967 | |
f6bcfd97 BP |
1968 | |
1969 | // This function returns the rectangle that encloses the block of cells | |
1970 | // limited by TopLeft and BottomRight cell in device coords and clipped | |
1971 | // to the client size of the grid window. | |
1972 | // | |
1973 | wxRect BlockToDeviceRect( const wxGridCellCoords & topLeft, | |
1974 | const wxGridCellCoords & bottomRight ); | |
1975 | ||
1976 | ||
1977 | // Access or update the selection fore/back colours | |
1978 | wxColour GetSelectionBackground() const; | |
1979 | wxColour GetSelectionForeground() const; | |
1980 | ||
1981 | void SetSelectionBackground(const wxColour& c); | |
1982 | void SetSelectionForeground(const wxColour& c); | |
1983 | ||
1984 | ||
1985 | // Methods for a registry for mapping data types to Renderers/Editors | |
1986 | void RegisterDataType(const wxString& typeName, | |
1987 | wxGridCellRenderer* renderer, | |
1988 | wxGridCellEditor* editor); | |
1989 | wxGridCellEditor* GetDefaultEditorForCell(int row, int col) const; | |
1990 | // TODO: ??? wxGridCellEditor* GetDefaultEditorForCell(const wxGridCellCoords& c) const | |
1991 | wxGridCellRenderer* GetDefaultRendererForCell(int row, int col) const; | |
1992 | wxGridCellEditor* GetDefaultEditorForType(const wxString& typeName) const; | |
1993 | wxGridCellRenderer* GetDefaultRendererForType(const wxString& typeName) const; | |
1994 | ||
1995 | // grid may occupy more space than needed for its rows/columns, this | |
1996 | // function allows to set how big this extra space is | |
1997 | void SetMargins(int extraWidth, int extraHeight); | |
9416aa89 RD |
1998 | |
1999 | ||
2000 | // Accessors for component windows | |
2001 | wxWindow* GetGridWindow(); | |
2002 | wxWindow* GetGridRowLabelWindow(); | |
2003 | wxWindow* GetGridColLabelWindow(); | |
2004 | wxWindow* GetGridCornerLabelWindow(); | |
2005 | ||
2006 | ||
880715c9 RD |
2007 | static wxVisualAttributes |
2008 | GetClassDefaultAttributes(wxWindowVariant variant = wxWINDOW_VARIANT_NORMAL); | |
f6bcfd97 BP |
2009 | }; |
2010 | ||
2011 | ||
2012 | //--------------------------------------------------------------------------- | |
2013 | //--------------------------------------------------------------------------- | |
2014 | // Grid events and stuff | |
2015 | ||
2016 | ||
2017 | ||
2018 | class wxGridEvent : public wxNotifyEvent | |
2019 | { | |
2020 | public: | |
2021 | wxGridEvent(int id, wxEventType type, wxGrid* obj, | |
dd9f7fea RD |
2022 | int row=-1, int col=-1, int x=-1, int y=-1, bool sel = True, |
2023 | bool control=False, bool shift=False, bool alt=False, bool meta=False); | |
f6bcfd97 BP |
2024 | |
2025 | virtual int GetRow(); | |
2026 | virtual int GetCol(); | |
2027 | wxPoint GetPosition(); | |
2028 | bool Selecting(); | |
2029 | bool ControlDown(); | |
2030 | bool MetaDown(); | |
2031 | bool ShiftDown(); | |
2032 | bool AltDown(); | |
2033 | ||
2034 | }; | |
2035 | ||
2036 | ||
2037 | class wxGridSizeEvent : public wxNotifyEvent | |
2038 | { | |
2039 | public: | |
2040 | wxGridSizeEvent(int id, wxEventType type, wxGrid* obj, | |
2041 | int rowOrCol=-1, int x=-1, int y=-1, | |
dd9f7fea | 2042 | bool control=False, bool shift=False, bool alt=False, bool meta=False); |
f6bcfd97 BP |
2043 | |
2044 | int GetRowOrCol(); | |
2045 | wxPoint GetPosition(); | |
2046 | bool ControlDown(); | |
2047 | bool MetaDown(); | |
2048 | bool ShiftDown(); | |
2049 | bool AltDown(); | |
2050 | ||
2051 | }; | |
2052 | ||
2053 | ||
2054 | class wxGridRangeSelectEvent : public wxNotifyEvent | |
2055 | { | |
2056 | public: | |
2057 | wxGridRangeSelectEvent(int id, wxEventType type, wxGrid* obj, | |
2058 | const wxGridCellCoords& topLeft, | |
2059 | const wxGridCellCoords& bottomRight, | |
dd9f7fea RD |
2060 | bool sel = True, |
2061 | bool control=False, bool shift=False, | |
2062 | bool alt=False, bool meta=False); | |
f6bcfd97 BP |
2063 | |
2064 | wxGridCellCoords GetTopLeftCoords(); | |
2065 | wxGridCellCoords GetBottomRightCoords(); | |
2066 | int GetTopRow(); | |
2067 | int GetBottomRow(); | |
2068 | int GetLeftCol(); | |
2069 | int GetRightCol(); | |
2070 | bool Selecting(); | |
2071 | bool ControlDown(); | |
2072 | bool MetaDown(); | |
2073 | bool ShiftDown(); | |
2074 | bool AltDown(); | |
2075 | }; | |
2076 | ||
bf7945ce RD |
2077 | |
2078 | class wxGridEditorCreatedEvent : public wxCommandEvent { | |
2079 | public: | |
2080 | wxGridEditorCreatedEvent(int id, wxEventType type, wxObject* obj, | |
2081 | int row, int col, wxControl* ctrl); | |
2082 | ||
2083 | int GetRow(); | |
2084 | int GetCol(); | |
2085 | wxControl* GetControl(); | |
2086 | void SetRow(int row); | |
2087 | void SetCol(int col); | |
2088 | void SetControl(wxControl* ctrl); | |
2089 | }; | |
2090 | ||
2091 | ||
2092 | ||
d14a1e28 RD |
2093 | %constant wxEventType wxEVT_GRID_CELL_LEFT_CLICK; |
2094 | %constant wxEventType wxEVT_GRID_CELL_RIGHT_CLICK; | |
2095 | %constant wxEventType wxEVT_GRID_CELL_LEFT_DCLICK; | |
2096 | %constant wxEventType wxEVT_GRID_CELL_RIGHT_DCLICK; | |
2097 | %constant wxEventType wxEVT_GRID_LABEL_LEFT_CLICK; | |
2098 | %constant wxEventType wxEVT_GRID_LABEL_RIGHT_CLICK; | |
2099 | %constant wxEventType wxEVT_GRID_LABEL_LEFT_DCLICK; | |
2100 | %constant wxEventType wxEVT_GRID_LABEL_RIGHT_DCLICK; | |
2101 | %constant wxEventType wxEVT_GRID_ROW_SIZE; | |
2102 | %constant wxEventType wxEVT_GRID_COL_SIZE; | |
2103 | %constant wxEventType wxEVT_GRID_RANGE_SELECT; | |
2104 | %constant wxEventType wxEVT_GRID_CELL_CHANGE; | |
2105 | %constant wxEventType wxEVT_GRID_SELECT_CELL; | |
2106 | %constant wxEventType wxEVT_GRID_EDITOR_SHOWN; | |
2107 | %constant wxEventType wxEVT_GRID_EDITOR_HIDDEN; | |
2108 | %constant wxEventType wxEVT_GRID_EDITOR_CREATED; | |
79dbea21 | 2109 | %constant wxEventType wxEVT_GRID_CELL_BEGIN_DRAG; |
d14a1e28 RD |
2110 | |
2111 | ||
2112 | ||
2113 | %pythoncode { | |
2114 | EVT_GRID_CELL_LEFT_CLICK = wx.PyEventBinder( wxEVT_GRID_CELL_LEFT_CLICK ) | |
2115 | EVT_GRID_CELL_RIGHT_CLICK = wx.PyEventBinder( wxEVT_GRID_CELL_RIGHT_CLICK ) | |
2116 | EVT_GRID_CELL_LEFT_DCLICK = wx.PyEventBinder( wxEVT_GRID_CELL_LEFT_DCLICK ) | |
2117 | EVT_GRID_CELL_RIGHT_DCLICK = wx.PyEventBinder( wxEVT_GRID_CELL_RIGHT_DCLICK ) | |
2118 | EVT_GRID_LABEL_LEFT_CLICK = wx.PyEventBinder( wxEVT_GRID_LABEL_LEFT_CLICK ) | |
2119 | EVT_GRID_LABEL_RIGHT_CLICK = wx.PyEventBinder( wxEVT_GRID_LABEL_RIGHT_CLICK ) | |
2120 | EVT_GRID_LABEL_LEFT_DCLICK = wx.PyEventBinder( wxEVT_GRID_LABEL_LEFT_DCLICK ) | |
2121 | EVT_GRID_LABEL_RIGHT_DCLICK = wx.PyEventBinder( wxEVT_GRID_LABEL_RIGHT_DCLICK ) | |
2122 | EVT_GRID_ROW_SIZE = wx.PyEventBinder( wxEVT_GRID_ROW_SIZE ) | |
2123 | EVT_GRID_COL_SIZE = wx.PyEventBinder( wxEVT_GRID_COL_SIZE ) | |
2124 | EVT_GRID_RANGE_SELECT = wx.PyEventBinder( wxEVT_GRID_RANGE_SELECT ) | |
2125 | EVT_GRID_CELL_CHANGE = wx.PyEventBinder( wxEVT_GRID_CELL_CHANGE ) | |
2126 | EVT_GRID_SELECT_CELL = wx.PyEventBinder( wxEVT_GRID_SELECT_CELL ) | |
2127 | EVT_GRID_EDITOR_SHOWN = wx.PyEventBinder( wxEVT_GRID_EDITOR_SHOWN ) | |
2128 | EVT_GRID_EDITOR_HIDDEN = wx.PyEventBinder( wxEVT_GRID_EDITOR_HIDDEN ) | |
2129 | EVT_GRID_EDITOR_CREATED = wx.PyEventBinder( wxEVT_GRID_EDITOR_CREATED ) | |
79dbea21 | 2130 | EVT_GRID_CELL_BEGIN_DRAG = wx.PyEventBinder( wxEVT_GRID_CELL_BEGIN_DRAG ) |
b00f16c8 RD |
2131 | |
2132 | ||
2133 | %# The same as above but with the ability to specify an identifier | |
2134 | EVT_GRID_CMD_CELL_LEFT_CLICK = wx.PyEventBinder( wxEVT_GRID_CELL_LEFT_CLICK, 1 ) | |
2135 | EVT_GRID_CMD_CELL_RIGHT_CLICK = wx.PyEventBinder( wxEVT_GRID_CELL_RIGHT_CLICK, 1 ) | |
2136 | EVT_GRID_CMD_CELL_LEFT_DCLICK = wx.PyEventBinder( wxEVT_GRID_CELL_LEFT_DCLICK, 1 ) | |
2137 | EVT_GRID_CMD_CELL_RIGHT_DCLICK = wx.PyEventBinder( wxEVT_GRID_CELL_RIGHT_DCLICK, 1 ) | |
2138 | EVT_GRID_CMD_LABEL_LEFT_CLICK = wx.PyEventBinder( wxEVT_GRID_LABEL_LEFT_CLICK, 1 ) | |
2139 | EVT_GRID_CMD_LABEL_RIGHT_CLICK = wx.PyEventBinder( wxEVT_GRID_LABEL_RIGHT_CLICK, 1 ) | |
2140 | EVT_GRID_CMD_LABEL_LEFT_DCLICK = wx.PyEventBinder( wxEVT_GRID_LABEL_LEFT_DCLICK, 1 ) | |
2141 | EVT_GRID_CMD_LABEL_RIGHT_DCLICK = wx.PyEventBinder( wxEVT_GRID_LABEL_RIGHT_DCLICK, 1 ) | |
2142 | EVT_GRID_CMD_ROW_SIZE = wx.PyEventBinder( wxEVT_GRID_ROW_SIZE, 1 ) | |
2143 | EVT_GRID_CMD_COL_SIZE = wx.PyEventBinder( wxEVT_GRID_COL_SIZE, 1 ) | |
2144 | EVT_GRID_CMD_RANGE_SELECT = wx.PyEventBinder( wxEVT_GRID_RANGE_SELECT, 1 ) | |
2145 | EVT_GRID_CMD_CELL_CHANGE = wx.PyEventBinder( wxEVT_GRID_CELL_CHANGE, 1 ) | |
2146 | EVT_GRID_CMD_SELECT_CELL = wx.PyEventBinder( wxEVT_GRID_SELECT_CELL, 1 ) | |
2147 | EVT_GRID_CMD_EDITOR_SHOWN = wx.PyEventBinder( wxEVT_GRID_EDITOR_SHOWN, 1 ) | |
2148 | EVT_GRID_CMD_EDITOR_HIDDEN = wx.PyEventBinder( wxEVT_GRID_EDITOR_HIDDEN, 1 ) | |
2149 | EVT_GRID_CMD_EDITOR_CREATED = wx.PyEventBinder( wxEVT_GRID_EDITOR_CREATED, 1 ) | |
79dbea21 RD |
2150 | EVT_GRID_CMD_CELL_BEGIN_DRAG = wx.PyEventBinder( wxEVT_GRID_CELL_BEGIN_DRAG, 1 ) |
2151 | ||
d14a1e28 | 2152 | } |
f6bcfd97 BP |
2153 | |
2154 | //--------------------------------------------------------------------------- | |
2155 | ||
e508a2b6 | 2156 | %init %{ |
e508a2b6 RD |
2157 | %} |
2158 | ||
2159 | //--------------------------------------------------------------------------- | |
f6bcfd97 BP |
2160 | //--------------------------------------------------------------------------- |
2161 |