1 ////////////////////////////////////////////////////////////////////////////
3 // Purpose: SWIG definitions for the new wxGrid and related classes
7 // Created: 17-March-2000
9 // Copyright: (c) 2000 by Total Control Software
10 // Licence: wxWindows license
11 /////////////////////////////////////////////////////////////////////////////
14 "Classes for implementing a spreadsheet-like control."
17 %module(package="wx", docstring=DOCSTRING) grid
21 #include "wx/wxPython/wxPython.h"
22 #include "wx/wxPython/pyclasses.h"
23 #include "wx/wxPython/printfw.h"
26 #include <wx/generic/gridctrl.h>
31 //---------------------------------------------------------------------------
34 %pythoncode { wx = _core }
35 %pythoncode { __docfilter__ = wx.__DocFilter(globals()) }
38 %include _grid_rename.i
40 MAKE_CONST_WXSTRING_NOSWIG(EmptyString);
41 MAKE_CONST_WXSTRING_NOSWIG(PanelNameStr);
42 MAKE_CONST_WXSTRING2(DateTimeFormatStr, wxT("%c"));
45 //---------------------------------------------------------------------------
46 // OOR related typemaps and helper functions
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); }
57 #define wxPyMake_TEMPLATE(TYPE) \
58 PyObject* wxPyMake_##TYPE(TYPE* source, bool setThisOwn) { \
59 PyObject* target = NULL; \
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(); \
65 target = data->m_obj; \
69 /* Otherwise make a new wrapper for it the old fashioned way and \
70 give it the OOR treatment */ \
72 target = wxPyConstructObject(source, wxT(#TYPE), setThisOwn); \
74 source->SetClientObject(new wxPyOORClientData(target)); \
76 } else { /* source was NULL so return None. */ \
77 Py_INCREF(Py_None); target = Py_None; \
83 wxPyMake_TEMPLATE(wxGridCellRenderer)
84 wxPyMake_TEMPLATE(wxGridCellEditor)
85 wxPyMake_TEMPLATE(wxGridCellAttr)
86 wxPyMake_TEMPLATE(wxGridCellAttrProvider)
87 wxPyMake_TEMPLATE(wxGridTableBase)
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
99 #define PYCALLBACK_GCA_INTINTKIND(PCLASS, CBNAME) \
100 wxGridCellAttr* CBNAME(int a, int b, wxGridCellAttr::wxAttrKind c) { \
101 wxGridCellAttr* rval = NULL; \
103 bool blocked = wxPyBeginBlockThreads(); \
104 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
106 wxGridCellAttr* ptr; \
107 ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("(iii)", a, b, c)); \
109 if (wxPyConvertSwigPtr(ro, (void **)&ptr, wxT("wxGridCellAttr"))) \
114 wxPyEndBlockThreads(blocked); \
116 rval = PCLASS::CBNAME(a, b, c); \
119 wxGridCellAttr *base_##CBNAME(int a, int b, wxGridCellAttr::wxAttrKind c) { \
120 return PCLASS::CBNAME(a, b, c); \
125 #define PYCALLBACK__GCAINTINT(PCLASS, CBNAME) \
126 void CBNAME(wxGridCellAttr *attr, int a, int b) { \
127 bool blocked = wxPyBeginBlockThreads(); \
129 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
130 PyObject* obj = wxPyMake_wxGridCellAttr(attr,false); \
131 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(Oii)", obj, a, b)); \
134 wxPyEndBlockThreads(blocked); \
136 PCLASS::CBNAME(attr, a, b); \
138 void base_##CBNAME(wxGridCellAttr *attr, int a, int b) { \
139 PCLASS::CBNAME(attr, a, b); \
144 #define PYCALLBACK__GCAINT(PCLASS, CBNAME) \
145 void CBNAME(wxGridCellAttr *attr, int val) { \
146 bool blocked = wxPyBeginBlockThreads(); \
148 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
149 PyObject* obj = wxPyMake_wxGridCellAttr(attr,false); \
150 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(Oi)", obj, val)); \
153 wxPyEndBlockThreads(blocked); \
155 PCLASS::CBNAME(attr, val); \
157 void base_##CBNAME(wxGridCellAttr *attr, int val) { \
158 PCLASS::CBNAME(attr, val); \
163 #define PYCALLBACK_INT__pure(CBNAME) \
165 bool blocked = wxPyBeginBlockThreads(); \
167 if (wxPyCBH_findCallback(m_myInst, #CBNAME)) \
168 rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("()")); \
169 wxPyEndBlockThreads(blocked); \
175 #define PYCALLBACK_BOOL_INTINT_pure(CBNAME) \
176 bool CBNAME(int a, int b) { \
177 bool blocked = wxPyBeginBlockThreads(); \
179 if (wxPyCBH_findCallback(m_myInst, #CBNAME)) \
180 rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(ii)",a,b)); \
181 wxPyEndBlockThreads(blocked); \
186 #define PYCALLBACK_STRING_INTINT_pure(CBNAME) \
187 wxString CBNAME(int a, int b) { \
188 bool blocked = wxPyBeginBlockThreads(); \
190 if (wxPyCBH_findCallback(m_myInst, #CBNAME)) { \
192 ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("(ii)",a,b)); \
194 rval = Py2wxString(ro); \
198 wxPyEndBlockThreads(blocked); \
203 #define PYCALLBACK__INTINTSTRING_pure(CBNAME) \
204 void CBNAME(int a, int b, const wxString& c) { \
205 bool blocked = wxPyBeginBlockThreads(); \
206 if (wxPyCBH_findCallback(m_myInst, #CBNAME)) { \
207 PyObject* s = wx2PyString(c); \
208 rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(iiO)",a,b,s));\
211 wxPyEndBlockThreads(blocked); \
215 #define PYCALLBACK_STRING_INTINT(PCLASS, CBNAME) \
216 wxString CBNAME(int a, int b) { \
218 bool blocked = wxPyBeginBlockThreads(); \
220 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
222 ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("(ii)",a,b)); \
224 rval = Py2wxString(ro); \
228 wxPyEndBlockThreads(blocked); \
230 rval = PCLASS::CBNAME(a, b); \
233 wxString base_##CBNAME(int a, int b) { \
234 return PCLASS::CBNAME(a, b); \
238 #define PYCALLBACK_BOOL_INTINTSTRING(PCLASS, CBNAME) \
239 bool CBNAME(int a, int b, const wxString& c) { \
242 bool blocked = wxPyBeginBlockThreads(); \
243 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
244 PyObject* s = wx2PyString(c); \
245 rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(iiO)",a,b,s));\
248 wxPyEndBlockThreads(blocked); \
250 rval = PCLASS::CBNAME(a,b,c); \
253 bool base_##CBNAME(int a, int b, const wxString& c) { \
254 return PCLASS::CBNAME(a,b,c); \
260 #define PYCALLBACK_LONG_INTINT(PCLASS, CBNAME) \
261 long CBNAME(int a, int b) { \
264 bool blocked = wxPyBeginBlockThreads(); \
265 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \
266 rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(ii)", a,b)); \
267 wxPyEndBlockThreads(blocked); \
269 rval = PCLASS::CBNAME(a,b); \
272 long base_##CBNAME(int a, int b) { \
273 return PCLASS::CBNAME(a,b); \
278 #define PYCALLBACK_BOOL_INTINT(PCLASS, CBNAME) \
279 bool CBNAME(int a, int b) { \
282 bool blocked = wxPyBeginBlockThreads(); \
283 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \
284 rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(ii)", a,b)); \
285 wxPyEndBlockThreads(blocked); \
287 rval = PCLASS::CBNAME(a,b); \
290 bool base_##CBNAME(int a, int b) { \
291 return PCLASS::CBNAME(a,b); \
296 #define PYCALLBACK_DOUBLE_INTINT(PCLASS, CBNAME) \
297 double CBNAME(int a, int b) { \
299 bool blocked = wxPyBeginBlockThreads(); \
301 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
303 ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("(ii)",a,b)); \
305 PyObject* str = PyObject_Str(ro); \
306 rval = PyFloat_AsDouble(str); \
307 Py_DECREF(ro); Py_DECREF(str); \
310 wxPyEndBlockThreads(blocked); \
312 rval = PCLASS::CBNAME(a, b); \
315 double base_##CBNAME(int a, int b) { \
316 return PCLASS::CBNAME(a, b); \
321 #define PYCALLBACK__(PCLASS, CBNAME) \
324 bool blocked = wxPyBeginBlockThreads(); \
325 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \
326 wxPyCBH_callCallback(m_myInst, Py_BuildValue("()")); \
327 wxPyEndBlockThreads(blocked); \
331 void base_##CBNAME() { \
338 #define PYCALLBACK_BOOL_SIZETSIZET(PCLASS, CBNAME) \
339 bool CBNAME(size_t a, size_t b) { \
342 bool blocked = wxPyBeginBlockThreads(); \
343 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \
344 rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(ii)", a,b)); \
345 wxPyEndBlockThreads(blocked); \
347 rval = PCLASS::CBNAME(a,b); \
350 bool base_##CBNAME(size_t a, size_t b) { \
351 return PCLASS::CBNAME(a,b); \
356 #define PYCALLBACK_BOOL_SIZET(PCLASS, CBNAME) \
357 bool CBNAME(size_t a) { \
360 bool blocked = wxPyBeginBlockThreads(); \
361 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \
362 rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(i)", a)); \
363 wxPyEndBlockThreads(blocked); \
365 rval = PCLASS::CBNAME(a); \
368 bool base_##CBNAME(size_t a) { \
369 return PCLASS::CBNAME(a); \
373 #define PYCALLBACK_STRING_INT(PCLASS, CBNAME) \
374 wxString CBNAME(int a) { \
376 bool blocked = wxPyBeginBlockThreads(); \
378 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
380 ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("(i)",a)); \
382 rval = Py2wxString(ro); \
386 wxPyEndBlockThreads(blocked); \
388 rval = PCLASS::CBNAME(a); \
391 wxString base_##CBNAME(int a) { \
392 return PCLASS::CBNAME(a); \
396 #define PYCALLBACK__INTSTRING(PCLASS, CBNAME) \
397 void CBNAME(int a, const wxString& c) { \
399 bool blocked = wxPyBeginBlockThreads(); \
400 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
401 PyObject* s = wx2PyString(c); \
402 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(iO)",a,s)); \
405 wxPyEndBlockThreads(blocked); \
407 PCLASS::CBNAME(a,c); \
409 void base_##CBNAME(int a, const wxString& c) { \
410 PCLASS::CBNAME(a,c); \
416 #define PYCALLBACK_BOOL_(PCLASS, CBNAME) \
420 bool blocked = wxPyBeginBlockThreads(); \
421 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \
422 rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("()")); \
423 wxPyEndBlockThreads(blocked); \
425 rval = PCLASS::CBNAME(); \
428 bool base_##CBNAME() { \
429 return PCLASS::CBNAME(); \
434 #define PYCALLBACK__SIZETINT(PCLASS, CBNAME) \
435 void CBNAME(size_t a, int b) { \
437 bool blocked = wxPyBeginBlockThreads(); \
438 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \
439 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(ii)", a,b)); \
440 wxPyEndBlockThreads(blocked); \
442 PCLASS::CBNAME(a,b); \
444 void base_##CBNAME(size_t a, int b) { \
445 PCLASS::CBNAME(a,b); \
451 #define PYCALLBACK__INTINTLONG(PCLASS, CBNAME) \
452 void CBNAME(int a, int b, long c) { \
454 bool blocked = wxPyBeginBlockThreads(); \
455 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \
456 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(iii)", a,b,c)); \
457 wxPyEndBlockThreads(blocked); \
459 PCLASS::CBNAME(a,b,c); \
461 void base_##CBNAME(int a, int b, long c) { \
462 PCLASS::CBNAME(a,b,c); \
468 #define PYCALLBACK__INTINTDOUBLE(PCLASS, CBNAME) \
469 void CBNAME(int a, int b, double c) { \
471 bool blocked = wxPyBeginBlockThreads(); \
472 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \
473 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(iif)", a,b,c)); \
474 wxPyEndBlockThreads(blocked); \
476 PCLASS::CBNAME(a,b,c); \
478 void base_##CBNAME(int a, int b, double c) { \
479 PCLASS::CBNAME(a,b,c); \
484 #define PYCALLBACK__INTINTBOOL(PCLASS, CBNAME) \
485 void CBNAME(int a, int b, bool c) { \
487 bool blocked = wxPyBeginBlockThreads(); \
488 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \
489 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(iii)", a,b,c)); \
490 wxPyEndBlockThreads(blocked); \
492 PCLASS::CBNAME(a,b,c); \
494 void base_##CBNAME(int a, int b, bool c) { \
495 PCLASS::CBNAME(a,b,c); \
503 //---------------------------------------------------------------------------
505 class wxGridCellCoords;
506 class wxGridCellAttr;
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"
515 #define wxGRID_VALUE_CHOICEINT "choiceint"
516 #define wxGRID_VALUE_DATETIME "datetime"
520 const wxGridCellCoords wxGridNoCellCoords;
521 const wxRect wxGridNoCellRect;
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
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
552 //---------------------------------------------------------------------------
553 // wxGridCellRenderer is an ABC, and several derived classes are available.
554 // Classes implemented in Python should be derived from wxPyGridCellRenderer.
557 class wxGridCellRenderer
561 void _setOORInfo(PyObject* _self) {
562 if (!self->GetClientObject())
563 self->SetClientObject(new wxPyOORClientData(_self));
567 void SetParameters(const wxString& params);
571 virtual void Draw(wxGrid& grid,
572 wxGridCellAttr& attr,
577 virtual wxSize GetBestSize(wxGrid& grid,
578 wxGridCellAttr& attr,
581 virtual wxGridCellRenderer *Clone() const;
585 // The C++ version of wxPyGridCellRenderer
587 class wxPyGridCellRenderer : public wxGridCellRenderer
590 wxPyGridCellRenderer() : wxGridCellRenderer() {};
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) {
596 bool blocked = wxPyBeginBlockThreads();
597 if (wxPyCBH_findCallback(m_myInst, "Draw")) {
598 PyObject* go = wxPyMake_wxObject(&grid,false);
599 PyObject* dco = wxPyMake_wxObject(&dc,false);
600 PyObject* ao = wxPyMake_wxGridCellAttr(&attr,false);
601 PyObject* ro = wxPyConstructObject((void*)&rect, wxT("wxRect"), 0);
603 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(OOOOiii)", go, ao, dco, ro,
604 row, col, isSelected));
610 wxPyEndBlockThreads(blocked);
613 wxSize GetBestSize(wxGrid& grid, wxGridCellAttr& attr, wxDC& dc,
616 bool blocked = wxPyBeginBlockThreads();
617 if (wxPyCBH_findCallback(m_myInst, "GetBestSize")) {
620 PyObject* go = wxPyMake_wxObject(&grid,false);
621 PyObject* dco = wxPyMake_wxObject(&dc,false);
622 PyObject* ao = wxPyMake_wxGridCellAttr(&attr,false);
624 ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("(OOOii)",
632 const char* errmsg = "GetBestSize should return a 2-tuple of integers or a wxSize object.";
633 if (wxPyConvertSwigPtr(ro, (void **)&ptr, wxT("wxSize"))) {
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));
642 PyErr_SetString(PyExc_TypeError, errmsg);
647 PyErr_SetString(PyExc_TypeError, errmsg);
652 wxPyEndBlockThreads(blocked);
657 wxGridCellRenderer *Clone() const {
658 wxGridCellRenderer* rval = NULL;
659 bool blocked = wxPyBeginBlockThreads();
660 if (wxPyCBH_findCallback(m_myInst, "Clone")) {
662 wxGridCellRenderer* ptr;
663 ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("()"));
665 if (wxPyConvertSwigPtr(ro, (void **)&ptr, wxT("wxGridCellRenderer")))
670 wxPyEndBlockThreads(blocked);
674 DEC_PYCALLBACK__STRING(SetParameters);
679 IMP_PYCALLBACK__STRING( wxPyGridCellRenderer, wxGridCellRenderer, SetParameters);
684 // Let SWIG know about it so it can create the Python version
685 class wxPyGridCellRenderer : public wxGridCellRenderer {
687 %pythonAppend wxPyGridCellRenderer "self._setCallbackInfo(self, PyGridCellRenderer);self._setOORInfo(self)"
689 wxPyGridCellRenderer();
690 void _setCallbackInfo(PyObject* self, PyObject* _class);
692 void base_SetParameters(const wxString& params);
695 //---------------------------------------------------------------------------
696 // Predefined Renderers
698 class wxGridCellStringRenderer : public wxGridCellRenderer
701 %pythonAppend wxGridCellStringRenderer "self._setOORInfo(self)"
702 wxGridCellStringRenderer();
706 class wxGridCellNumberRenderer : public wxGridCellStringRenderer
709 %pythonAppend wxGridCellNumberRenderer "self._setOORInfo(self)"
710 wxGridCellNumberRenderer();
714 class wxGridCellFloatRenderer : public wxGridCellStringRenderer
717 %pythonAppend wxGridCellFloatRenderer "self._setOORInfo(self)"
718 wxGridCellFloatRenderer(int width = -1, int precision = -1);
720 int GetWidth() const;
721 void SetWidth(int width);
722 int GetPrecision() const;
723 void SetPrecision(int precision);
727 class wxGridCellBoolRenderer : public wxGridCellRenderer
730 %pythonAppend wxGridCellBoolRenderer "self._setOORInfo(self)"
731 wxGridCellBoolRenderer();
735 class wxGridCellDateTimeRenderer : public wxGridCellStringRenderer
738 %pythonAppend wxGridCellDateTimeRenderer "self._setOORInfo(self)"
739 wxGridCellDateTimeRenderer(wxString outformat = wxPyDateTimeFormatStr,
740 wxString informat = wxPyDateTimeFormatStr);
744 class wxGridCellEnumRenderer : public wxGridCellStringRenderer
747 %pythonAppend wxGridCellEnumRenderer "self._setOORInfo(self)"
748 wxGridCellEnumRenderer( const wxString& choices = wxPyEmptyString );
752 class wxGridCellAutoWrapStringRenderer : public wxGridCellStringRenderer
755 %pythonAppend wxGridCellAutoWrapStringRenderer "self._setOORInfo(self)"
756 wxGridCellAutoWrapStringRenderer();
760 //---------------------------------------------------------------------------
761 // wxGridCellEditor is an ABC, and several derived classes are available.
762 // Classes implemented in Python should be derived from wxPyGridCellEditor.
764 class wxGridCellEditor
768 void _setOORInfo(PyObject* _self) {
769 if (!self->GetClientObject())
770 self->SetClientObject(new wxPyOORClientData(_self));
775 wxControl* GetControl();
776 void SetControl(wxControl* control);
778 wxGridCellAttr* GetCellAttr();
779 void SetCellAttr(wxGridCellAttr* attr);
781 void SetParameters(const wxString& params);
785 virtual void Create(wxWindow* parent,
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;
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();
805 // The C++ version of wxPyGridCellEditor
807 class wxPyGridCellEditor : public wxGridCellEditor
810 wxPyGridCellEditor() : wxGridCellEditor() {}
812 void Create(wxWindow* parent, wxWindowID id, wxEvtHandler* evtHandler) {
813 bool blocked = wxPyBeginBlockThreads();
814 if (wxPyCBH_findCallback(m_myInst, "Create")) {
815 PyObject* po = wxPyMake_wxObject(parent,false);
816 PyObject* eo = wxPyMake_wxObject(evtHandler,false);
818 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(OiO)", po, id, eo));
822 wxPyEndBlockThreads(blocked);
826 void BeginEdit(int row, int col, wxGrid* grid) {
827 bool blocked = wxPyBeginBlockThreads();
828 if (wxPyCBH_findCallback(m_myInst, "BeginEdit")) {
829 PyObject* go = wxPyMake_wxObject(grid,false);
830 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(iiO)", row, col, go));
833 wxPyEndBlockThreads(blocked);
837 bool EndEdit(int row, int col, wxGrid* grid) {
839 bool blocked = wxPyBeginBlockThreads();
840 if (wxPyCBH_findCallback(m_myInst, "EndEdit")) {
841 PyObject* go = wxPyMake_wxObject(grid,false);
842 rv = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(iiO)", row, col, go));
845 wxPyEndBlockThreads(blocked);
850 wxGridCellEditor* Clone() const {
851 wxGridCellEditor* rval = NULL;
852 bool blocked = wxPyBeginBlockThreads();
853 if (wxPyCBH_findCallback(m_myInst, "Clone")) {
855 wxGridCellEditor* ptr;
856 ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("()"));
858 if (wxPyConvertSwigPtr(ro, (void **)&ptr, wxT("wxGridCellEditor")))
863 wxPyEndBlockThreads(blocked);
868 void Show(bool show, wxGridCellAttr *attr) {
870 bool blocked = wxPyBeginBlockThreads();
871 if ((found = wxPyCBH_findCallback(m_myInst, "Show"))) {
872 PyObject* ao = wxPyMake_wxGridCellAttr(attr,false);
873 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(iO)", show, ao));
876 wxPyEndBlockThreads(blocked);
878 wxGridCellEditor::Show(show, attr);
880 void base_Show(bool show, wxGridCellAttr *attr) {
881 wxGridCellEditor::Show(show, attr);
885 void PaintBackground(const wxRect& rectCell, wxGridCellAttr *attr) {
887 bool blocked = wxPyBeginBlockThreads();
888 if ((found = wxPyCBH_findCallback(m_myInst, "PaintBackground)"))) {
889 PyObject* ao = wxPyMake_wxGridCellAttr(attr,false);
890 PyObject* ro = wxPyConstructObject((void*)&rectCell, wxT("wxRect"), 0);
892 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(OO)", ro, ao));
897 wxPyEndBlockThreads(blocked);
899 wxGridCellEditor::PaintBackground(rectCell, attr);
901 void base_PaintBackground(const wxRect& rectCell, wxGridCellAttr *attr) {
902 wxGridCellEditor::PaintBackground(rectCell, attr);
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);
914 DEC_PYCALLBACK_STRING__constpure(GetValue);
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);
928 IMP_PYCALLBACK_STRING__constpure(wxPyGridCellEditor, wxGridCellEditor, GetValue);
933 // Let SWIG know about it so it can create the Python version
934 class wxPyGridCellEditor : public wxGridCellEditor {
936 %pythonAppend wxPyGridCellEditor "self._setCallbackInfo(self, PyGridCellEditor);self._setOORInfo(self)"
938 wxPyGridCellEditor();
939 void _setCallbackInfo(PyObject* self, PyObject* _class);
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);
944 bool base_IsAcceptedKey(wxKeyEvent& event);
945 void base_StartingKey(wxKeyEvent& event);
946 void base_StartingClick();
947 void base_HandleReturn(wxKeyEvent& event);
949 void base_SetParameters(const wxString& params);
952 //---------------------------------------------------------------------------
953 // Predefined Editors
955 class wxGridCellTextEditor : public wxGridCellEditor
958 %pythonAppend wxGridCellTextEditor "self._setOORInfo(self)"
959 wxGridCellTextEditor();
960 virtual wxString GetValue();
964 class wxGridCellNumberEditor : public wxGridCellTextEditor
967 %pythonAppend wxGridCellNumberEditor "self._setOORInfo(self)"
968 wxGridCellNumberEditor(int min = -1, int max = -1);
969 virtual wxString GetValue();
973 class wxGridCellFloatEditor : public wxGridCellTextEditor
976 %pythonAppend wxGridCellFloatEditor "self._setOORInfo(self)"
977 wxGridCellFloatEditor(int width = -1, int precision = -1);
978 virtual wxString GetValue();
982 class wxGridCellBoolEditor : public wxGridCellEditor
985 %pythonAppend wxGridCellBoolEditor "self._setOORInfo(self)"
986 wxGridCellBoolEditor();
987 virtual wxString GetValue();
990 class wxGridCellChoiceEditor : public wxGridCellEditor
993 %pythonAppend wxGridCellChoiceEditor "self._setOORInfo(self)"
994 wxGridCellChoiceEditor(int choices = 0,
995 const wxString* choices_array = NULL,
996 bool allowOthers = False);
997 virtual wxString GetValue();
1001 class wxGridCellEnumEditor : public wxGridCellChoiceEditor
1004 %pythonAppend wxGridCellEnumEditor "self._setOORInfo(self)"
1005 wxGridCellEnumEditor( const wxString& choices = wxPyEmptyString );
1006 virtual wxString GetValue();
1010 class wxGridCellAutoWrapStringEditor : public wxGridCellTextEditor
1013 %pythonAppend wxGridCellAutoWrapStringEditor "self._setOORInfo(self)"
1014 wxGridCellAutoWrapStringEditor();
1015 virtual wxString GetValue();
1020 //---------------------------------------------------------------------------
1023 class wxGridCellAttr
1037 void _setOORInfo(PyObject* _self) {
1038 if (!self->GetClientObject())
1039 self->SetClientObject(new wxPyOORClientData(_self));
1043 %pythonAppend wxGridCellAttr "self._setOORInfo(self)"
1045 wxGridCellAttr(wxGridCellAttr *attrDefault = NULL);
1047 wxGridCellAttr *Clone() const;
1048 void MergeWith(wxGridCellAttr *mergefrom);
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);
1055 void SetSize(int num_rows, int num_cols);
1056 void SetOverflow( bool allow = True );
1057 void SetReadOnly(bool isReadOnly = True);
1059 void SetRenderer(wxGridCellRenderer *renderer);
1060 void SetEditor(wxGridCellEditor* editor);
1061 void SetKind(wxAttrKind kind);
1063 bool HasTextColour() const;
1064 bool HasBackgroundColour() const;
1065 bool HasFont() const;
1066 bool HasAlignment() const;
1067 bool HasRenderer() const;
1068 bool HasEditor() const;
1069 bool HasReadWriteMode() const;
1070 bool HasOverflowMode() const;
1072 wxColour GetTextColour() const;
1073 wxColour GetBackgroundColour() const;
1074 wxFont GetFont() const;
1077 void, GetAlignment(int *OUTPUT, int *OUTPUT) const,
1078 "GetAlignment() -> (hAlign, vAlign)");
1081 void, GetSize(int *OUTPUT, int *OUTPUT) const,
1082 "GetSize() -> (num_rows, num_cols)");
1084 bool GetOverflow() const;
1085 wxGridCellRenderer *GetRenderer(wxGrid* grid, int row, int col) const;
1086 wxGridCellEditor *GetEditor(wxGrid* grid, int row, int col) const;
1088 bool IsReadOnly() const;
1089 wxAttrKind GetKind();
1090 void SetDefAttr(wxGridCellAttr* defAttr);
1093 //---------------------------------------------------------------------------
1095 class wxGridCellAttrProvider
1098 %pythonAppend wxGridCellAttrProvider "self._setOORInfo(self)"
1099 wxGridCellAttrProvider();
1100 // ???? virtual ~wxGridCellAttrProvider();
1103 void _setOORInfo(PyObject* _self) {
1104 if (!self->GetClientObject())
1105 self->SetClientObject(new wxPyOORClientData(_self));
1109 wxGridCellAttr *GetAttr(int row, int col,
1110 wxGridCellAttr::wxAttrKind kind) const;
1111 void SetAttr(wxGridCellAttr *attr, int row, int col);
1112 void SetRowAttr(wxGridCellAttr *attr, int row);
1113 void SetColAttr(wxGridCellAttr *attr, int col);
1115 void UpdateAttrRows( size_t pos, int numRows );
1116 void UpdateAttrCols( size_t pos, int numCols );
1121 // A Python-aware version
1123 class wxPyGridCellAttrProvider : public wxGridCellAttrProvider
1126 wxPyGridCellAttrProvider() : wxGridCellAttrProvider() {};
1128 PYCALLBACK_GCA_INTINTKIND(wxGridCellAttrProvider, GetAttr);
1129 PYCALLBACK__GCAINTINT(wxGridCellAttrProvider, SetAttr);
1130 PYCALLBACK__GCAINT(wxGridCellAttrProvider, SetRowAttr);
1131 PYCALLBACK__GCAINT(wxGridCellAttrProvider, SetColAttr);
1138 // The python-aware version get's SWIGified
1139 class wxPyGridCellAttrProvider : public wxGridCellAttrProvider
1142 %pythonAppend wxPyGridCellAttrProvider "self._setCallbackInfo(self, PyGridCellAttrProvider)"
1143 wxPyGridCellAttrProvider();
1144 void _setCallbackInfo(PyObject* self, PyObject* _class);
1146 wxGridCellAttr *base_GetAttr(int row, int col,
1147 wxGridCellAttr::wxAttrKind kind);
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);
1154 //---------------------------------------------------------------------------
1155 // Grid Table Base class and Python aware version
1158 class wxGridTableBase : public wxObject
1161 // wxGridTableBase(); This is an ABC
1162 //~wxGridTableBase();
1165 void _setOORInfo(PyObject* _self) {
1166 if (!self->GetClientObject())
1167 self->SetClientObject(new wxPyOORClientData(_self));
1171 void SetAttrProvider(wxGridCellAttrProvider *attrProvider);
1172 wxGridCellAttrProvider *GetAttrProvider() const;
1173 void SetView( wxGrid *grid );
1174 wxGrid * GetView() const;
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 );
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 );
1195 //virtual void* GetValueAsCustom( int row, int col, const wxString& typeName );
1196 //virtual void SetValueAsCustom( int row, int col, const wxString& typeName, void* value );
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 );
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 );
1212 virtual bool CanHaveAttributes();
1214 virtual wxGridCellAttr *GetAttr( int row, int col,
1215 wxGridCellAttr::wxAttrKind kind);
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);
1224 // Python-aware version
1226 class wxPyGridTableBase : public wxGridTableBase
1229 wxPyGridTableBase() : wxGridTableBase() {}
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);
1249 PYCALLBACK_GCA_INTINTKIND(wxGridTableBase, GetAttr);
1250 PYCALLBACK__GCAINTINT(wxGridTableBase, SetAttr);
1251 PYCALLBACK__GCAINT(wxGridTableBase, SetRowAttr);
1252 PYCALLBACK__GCAINT(wxGridTableBase, SetColAttr);
1255 wxString GetValue(int row, int col) {
1256 bool blocked = wxPyBeginBlockThreads();
1258 if (wxPyCBH_findCallback(m_myInst, "GetValue")) {
1260 ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("(ii)",row,col));
1262 if (!PyString_Check(ro) && !PyUnicode_Check(ro)) {
1264 ro = PyObject_Str(ro);
1267 rval = Py2wxString(ro);
1271 wxPyEndBlockThreads(blocked);
1275 void SetValue(int row, int col, const wxString& val) {
1276 bool blocked = wxPyBeginBlockThreads();
1277 if (wxPyCBH_findCallback(m_myInst, "SetValue")) {
1278 PyObject* s = wx2PyString(val);
1279 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(iiO)",row,col,s));
1282 wxPyEndBlockThreads(blocked);
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 ) {
1290 bool blocked = wxPyBeginBlockThreads();
1291 if (wxPyCBH_findCallback(m_myInst, "GetValue")) {
1294 ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("(ii)", row, col));
1295 if (ro && PyNumber_Check(ro)) {
1296 num = PyNumber_Int(ro);
1298 rval = PyInt_AsLong(num);
1304 wxPyEndBlockThreads(blocked);
1308 double GetValueAsDouble( int row, int col ) {
1310 bool blocked = wxPyBeginBlockThreads();
1311 if (wxPyCBH_findCallback(m_myInst, "GetValue")) {
1314 ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("(ii)", row, col));
1315 if (ro && PyNumber_Check(ro)) {
1316 num = PyNumber_Float(ro);
1318 rval = PyFloat_AsDouble(num);
1324 wxPyEndBlockThreads(blocked);
1328 bool GetValueAsBool( int row, int col ) {
1329 return (bool)GetValueAsLong(row, col);
1332 void SetValueAsLong( int row, int col, long value ) {
1333 bool blocked = wxPyBeginBlockThreads();
1334 if (wxPyCBH_findCallback(m_myInst, "SetValue")) {
1335 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(iii)", row, col, value));
1337 wxPyEndBlockThreads(blocked);
1340 void SetValueAsDouble( int row, int col, double value ) {
1341 bool blocked = wxPyBeginBlockThreads();
1342 if (wxPyCBH_findCallback(m_myInst, "SetValue")) {
1343 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(iid)", row, col, value));
1345 wxPyEndBlockThreads(blocked);
1348 void SetValueAsBool( int row, int col, bool value ) {
1349 SetValueAsLong( row, col, (long)value );
1358 // The python-aware version get's SWIGified
1359 class wxPyGridTableBase : public wxGridTableBase
1362 %pythonAppend wxPyGridTableBase "self._setCallbackInfo(self, PyGridTableBase);self._setOORInfo(self)"
1363 wxPyGridTableBase();
1364 void _setCallbackInfo(PyObject* self, PyObject* _class);
1366 %extend { void Destroy() { delete self; } }
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 );
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();
1383 wxGridCellAttr *base_GetAttr( int row, int col,
1384 wxGridCellAttr::wxAttrKind kind );
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);
1391 //---------------------------------------------------------------------------
1392 // Predefined Tables
1394 class wxGridStringTable : public wxGridTableBase
1397 %pythonAppend wxGridStringTable "self._setOORInfo(self)"
1398 wxGridStringTable( int numRows=0, int numCols=0 );
1401 //---------------------------------------------------------------------------
1402 // The Table can pass messages to the grid to tell it to update itself if
1403 // something has changed.
1405 enum wxGridTableRequest
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
1418 class wxGridTableMessage
1421 wxGridTableMessage( wxGridTableBase *table, int id,
1424 ~wxGridTableMessage();
1426 void SetTableObject( wxGridTableBase *table );
1427 wxGridTableBase * GetTableObject() const;
1428 void SetId( int id );
1430 void SetCommandInt( int comInt1 );
1431 int GetCommandInt();
1432 void SetCommandInt2( int comInt2 );
1433 int GetCommandInt2();
1437 //---------------------------------------------------------------------------
1440 // Typemap to allow conversion of sequence objects to wxGridCellCoords...
1441 %typemap(in) wxGridCellCoords& (wxGridCellCoords temp) {
1443 if (! wxGridCellCoords_helper($input, &$1)) SWIG_fail;
1445 %typemap(typecheck, precedence=SWIG_TYPECHECK_POINTER) wxGridCellCoords& {
1446 $1 = wxGridCellCoords_typecheck($input);
1450 // ...and here is the associated helper.
1452 bool wxGridCellCoords_helper(PyObject* source, wxGridCellCoords** obj) {
1454 if (source == Py_None) {
1455 **obj = wxGridCellCoords(-1,-1);
1459 // If source is an object instance then it may already be the right type
1460 if (wxPySwigInstance_Check(source)) {
1461 wxGridCellCoords* ptr;
1462 if (! wxPyConvertSwigPtr(source, (void **)&ptr, wxT("wxGridCellCoords")))
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);
1471 if (!PyNumber_Check(o1) || !PyNumber_Check(o2)) {
1476 **obj = wxGridCellCoords(PyInt_AsLong(o1), PyInt_AsLong(o2));
1483 PyErr_SetString(PyExc_TypeError, "Expected a 2-tuple of integers or a wxGridCellCoords object.");
1488 bool wxGridCellCoords_typecheck(PyObject* source) {
1491 if (wxPySwigInstance_Check(source) &&
1492 wxPyConvertSwigPtr(source, (void **)&ptr, wxT("wxGridCellCoords")))
1496 if (PySequence_Check(source) && PySequence_Length(source) == 2)
1504 // Typemap to convert an array of cells coords to a list of tuples...
1505 %typemap(out) wxGridCellCoordsArray {
1506 $result = wxGridCellCoordsArray_helper($1);
1509 // %typemap(ret) wxGridCellCoordsArray {
1514 // ...and the helper function for the above typemap.
1516 PyObject* wxGridCellCoordsArray_helper(const wxGridCellCoordsArray& source)
1518 PyObject* list = PyList_New(0);
1520 for (idx = 0; idx < source.GetCount(); idx += 1) {
1521 wxGridCellCoords& coord = source.Item(idx);
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);
1536 class wxGridCellCoords
1539 wxGridCellCoords( int r=-1, int c=-1 );
1540 ~wxGridCellCoords();
1543 void SetRow( int n );
1545 void SetCol( int n );
1546 void Set( int row, int col );
1548 bool operator==( const wxGridCellCoords& other ) const;
1549 bool operator!=( const wxGridCellCoords& other ) const;
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()));
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())
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
1574 //---------------------------------------------------------------------------
1575 //---------------------------------------------------------------------------
1579 // Fool SWIG into treating this enum as an int
1580 typedef int WXGRIDSELECTIONMODES;
1582 // but let the C++ code know what it really is.
1584 typedef wxGrid::wxGridSelectionModes WXGRIDSELECTIONMODES;
1589 MustHaveApp(wxGrid);
1591 class wxGrid : public wxScrolledWindow
1594 %pythonAppend wxGrid "self._setOORInfo(self)"
1595 %typemap(out) wxGrid*; // turn off this typemap
1597 wxGrid( wxWindow *parent,
1599 const wxPoint& pos = wxDefaultPosition,
1600 const wxSize& size = wxDefaultSize,
1601 long style = wxWANTS_CHARS,
1602 const wxString& name = wxPyPanelNameStr);
1604 %name(PreGrid) wxGrid();
1607 // Turn it back on again
1608 %typemap(out) wxGrid* { $result = wxPyMake_wxObject($1, $owner); }
1611 bool Create( wxWindow *parent,
1613 const wxPoint& pos = wxDefaultPosition,
1614 const wxSize& size = wxDefaultSize,
1615 long style = wxWANTS_CHARS,
1616 const wxString& name = wxPyPanelNameStr );
1619 enum wxGridSelectionModes {
1625 SelectCells = wxGridSelectCells
1626 SelectRows = wxGridSelectRows
1627 SelectColumns = wxGridSelectColumns
1630 bool CreateGrid( int numRows, int numCols,
1631 WXGRIDSELECTIONMODES selmode = wxGrid::wxGridSelectCells );
1632 void SetSelectionMode(WXGRIDSELECTIONMODES selmode);
1633 WXGRIDSELECTIONMODES GetSelectionMode();
1636 // ------ grid dimensions
1638 int GetNumberRows();
1639 int GetNumberCols();
1642 bool ProcessTableMessage( wxGridTableMessage& );
1645 wxGridTableBase * GetTable() const;
1646 bool SetTable( wxGridTableBase *table, bool takeOwnership=False,
1647 WXGRIDSELECTIONMODES selmode =
1648 wxGrid::wxGridSelectCells );
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 );
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 );
1664 // ------ Cell text drawing functions
1666 void DrawTextRectangle( wxDC& dc, const wxString&, const wxRect&,
1667 int horizontalAlignment = wxLEFT,
1668 int verticalAlignment = wxTOP,
1669 int textOrientation = wxHORIZONTAL );
1671 // // Split a string containing newline chararcters into an array of
1672 // // strings and return the number of lines
1674 // void StringToLines( const wxString& value, wxArrayString& lines );
1677 void, GetTextBoxSize( wxDC& dc, wxArrayString& lines,
1678 long *OUTPUT, long *OUTPUT ),
1679 "GetTextBoxSize(DC dc, list lines) -> (width, height)");
1683 // Code that does a lot of grid modification can be enclosed
1684 // between BeginBatch() and EndBatch() calls to avoid screen
1689 int GetBatchCount();
1690 void ForceRefresh();
1693 // ------ edit control functions
1696 void EnableEditing( bool edit );
1698 void EnableCellEditControl( bool enable = True );
1699 void DisableCellEditControl();
1700 bool CanEnableCellControl() const;
1701 bool IsCellEditControlEnabled() const;
1702 bool IsCellEditControlShown() const;
1704 bool IsCurrentCellReadOnly() const;
1706 void ShowCellEditControl();
1707 void HideCellEditControl();
1708 void SaveEditControlValue();
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.
1717 //void XYToCell( int x, int y, wxGridCellCoords& );
1719 wxGridCellCoords XYToCell(int x, int y) {
1720 wxGridCellCoords rv;
1721 self->XYToCell(x, y, rv);
1726 int YToRow( int y );
1727 int XToCol( int x );
1729 int YToEdgeOfRow( int y );
1730 int XToEdgeOfCol( int x );
1732 wxRect CellToRect( int row, int col );
1733 // TODO: ??? wxRect CellToRect( const wxGridCellCoords& coords );
1736 int GetGridCursorRow();
1737 int GetGridCursorCol();
1739 // check to see if a cell is either wholly visible (the default arg) or
1740 // at least partially visible in the grid window
1742 bool IsVisible( int row, int col, bool wholeCellVisible = True );
1743 // TODO: ??? bool IsVisible( const wxGridCellCoords& coords, bool wholeCellVisible = True );
1744 void MakeCellVisible( int row, int col );
1745 // TODO: ??? void MakeCellVisible( const wxGridCellCoords& coords );
1748 // ------ grid cursor movement functions
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();
1757 bool MoveCursorUpBlock( bool expandSelection );
1758 bool MoveCursorDownBlock( bool expandSelection );
1759 bool MoveCursorLeftBlock( bool expandSelection );
1760 bool MoveCursorRightBlock( bool expandSelection );
1763 // ------ label and gridline formatting
1765 int GetDefaultRowLabelSize();
1766 int GetRowLabelSize();
1767 int GetDefaultColLabelSize();
1768 int GetColLabelSize();
1769 wxColour GetLabelBackgroundColour();
1770 wxColour GetLabelTextColour();
1771 wxFont GetLabelFont();
1774 void, GetRowLabelAlignment( int *OUTPUT, int *OUTPUT ),
1775 "GetRowLabelAlignment() -> (horiz, vert)");
1778 void, GetColLabelAlignment( int *OUTPUT, int *OUTPUT ),
1779 "GetColLabelAlignment() -> (horiz, vert)");
1781 int GetColLabelTextOrientation();
1782 wxString GetRowLabelValue( int row );
1783 wxString GetColLabelValue( int col );
1784 wxColour GetGridLineColour();
1785 wxColour GetCellHighlightColour();
1786 int GetCellHighlightPenWidth();
1787 int GetCellHighlightROPenWidth();
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 );
1796 void SetColLabelTextOrientation( int textOrientation );
1797 void SetRowLabelValue( int row, const wxString& );
1798 void SetColLabelValue( int col, const wxString& );
1799 void SetGridLineColour( const wxColour& );
1800 void SetCellHighlightColour( const wxColour& );
1801 void SetCellHighlightPenWidth(int width);
1802 void SetCellHighlightROPenWidth(int width);
1804 void EnableDragRowSize( bool enable = True );
1805 void DisableDragRowSize();
1806 bool CanDragRowSize();
1807 void EnableDragColSize( bool enable = True );
1808 void DisableDragColSize();
1809 bool CanDragColSize();
1810 void EnableDragGridSize(bool enable = True);
1811 void DisableDragGridSize();
1812 bool CanDragGridSize();
1814 // this sets the specified attribute for all cells in this row/col
1815 void SetAttr(int row, int col, wxGridCellAttr *attr);
1816 void SetRowAttr(int row, wxGridCellAttr *attr);
1817 void SetColAttr(int col, wxGridCellAttr *attr);
1819 // shortcuts for setting the column parameters
1821 // set the format for the data in the column: default is string
1822 void SetColFormatBool(int col);
1823 void SetColFormatNumber(int col);
1824 void SetColFormatFloat(int col, int width = -1, int precision = -1);
1825 void SetColFormatCustom(int col, const wxString& typeName);
1827 void EnableGridLines( bool enable = True );
1828 bool GridLinesEnabled();
1830 // ------ row and col formatting
1832 int GetDefaultRowSize();
1833 int GetRowSize( int row );
1834 int GetDefaultColSize();
1835 int GetColSize( int col );
1836 wxColour GetDefaultCellBackgroundColour();
1837 wxColour GetCellBackgroundColour( int row, int col );
1838 wxColour GetDefaultCellTextColour();
1839 wxColour GetCellTextColour( int row, int col );
1840 wxFont GetDefaultCellFont();
1841 wxFont GetCellFont( int row, int col );
1844 void, GetDefaultCellAlignment( int *OUTPUT, int *OUTPUT ),
1845 "GetDefaultCellAlignment() -> (horiz, vert)");
1848 void, GetCellAlignment( int row, int col, int *OUTPUT, int *OUTPUT ),
1849 "GetCellAlignment() -> (horiz, vert)");
1851 bool GetDefaultCellOverflow();
1852 bool GetCellOverflow( int row, int col );
1855 void, GetCellSize( int row, int col, int *OUTPUT, int *OUTPUT ),
1856 "GetCellSize(int row, int col) -> (num_rows, num_cols)");
1858 void SetDefaultRowSize( int height, bool resizeExistingRows = False );
1859 void SetRowSize( int row, int height );
1860 void SetDefaultColSize( int width, bool resizeExistingCols = False );
1862 void SetColSize( int col, int width );
1864 // automatically size the column or row to fit to its contents, if
1865 // setAsMin is True, this optimal width will also be set as minimal width
1867 void AutoSizeColumn( int col, bool setAsMin = True );
1868 void AutoSizeRow( int row, bool setAsMin = True );
1871 // auto size all columns (very ineffective for big grids!)
1872 void AutoSizeColumns( bool setAsMin = True );
1873 void AutoSizeRows( bool setAsMin = True );
1875 // auto size the grid, that is make the columns/rows of the "right" size
1876 // and also set the grid size to just fit its contents
1879 // autosize row height depending on label text
1880 void AutoSizeRowLabelSize( int row );
1882 // autosize column width depending on label text
1883 void AutoSizeColLabelSize( int col );
1886 // column won't be resized to be lesser width - this must be called during
1887 // the grid creation because it won't resize the column if it's already
1888 // narrower than the minimal width
1889 void SetColMinimalWidth( int col, int width );
1890 void SetRowMinimalHeight( int row, int width );
1892 void SetColMinimalAcceptableWidth( int width );
1893 void SetRowMinimalAcceptableHeight( int width );
1894 int GetColMinimalAcceptableWidth() const;
1895 int GetRowMinimalAcceptableHeight() const;
1897 void SetDefaultCellBackgroundColour( const wxColour& );
1898 void SetCellBackgroundColour( int row, int col, const wxColour& );
1899 void SetDefaultCellTextColour( const wxColour& );
1901 void SetCellTextColour( int row, int col, const wxColour& );
1902 void SetDefaultCellFont( const wxFont& );
1903 void SetCellFont( int row, int col, const wxFont& );
1904 void SetDefaultCellAlignment( int horiz, int vert );
1905 void SetCellAlignment( int row, int col, int horiz, int vert );
1906 void SetDefaultCellOverflow( bool allow );
1907 void SetCellOverflow( int row, int col, bool allow );
1908 void SetCellSize( int row, int col, int num_rows, int num_cols );
1910 // takes ownership of the pointer
1911 void SetDefaultRenderer(wxGridCellRenderer *renderer);
1912 void SetCellRenderer(int row, int col, wxGridCellRenderer *renderer);
1913 wxGridCellRenderer *GetDefaultRenderer() const;
1914 wxGridCellRenderer* GetCellRenderer(int row, int col);
1916 // takes ownership of the pointer
1917 void SetDefaultEditor(wxGridCellEditor *editor);
1918 void SetCellEditor(int row, int col, wxGridCellEditor *editor);
1919 wxGridCellEditor *GetDefaultEditor() const;
1920 wxGridCellEditor* GetCellEditor(int row, int col);
1924 // ------ cell value accessors
1926 wxString GetCellValue( int row, int col );
1927 // TODO: ??? wxString GetCellValue( const wxGridCellCoords& coords )
1929 void SetCellValue( int row, int col, const wxString& s );
1930 // TODO: ??? void SetCellValue( const wxGridCellCoords& coords, const wxString& s )
1932 // returns True if the cell can't be edited
1933 bool IsReadOnly(int row, int col) const;
1935 // make the cell editable/readonly
1936 void SetReadOnly(int row, int col, bool isReadOnly = True);
1938 // ------ selections of blocks of cells
1940 void SelectRow( int row, bool addToSelected = False );
1941 void SelectCol( int col, bool addToSelected = False );
1943 void SelectBlock( int topRow, int leftCol, int bottomRow, int rightCol,
1944 bool addToSelected = False );
1945 // TODO: ??? void SelectBlock( const wxGridCellCoords& topLeft,
1946 // TODO: ??? const wxGridCellCoords& bottomRight )
1950 void ClearSelection();
1951 bool IsInSelection( int row, int col );
1952 // TODO: ??? bool IsInSelection( const wxGridCellCoords& coords )
1954 const wxGridCellCoordsArray GetSelectedCells() const;
1955 const wxGridCellCoordsArray GetSelectionBlockTopLeft() const;
1956 const wxGridCellCoordsArray GetSelectionBlockBottomRight() const;
1957 const wxArrayInt GetSelectedRows() const;
1958 const wxArrayInt GetSelectedCols() const;
1960 void DeselectRow( int row );
1961 void DeselectCol( int col );
1962 void DeselectCell( int row, int col );
1965 // This function returns the rectangle that encloses the block of cells
1966 // limited by TopLeft and BottomRight cell in device coords and clipped
1967 // to the client size of the grid window.
1969 wxRect BlockToDeviceRect( const wxGridCellCoords & topLeft,
1970 const wxGridCellCoords & bottomRight );
1973 // Access or update the selection fore/back colours
1974 wxColour GetSelectionBackground() const;
1975 wxColour GetSelectionForeground() const;
1977 void SetSelectionBackground(const wxColour& c);
1978 void SetSelectionForeground(const wxColour& c);
1981 // Methods for a registry for mapping data types to Renderers/Editors
1982 void RegisterDataType(const wxString& typeName,
1983 wxGridCellRenderer* renderer,
1984 wxGridCellEditor* editor);
1985 wxGridCellEditor* GetDefaultEditorForCell(int row, int col) const;
1986 // TODO: ??? wxGridCellEditor* GetDefaultEditorForCell(const wxGridCellCoords& c) const
1987 wxGridCellRenderer* GetDefaultRendererForCell(int row, int col) const;
1988 wxGridCellEditor* GetDefaultEditorForType(const wxString& typeName) const;
1989 wxGridCellRenderer* GetDefaultRendererForType(const wxString& typeName) const;
1991 // grid may occupy more space than needed for its rows/columns, this
1992 // function allows to set how big this extra space is
1993 void SetMargins(int extraWidth, int extraHeight);
1996 // Accessors for component windows
1997 wxWindow* GetGridWindow();
1998 wxWindow* GetGridRowLabelWindow();
1999 wxWindow* GetGridColLabelWindow();
2000 wxWindow* GetGridCornerLabelWindow();
2003 static wxVisualAttributes
2004 GetClassDefaultAttributes(wxWindowVariant variant = wxWINDOW_VARIANT_NORMAL);
2008 //---------------------------------------------------------------------------
2009 //---------------------------------------------------------------------------
2010 // Grid events and stuff
2014 class wxGridEvent : public wxNotifyEvent
2017 wxGridEvent(int id, wxEventType type, wxGrid* obj,
2018 int row=-1, int col=-1, int x=-1, int y=-1, bool sel = True,
2019 bool control=False, bool shift=False, bool alt=False, bool meta=False);
2021 virtual int GetRow();
2022 virtual int GetCol();
2023 wxPoint GetPosition();
2033 class wxGridSizeEvent : public wxNotifyEvent
2036 wxGridSizeEvent(int id, wxEventType type, wxGrid* obj,
2037 int rowOrCol=-1, int x=-1, int y=-1,
2038 bool control=False, bool shift=False, bool alt=False, bool meta=False);
2041 wxPoint GetPosition();
2050 class wxGridRangeSelectEvent : public wxNotifyEvent
2053 wxGridRangeSelectEvent(int id, wxEventType type, wxGrid* obj,
2054 const wxGridCellCoords& topLeft,
2055 const wxGridCellCoords& bottomRight,
2057 bool control=False, bool shift=False,
2058 bool alt=False, bool meta=False);
2060 wxGridCellCoords GetTopLeftCoords();
2061 wxGridCellCoords GetBottomRightCoords();
2074 class wxGridEditorCreatedEvent : public wxCommandEvent {
2076 wxGridEditorCreatedEvent(int id, wxEventType type, wxObject* obj,
2077 int row, int col, wxControl* ctrl);
2081 wxControl* GetControl();
2082 void SetRow(int row);
2083 void SetCol(int col);
2084 void SetControl(wxControl* ctrl);
2089 %constant wxEventType wxEVT_GRID_CELL_LEFT_CLICK;
2090 %constant wxEventType wxEVT_GRID_CELL_RIGHT_CLICK;
2091 %constant wxEventType wxEVT_GRID_CELL_LEFT_DCLICK;
2092 %constant wxEventType wxEVT_GRID_CELL_RIGHT_DCLICK;
2093 %constant wxEventType wxEVT_GRID_LABEL_LEFT_CLICK;
2094 %constant wxEventType wxEVT_GRID_LABEL_RIGHT_CLICK;
2095 %constant wxEventType wxEVT_GRID_LABEL_LEFT_DCLICK;
2096 %constant wxEventType wxEVT_GRID_LABEL_RIGHT_DCLICK;
2097 %constant wxEventType wxEVT_GRID_ROW_SIZE;
2098 %constant wxEventType wxEVT_GRID_COL_SIZE;
2099 %constant wxEventType wxEVT_GRID_RANGE_SELECT;
2100 %constant wxEventType wxEVT_GRID_CELL_CHANGE;
2101 %constant wxEventType wxEVT_GRID_SELECT_CELL;
2102 %constant wxEventType wxEVT_GRID_EDITOR_SHOWN;
2103 %constant wxEventType wxEVT_GRID_EDITOR_HIDDEN;
2104 %constant wxEventType wxEVT_GRID_EDITOR_CREATED;
2109 EVT_GRID_CELL_LEFT_CLICK = wx.PyEventBinder( wxEVT_GRID_CELL_LEFT_CLICK )
2110 EVT_GRID_CELL_RIGHT_CLICK = wx.PyEventBinder( wxEVT_GRID_CELL_RIGHT_CLICK )
2111 EVT_GRID_CELL_LEFT_DCLICK = wx.PyEventBinder( wxEVT_GRID_CELL_LEFT_DCLICK )
2112 EVT_GRID_CELL_RIGHT_DCLICK = wx.PyEventBinder( wxEVT_GRID_CELL_RIGHT_DCLICK )
2113 EVT_GRID_LABEL_LEFT_CLICK = wx.PyEventBinder( wxEVT_GRID_LABEL_LEFT_CLICK )
2114 EVT_GRID_LABEL_RIGHT_CLICK = wx.PyEventBinder( wxEVT_GRID_LABEL_RIGHT_CLICK )
2115 EVT_GRID_LABEL_LEFT_DCLICK = wx.PyEventBinder( wxEVT_GRID_LABEL_LEFT_DCLICK )
2116 EVT_GRID_LABEL_RIGHT_DCLICK = wx.PyEventBinder( wxEVT_GRID_LABEL_RIGHT_DCLICK )
2117 EVT_GRID_ROW_SIZE = wx.PyEventBinder( wxEVT_GRID_ROW_SIZE )
2118 EVT_GRID_COL_SIZE = wx.PyEventBinder( wxEVT_GRID_COL_SIZE )
2119 EVT_GRID_RANGE_SELECT = wx.PyEventBinder( wxEVT_GRID_RANGE_SELECT )
2120 EVT_GRID_CELL_CHANGE = wx.PyEventBinder( wxEVT_GRID_CELL_CHANGE )
2121 EVT_GRID_SELECT_CELL = wx.PyEventBinder( wxEVT_GRID_SELECT_CELL )
2122 EVT_GRID_EDITOR_SHOWN = wx.PyEventBinder( wxEVT_GRID_EDITOR_SHOWN )
2123 EVT_GRID_EDITOR_HIDDEN = wx.PyEventBinder( wxEVT_GRID_EDITOR_HIDDEN )
2124 EVT_GRID_EDITOR_CREATED = wx.PyEventBinder( wxEVT_GRID_EDITOR_CREATED )
2127 %# The same as above but with the ability to specify an identifier
2128 EVT_GRID_CMD_CELL_LEFT_CLICK = wx.PyEventBinder( wxEVT_GRID_CELL_LEFT_CLICK, 1 )
2129 EVT_GRID_CMD_CELL_RIGHT_CLICK = wx.PyEventBinder( wxEVT_GRID_CELL_RIGHT_CLICK, 1 )
2130 EVT_GRID_CMD_CELL_LEFT_DCLICK = wx.PyEventBinder( wxEVT_GRID_CELL_LEFT_DCLICK, 1 )
2131 EVT_GRID_CMD_CELL_RIGHT_DCLICK = wx.PyEventBinder( wxEVT_GRID_CELL_RIGHT_DCLICK, 1 )
2132 EVT_GRID_CMD_LABEL_LEFT_CLICK = wx.PyEventBinder( wxEVT_GRID_LABEL_LEFT_CLICK, 1 )
2133 EVT_GRID_CMD_LABEL_RIGHT_CLICK = wx.PyEventBinder( wxEVT_GRID_LABEL_RIGHT_CLICK, 1 )
2134 EVT_GRID_CMD_LABEL_LEFT_DCLICK = wx.PyEventBinder( wxEVT_GRID_LABEL_LEFT_DCLICK, 1 )
2135 EVT_GRID_CMD_LABEL_RIGHT_DCLICK = wx.PyEventBinder( wxEVT_GRID_LABEL_RIGHT_DCLICK, 1 )
2136 EVT_GRID_CMD_ROW_SIZE = wx.PyEventBinder( wxEVT_GRID_ROW_SIZE, 1 )
2137 EVT_GRID_CMD_COL_SIZE = wx.PyEventBinder( wxEVT_GRID_COL_SIZE, 1 )
2138 EVT_GRID_CMD_RANGE_SELECT = wx.PyEventBinder( wxEVT_GRID_RANGE_SELECT, 1 )
2139 EVT_GRID_CMD_CELL_CHANGE = wx.PyEventBinder( wxEVT_GRID_CELL_CHANGE, 1 )
2140 EVT_GRID_CMD_SELECT_CELL = wx.PyEventBinder( wxEVT_GRID_SELECT_CELL, 1 )
2141 EVT_GRID_CMD_EDITOR_SHOWN = wx.PyEventBinder( wxEVT_GRID_EDITOR_SHOWN, 1 )
2142 EVT_GRID_CMD_EDITOR_HIDDEN = wx.PyEventBinder( wxEVT_GRID_EDITOR_HIDDEN, 1 )
2143 EVT_GRID_CMD_EDITOR_CREATED = wx.PyEventBinder( wxEVT_GRID_EDITOR_CREATED, 1 )
2146 //---------------------------------------------------------------------------
2151 //---------------------------------------------------------------------------
2152 //---------------------------------------------------------------------------