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