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; \
68 /* Otherwise make a new wrapper for it the old fashioned way and \
69 give it the OOR treatment */ \
71 target = wxPyConstructObject(source, wxT(#TYPE), setThisOwn); \
73 source->SetClientObject(new wxPyOORClientData(target)); \
75 } else { /* source was NULL so return None. */ \
76 Py_INCREF(Py_None); target = Py_None; \
82 wxPyMake_TEMPLATE(wxGridCellRenderer)
83 wxPyMake_TEMPLATE(wxGridCellEditor)
84 wxPyMake_TEMPLATE(wxGridCellAttr)
85 wxPyMake_TEMPLATE(wxGridCellAttrProvider)
86 wxPyMake_TEMPLATE(wxGridTableBase)
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
98 #define PYCALLBACK_GCA_INTINTKIND(PCLASS, CBNAME) \
99 wxGridCellAttr* CBNAME(int a, int b, wxGridCellAttr::wxAttrKind c) { \
100 wxGridCellAttr* rval = NULL; \
102 bool blocked = wxPyBeginBlockThreads(); \
103 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
105 wxGridCellAttr* ptr; \
106 ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("(iii)", a, b, c)); \
108 if (wxPyConvertSwigPtr(ro, (void **)&ptr, wxT("wxGridCellAttr"))) \
113 wxPyEndBlockThreads(blocked); \
115 rval = PCLASS::CBNAME(a, b, c); \
118 wxGridCellAttr *base_##CBNAME(int a, int b, wxGridCellAttr::wxAttrKind c) { \
119 return PCLASS::CBNAME(a, b, c); \
124 #define PYCALLBACK__GCAINTINT(PCLASS, CBNAME) \
125 void CBNAME(wxGridCellAttr *attr, int a, int b) { \
126 bool blocked = wxPyBeginBlockThreads(); \
128 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
129 PyObject* obj = wxPyMake_wxGridCellAttr(attr,false); \
130 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(Oii)", obj, a, b)); \
133 wxPyEndBlockThreads(blocked); \
135 PCLASS::CBNAME(attr, a, b); \
137 void base_##CBNAME(wxGridCellAttr *attr, int a, int b) { \
138 PCLASS::CBNAME(attr, a, b); \
143 #define PYCALLBACK__GCAINT(PCLASS, CBNAME) \
144 void CBNAME(wxGridCellAttr *attr, int val) { \
145 bool blocked = wxPyBeginBlockThreads(); \
147 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
148 PyObject* obj = wxPyMake_wxGridCellAttr(attr,false); \
149 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(Oi)", obj, val)); \
152 wxPyEndBlockThreads(blocked); \
154 PCLASS::CBNAME(attr, val); \
156 void base_##CBNAME(wxGridCellAttr *attr, int val) { \
157 PCLASS::CBNAME(attr, val); \
162 #define PYCALLBACK_INT__pure(CBNAME) \
164 bool blocked = wxPyBeginBlockThreads(); \
166 if (wxPyCBH_findCallback(m_myInst, #CBNAME)) \
167 rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("()")); \
168 wxPyEndBlockThreads(blocked); \
174 #define PYCALLBACK_BOOL_INTINT_pure(CBNAME) \
175 bool CBNAME(int a, int b) { \
176 bool blocked = wxPyBeginBlockThreads(); \
178 if (wxPyCBH_findCallback(m_myInst, #CBNAME)) \
179 rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(ii)",a,b)); \
180 wxPyEndBlockThreads(blocked); \
185 #define PYCALLBACK_STRING_INTINT_pure(CBNAME) \
186 wxString CBNAME(int a, int b) { \
187 bool blocked = wxPyBeginBlockThreads(); \
189 if (wxPyCBH_findCallback(m_myInst, #CBNAME)) { \
191 ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("(ii)",a,b)); \
193 rval = Py2wxString(ro); \
197 wxPyEndBlockThreads(blocked); \
202 #define PYCALLBACK__INTINTSTRING_pure(CBNAME) \
203 void CBNAME(int a, int b, const wxString& c) { \
204 bool blocked = wxPyBeginBlockThreads(); \
205 if (wxPyCBH_findCallback(m_myInst, #CBNAME)) { \
206 PyObject* s = wx2PyString(c); \
207 rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(iiO)",a,b,s));\
210 wxPyEndBlockThreads(blocked); \
214 #define PYCALLBACK_STRING_INTINT(PCLASS, CBNAME) \
215 wxString CBNAME(int a, int b) { \
217 bool blocked = wxPyBeginBlockThreads(); \
219 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
221 ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("(ii)",a,b)); \
223 rval = Py2wxString(ro); \
227 wxPyEndBlockThreads(blocked); \
229 rval = PCLASS::CBNAME(a, b); \
232 wxString base_##CBNAME(int a, int b) { \
233 return PCLASS::CBNAME(a, b); \
237 #define PYCALLBACK_BOOL_INTINTSTRING(PCLASS, CBNAME) \
238 bool CBNAME(int a, int b, const wxString& c) { \
241 bool blocked = wxPyBeginBlockThreads(); \
242 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
243 PyObject* s = wx2PyString(c); \
244 rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(iiO)",a,b,s));\
247 wxPyEndBlockThreads(blocked); \
249 rval = PCLASS::CBNAME(a,b,c); \
252 bool base_##CBNAME(int a, int b, const wxString& c) { \
253 return PCLASS::CBNAME(a,b,c); \
259 #define PYCALLBACK_LONG_INTINT(PCLASS, CBNAME) \
260 long CBNAME(int a, int b) { \
263 bool blocked = wxPyBeginBlockThreads(); \
264 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \
265 rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(ii)", a,b)); \
266 wxPyEndBlockThreads(blocked); \
268 rval = PCLASS::CBNAME(a,b); \
271 long base_##CBNAME(int a, int b) { \
272 return PCLASS::CBNAME(a,b); \
277 #define PYCALLBACK_BOOL_INTINT(PCLASS, CBNAME) \
278 bool CBNAME(int a, int b) { \
281 bool blocked = wxPyBeginBlockThreads(); \
282 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \
283 rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(ii)", a,b)); \
284 wxPyEndBlockThreads(blocked); \
286 rval = PCLASS::CBNAME(a,b); \
289 bool base_##CBNAME(int a, int b) { \
290 return PCLASS::CBNAME(a,b); \
295 #define PYCALLBACK_DOUBLE_INTINT(PCLASS, CBNAME) \
296 double CBNAME(int a, int b) { \
298 bool blocked = wxPyBeginBlockThreads(); \
300 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
302 ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("(ii)",a,b)); \
304 PyObject* str = PyObject_Str(ro); \
305 rval = PyFloat_AsDouble(str); \
306 Py_DECREF(ro); Py_DECREF(str); \
309 wxPyEndBlockThreads(blocked); \
311 rval = PCLASS::CBNAME(a, b); \
314 double base_##CBNAME(int a, int b) { \
315 return PCLASS::CBNAME(a, b); \
320 #define PYCALLBACK__(PCLASS, CBNAME) \
323 bool blocked = wxPyBeginBlockThreads(); \
324 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \
325 wxPyCBH_callCallback(m_myInst, Py_BuildValue("()")); \
326 wxPyEndBlockThreads(blocked); \
330 void base_##CBNAME() { \
337 #define PYCALLBACK_BOOL_SIZETSIZET(PCLASS, CBNAME) \
338 bool CBNAME(size_t a, size_t b) { \
341 bool blocked = wxPyBeginBlockThreads(); \
342 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \
343 rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(ii)", a,b)); \
344 wxPyEndBlockThreads(blocked); \
346 rval = PCLASS::CBNAME(a,b); \
349 bool base_##CBNAME(size_t a, size_t b) { \
350 return PCLASS::CBNAME(a,b); \
355 #define PYCALLBACK_BOOL_SIZET(PCLASS, CBNAME) \
356 bool CBNAME(size_t a) { \
359 bool blocked = wxPyBeginBlockThreads(); \
360 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \
361 rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(i)", a)); \
362 wxPyEndBlockThreads(blocked); \
364 rval = PCLASS::CBNAME(a); \
367 bool base_##CBNAME(size_t a) { \
368 return PCLASS::CBNAME(a); \
372 #define PYCALLBACK_STRING_INT(PCLASS, CBNAME) \
373 wxString CBNAME(int a) { \
375 bool blocked = wxPyBeginBlockThreads(); \
377 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
379 ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("(i)",a)); \
381 rval = Py2wxString(ro); \
385 wxPyEndBlockThreads(blocked); \
387 rval = PCLASS::CBNAME(a); \
390 wxString base_##CBNAME(int a) { \
391 return PCLASS::CBNAME(a); \
395 #define PYCALLBACK__INTSTRING(PCLASS, CBNAME) \
396 void CBNAME(int a, const wxString& c) { \
398 bool blocked = wxPyBeginBlockThreads(); \
399 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
400 PyObject* s = wx2PyString(c); \
401 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(iO)",a,s)); \
404 wxPyEndBlockThreads(blocked); \
406 PCLASS::CBNAME(a,c); \
408 void base_##CBNAME(int a, const wxString& c) { \
409 PCLASS::CBNAME(a,c); \
415 #define PYCALLBACK_BOOL_(PCLASS, CBNAME) \
419 bool blocked = wxPyBeginBlockThreads(); \
420 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \
421 rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("()")); \
422 wxPyEndBlockThreads(blocked); \
424 rval = PCLASS::CBNAME(); \
427 bool base_##CBNAME() { \
428 return PCLASS::CBNAME(); \
433 #define PYCALLBACK__SIZETINT(PCLASS, CBNAME) \
434 void CBNAME(size_t a, int b) { \
436 bool blocked = wxPyBeginBlockThreads(); \
437 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \
438 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(ii)", a,b)); \
439 wxPyEndBlockThreads(blocked); \
441 PCLASS::CBNAME(a,b); \
443 void base_##CBNAME(size_t a, int b) { \
444 PCLASS::CBNAME(a,b); \
450 #define PYCALLBACK__INTINTLONG(PCLASS, CBNAME) \
451 void CBNAME(int a, int b, long c) { \
453 bool blocked = wxPyBeginBlockThreads(); \
454 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \
455 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(iii)", a,b,c)); \
456 wxPyEndBlockThreads(blocked); \
458 PCLASS::CBNAME(a,b,c); \
460 void base_##CBNAME(int a, int b, long c) { \
461 PCLASS::CBNAME(a,b,c); \
467 #define PYCALLBACK__INTINTDOUBLE(PCLASS, CBNAME) \
468 void CBNAME(int a, int b, double c) { \
470 bool blocked = wxPyBeginBlockThreads(); \
471 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \
472 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(iif)", a,b,c)); \
473 wxPyEndBlockThreads(blocked); \
475 PCLASS::CBNAME(a,b,c); \
477 void base_##CBNAME(int a, int b, double c) { \
478 PCLASS::CBNAME(a,b,c); \
483 #define PYCALLBACK__INTINTBOOL(PCLASS, CBNAME) \
484 void CBNAME(int a, int b, bool c) { \
486 bool blocked = wxPyBeginBlockThreads(); \
487 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \
488 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(iii)", a,b,c)); \
489 wxPyEndBlockThreads(blocked); \
491 PCLASS::CBNAME(a,b,c); \
493 void base_##CBNAME(int a, int b, bool c) { \
494 PCLASS::CBNAME(a,b,c); \
502 //---------------------------------------------------------------------------
504 class wxGridCellCoords;
505 class wxGridCellAttr;
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"
514 #define wxGRID_VALUE_CHOICEINT "choiceint"
515 #define wxGRID_VALUE_DATETIME "datetime"
519 const wxGridCellCoords wxGridNoCellCoords;
520 const wxRect wxGridNoCellRect;
524 %rename(GRID_DEFAULT_NUMBER_ROWS) WXGRID_DEFAULT_NUMBER_ROWS;
525 %rename(GRID_DEFAULT_NUMBER_COLS) WXGRID_DEFAULT_NUMBER_COLS;
526 %rename(GRID_DEFAULT_ROW_HEIGHT) WXGRID_DEFAULT_ROW_HEIGHT;
527 %rename(GRID_DEFAULT_COL_WIDTH) WXGRID_DEFAULT_COL_WIDTH;
528 %rename(GRID_DEFAULT_COL_LABEL_HEIGHT) WXGRID_DEFAULT_COL_LABEL_HEIGHT;
529 %rename(GRID_DEFAULT_ROW_LABEL_WIDTH) WXGRID_DEFAULT_ROW_LABEL_WIDTH;
530 %rename(GRID_LABEL_EDGE_ZONE) WXGRID_LABEL_EDGE_ZONE;
531 %rename(GRID_MIN_ROW_HEIGHT) WXGRID_MIN_ROW_HEIGHT;
532 %rename(GRID_MIN_COL_WIDTH) WXGRID_MIN_COL_WIDTH;
533 %rename(GRID_DEFAULT_SCROLLBAR_WIDTH) WXGRID_DEFAULT_SCROLLBAR_WIDTH;
536 WXGRID_DEFAULT_NUMBER_ROWS,
537 WXGRID_DEFAULT_NUMBER_COLS,
538 WXGRID_DEFAULT_ROW_HEIGHT,
539 WXGRID_DEFAULT_COL_WIDTH,
540 WXGRID_DEFAULT_COL_LABEL_HEIGHT,
541 WXGRID_DEFAULT_ROW_LABEL_WIDTH,
542 WXGRID_LABEL_EDGE_ZONE,
543 WXGRID_MIN_ROW_HEIGHT,
544 WXGRID_MIN_COL_WIDTH,
545 WXGRID_DEFAULT_SCROLLBAR_WIDTH
549 //---------------------------------------------------------------------------
550 // wxGridCellRenderer is an ABC, and several derived classes are available.
551 // Classes implemented in Python should be derived from wxPyGridCellRenderer.
554 class wxGridCellRenderer
558 void _setOORInfo(PyObject* _self) {
559 self->SetClientObject(new wxPyOORClientData(_self));
563 void SetParameters(const wxString& params);
567 virtual void Draw(wxGrid& grid,
568 wxGridCellAttr& attr,
573 virtual wxSize GetBestSize(wxGrid& grid,
574 wxGridCellAttr& attr,
577 virtual wxGridCellRenderer *Clone() const;
581 // The C++ version of wxPyGridCellRenderer
583 class wxPyGridCellRenderer : public wxGridCellRenderer
586 wxPyGridCellRenderer() : wxGridCellRenderer() {};
588 // Implement Python callback aware virtual methods
589 void Draw(wxGrid& grid, wxGridCellAttr& attr,
590 wxDC& dc, const wxRect& rect,
591 int row, int col, bool isSelected) {
592 bool blocked = wxPyBeginBlockThreads();
593 if (wxPyCBH_findCallback(m_myInst, "Draw")) {
594 PyObject* go = wxPyMake_wxObject(&grid,false);
595 PyObject* dco = wxPyMake_wxObject(&dc,false);
596 PyObject* ao = wxPyMake_wxGridCellAttr(&attr,false);
597 PyObject* ro = wxPyConstructObject((void*)&rect, wxT("wxRect"), 0);
599 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(OOOOiii)", go, ao, dco, ro,
600 row, col, isSelected));
606 wxPyEndBlockThreads(blocked);
609 wxSize GetBestSize(wxGrid& grid, wxGridCellAttr& attr, wxDC& dc,
612 bool blocked = wxPyBeginBlockThreads();
613 if (wxPyCBH_findCallback(m_myInst, "GetBestSize")) {
616 PyObject* go = wxPyMake_wxObject(&grid,false);
617 PyObject* dco = wxPyMake_wxObject(&dc,false);
618 PyObject* ao = wxPyMake_wxGridCellAttr(&attr,false);
620 ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("(OOOii)",
628 const char* errmsg = "GetBestSize should return a 2-tuple of integers or a wxSize object.";
629 if (wxPyConvertSwigPtr(ro, (void **)&ptr, wxT("wxSize"))) {
632 else if (PySequence_Check(ro) && PyObject_Length(ro) == 2) {
633 PyObject* o1 = PySequence_GetItem(ro, 0);
634 PyObject* o2 = PySequence_GetItem(ro, 1);
635 if (PyNumber_Check(o1) && PyNumber_Check(o2))
636 rval = wxSize(PyInt_AsLong(o1), PyInt_AsLong(o2));
638 PyErr_SetString(PyExc_TypeError, errmsg);
643 PyErr_SetString(PyExc_TypeError, errmsg);
648 wxPyEndBlockThreads(blocked);
653 wxGridCellRenderer *Clone() const {
654 wxGridCellRenderer* rval = NULL;
655 bool blocked = wxPyBeginBlockThreads();
656 if (wxPyCBH_findCallback(m_myInst, "Clone")) {
658 wxGridCellRenderer* ptr;
659 ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("()"));
661 if (wxPyConvertSwigPtr(ro, (void **)&ptr, wxT("wxGridCellRenderer")))
666 wxPyEndBlockThreads(blocked);
670 DEC_PYCALLBACK__STRING(SetParameters);
675 IMP_PYCALLBACK__STRING( wxPyGridCellRenderer, wxGridCellRenderer, SetParameters);
680 // Let SWIG know about it so it can create the Python version
681 class wxPyGridCellRenderer : public wxGridCellRenderer {
683 %pythonAppend wxPyGridCellRenderer "self._setCallbackInfo(self, PyGridCellRenderer);self._setOORInfo(self)"
685 wxPyGridCellRenderer();
686 void _setCallbackInfo(PyObject* self, PyObject* _class);
688 void base_SetParameters(const wxString& params);
691 //---------------------------------------------------------------------------
692 // Predefined Renderers
694 class wxGridCellStringRenderer : public wxGridCellRenderer
697 %pythonAppend wxGridCellStringRenderer "self._setOORInfo(self)"
698 wxGridCellStringRenderer();
702 class wxGridCellNumberRenderer : public wxGridCellStringRenderer
705 %pythonAppend wxGridCellNumberRenderer "self._setOORInfo(self)"
706 wxGridCellNumberRenderer();
710 class wxGridCellFloatRenderer : public wxGridCellStringRenderer
713 %pythonAppend wxGridCellFloatRenderer "self._setOORInfo(self)"
714 wxGridCellFloatRenderer(int width = -1, int precision = -1);
716 int GetWidth() const;
717 void SetWidth(int width);
718 int GetPrecision() const;
719 void SetPrecision(int precision);
723 class wxGridCellBoolRenderer : public wxGridCellRenderer
726 %pythonAppend wxGridCellBoolRenderer "self._setOORInfo(self)"
727 wxGridCellBoolRenderer();
731 class wxGridCellDateTimeRenderer : public wxGridCellStringRenderer
734 %pythonAppend wxGridCellDateTimeRenderer "self._setOORInfo(self)"
735 wxGridCellDateTimeRenderer(wxString outformat = wxPyDateTimeFormatStr,
736 wxString informat = wxPyDateTimeFormatStr);
740 class wxGridCellEnumRenderer : public wxGridCellStringRenderer
743 %pythonAppend wxGridCellEnumRenderer "self._setOORInfo(self)"
744 wxGridCellEnumRenderer( const wxString& choices = wxPyEmptyString );
748 class wxGridCellAutoWrapStringRenderer : public wxGridCellStringRenderer
751 %pythonAppend wxGridCellAutoWrapStringRenderer "self._setOORInfo(self)"
752 wxGridCellAutoWrapStringRenderer();
756 //---------------------------------------------------------------------------
757 // wxGridCellEditor is an ABC, and several derived classes are available.
758 // Classes implemented in Python should be derived from wxPyGridCellEditor.
760 class wxGridCellEditor
764 void _setOORInfo(PyObject* _self) {
765 self->SetClientObject(new wxPyOORClientData(_self));
770 wxControl* GetControl();
771 void SetControl(wxControl* control);
773 wxGridCellAttr* GetCellAttr();
774 void SetCellAttr(wxGridCellAttr* attr);
776 void SetParameters(const wxString& params);
780 virtual void Create(wxWindow* parent,
782 wxEvtHandler* evtHandler);
783 virtual void BeginEdit(int row, int col, wxGrid* grid);
784 virtual bool EndEdit(int row, int col, wxGrid* grid);
785 virtual void Reset();
786 virtual wxGridCellEditor *Clone() const;
788 virtual void SetSize(const wxRect& rect);
789 virtual void Show(bool show, wxGridCellAttr *attr = NULL);
790 virtual void PaintBackground(const wxRect& rectCell, wxGridCellAttr *attr);
791 virtual bool IsAcceptedKey(wxKeyEvent& event);
792 virtual void StartingKey(wxKeyEvent& event);
793 virtual void StartingClick();
794 virtual void HandleReturn(wxKeyEvent& event);
795 virtual void Destroy();
800 // The C++ version of wxPyGridCellEditor
802 class wxPyGridCellEditor : public wxGridCellEditor
805 wxPyGridCellEditor() : wxGridCellEditor() {}
807 void Create(wxWindow* parent, wxWindowID id, wxEvtHandler* evtHandler) {
808 bool blocked = wxPyBeginBlockThreads();
809 if (wxPyCBH_findCallback(m_myInst, "Create")) {
810 PyObject* po = wxPyMake_wxObject(parent,false);
811 PyObject* eo = wxPyMake_wxObject(evtHandler,false);
813 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(OiO)", po, id, eo));
817 wxPyEndBlockThreads(blocked);
821 void BeginEdit(int row, int col, wxGrid* grid) {
822 bool blocked = wxPyBeginBlockThreads();
823 if (wxPyCBH_findCallback(m_myInst, "BeginEdit")) {
824 PyObject* go = wxPyMake_wxObject(grid,false);
825 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(iiO)", row, col, go));
828 wxPyEndBlockThreads(blocked);
832 bool EndEdit(int row, int col, wxGrid* grid) {
834 bool blocked = wxPyBeginBlockThreads();
835 if (wxPyCBH_findCallback(m_myInst, "EndEdit")) {
836 PyObject* go = wxPyMake_wxObject(grid,false);
837 rv = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(iiO)", row, col, go));
840 wxPyEndBlockThreads(blocked);
845 wxGridCellEditor* Clone() const {
846 wxGridCellEditor* rval = NULL;
847 bool blocked = wxPyBeginBlockThreads();
848 if (wxPyCBH_findCallback(m_myInst, "Clone")) {
850 wxGridCellEditor* ptr;
851 ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("()"));
853 if (wxPyConvertSwigPtr(ro, (void **)&ptr, wxT("wxGridCellEditor")))
858 wxPyEndBlockThreads(blocked);
863 void Show(bool show, wxGridCellAttr *attr) {
865 bool blocked = wxPyBeginBlockThreads();
866 if ((found = wxPyCBH_findCallback(m_myInst, "Show"))) {
867 PyObject* ao = wxPyMake_wxGridCellAttr(attr,false);
868 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(iO)", show, ao));
871 wxPyEndBlockThreads(blocked);
873 wxGridCellEditor::Show(show, attr);
875 void base_Show(bool show, wxGridCellAttr *attr) {
876 wxGridCellEditor::Show(show, attr);
880 void PaintBackground(const wxRect& rectCell, wxGridCellAttr *attr) {
882 bool blocked = wxPyBeginBlockThreads();
883 if ((found = wxPyCBH_findCallback(m_myInst, "PaintBackground)"))) {
884 PyObject* ao = wxPyMake_wxGridCellAttr(attr,false);
885 PyObject* ro = wxPyConstructObject((void*)&rectCell, wxT("wxRect"), 0);
887 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(OO)", ro, ao));
892 wxPyEndBlockThreads(blocked);
894 wxGridCellEditor::PaintBackground(rectCell, attr);
896 void base_PaintBackground(const wxRect& rectCell, wxGridCellAttr *attr) {
897 wxGridCellEditor::PaintBackground(rectCell, attr);
901 DEC_PYCALLBACK___pure(Reset);
902 DEC_PYCALLBACK__constany(SetSize, wxRect);
903 DEC_PYCALLBACK_bool_any(IsAcceptedKey, wxKeyEvent);
904 DEC_PYCALLBACK__any(StartingKey, wxKeyEvent);
905 DEC_PYCALLBACK__any(HandleReturn, wxKeyEvent);
906 DEC_PYCALLBACK__(StartingClick);
907 DEC_PYCALLBACK__(Destroy);
908 DEC_PYCALLBACK__STRING(SetParameters);
909 DEC_PYCALLBACK_STRING__constpure(GetValue);
915 IMP_PYCALLBACK__STRING( wxPyGridCellEditor, wxGridCellEditor, SetParameters);
916 IMP_PYCALLBACK___pure(wxPyGridCellEditor, wxGridCellEditor, Reset);
917 IMP_PYCALLBACK__constany(wxPyGridCellEditor, wxGridCellEditor, SetSize, wxRect);
918 IMP_PYCALLBACK_bool_any(wxPyGridCellEditor, wxGridCellEditor, IsAcceptedKey, wxKeyEvent);
919 IMP_PYCALLBACK__any(wxPyGridCellEditor, wxGridCellEditor, StartingKey, wxKeyEvent);
920 IMP_PYCALLBACK__any(wxPyGridCellEditor, wxGridCellEditor, HandleReturn, wxKeyEvent);
921 IMP_PYCALLBACK__(wxPyGridCellEditor, wxGridCellEditor, StartingClick);
922 IMP_PYCALLBACK__(wxPyGridCellEditor, wxGridCellEditor, Destroy);
923 IMP_PYCALLBACK_STRING__constpure(wxPyGridCellEditor, wxGridCellEditor, GetValue);
928 // Let SWIG know about it so it can create the Python version
929 class wxPyGridCellEditor : public wxGridCellEditor {
931 %pythonAppend wxPyGridCellEditor "self._setCallbackInfo(self, PyGridCellEditor);self._setOORInfo(self)"
933 wxPyGridCellEditor();
934 void _setCallbackInfo(PyObject* self, PyObject* _class);
936 void base_SetSize(const wxRect& rect);
937 void base_Show(bool show, wxGridCellAttr *attr = NULL);
938 void base_PaintBackground(const wxRect& rectCell, wxGridCellAttr *attr);
939 bool base_IsAcceptedKey(wxKeyEvent& event);
940 void base_StartingKey(wxKeyEvent& event);
941 void base_StartingClick();
942 void base_HandleReturn(wxKeyEvent& event);
944 void base_SetParameters(const wxString& params);
947 //---------------------------------------------------------------------------
948 // Predefined Editors
950 class wxGridCellTextEditor : public wxGridCellEditor
953 %pythonAppend wxGridCellTextEditor "self._setOORInfo(self)"
954 wxGridCellTextEditor();
955 virtual wxString GetValue();
959 class wxGridCellNumberEditor : public wxGridCellTextEditor
962 %pythonAppend wxGridCellNumberEditor "self._setOORInfo(self)"
963 wxGridCellNumberEditor(int min = -1, int max = -1);
964 virtual wxString GetValue();
968 class wxGridCellFloatEditor : public wxGridCellTextEditor
971 %pythonAppend wxGridCellFloatEditor "self._setOORInfo(self)"
972 wxGridCellFloatEditor(int width = -1, int precision = -1);
973 virtual wxString GetValue();
977 class wxGridCellBoolEditor : public wxGridCellEditor
980 %pythonAppend wxGridCellBoolEditor "self._setOORInfo(self)"
981 wxGridCellBoolEditor();
982 virtual wxString GetValue();
985 class wxGridCellChoiceEditor : public wxGridCellEditor
988 %pythonAppend wxGridCellChoiceEditor "self._setOORInfo(self)"
989 wxGridCellChoiceEditor(int choices = 0,
990 const wxString* choices_array = NULL,
991 bool allowOthers = False);
992 virtual wxString GetValue();
996 class wxGridCellEnumEditor : public wxGridCellChoiceEditor
999 %pythonAppend wxGridCellEnumEditor "self._setOORInfo(self)"
1000 wxGridCellEnumEditor( const wxString& choices = wxPyEmptyString );
1001 virtual wxString GetValue();
1005 class wxGridCellAutoWrapStringEditor : public wxGridCellTextEditor
1008 %pythonAppend wxGridCellAutoWrapStringEditor "self._setOORInfo(self)"
1009 wxGridCellAutoWrapStringEditor();
1010 virtual wxString GetValue();
1015 //---------------------------------------------------------------------------
1018 class wxGridCellAttr
1032 void _setOORInfo(PyObject* _self) {
1033 self->SetClientObject(new wxPyOORClientData(_self));
1037 %pythonAppend wxGridCellAttr "self._setOORInfo(self)"
1039 wxGridCellAttr(wxGridCellAttr *attrDefault = NULL);
1041 wxGridCellAttr *Clone() const;
1042 void MergeWith(wxGridCellAttr *mergefrom);
1045 void SetTextColour(const wxColour& colText);
1046 void SetBackgroundColour(const wxColour& colBack);
1047 void SetFont(const wxFont& font);
1048 void SetAlignment(int hAlign, int vAlign);
1049 void SetSize(int num_rows, int num_cols);
1050 void SetOverflow( bool allow = True );
1051 void SetReadOnly(bool isReadOnly = True);
1053 void SetRenderer(wxGridCellRenderer *renderer);
1054 void SetEditor(wxGridCellEditor* editor);
1055 void SetKind(wxAttrKind kind);
1057 bool HasTextColour() const;
1058 bool HasBackgroundColour() const;
1059 bool HasFont() const;
1060 bool HasAlignment() const;
1061 bool HasRenderer() const;
1062 bool HasEditor() const;
1063 bool HasReadWriteMode() const;
1064 bool HasOverflowMode() const;
1066 wxColour GetTextColour() const;
1067 wxColour GetBackgroundColour() const;
1068 wxFont GetFont() const;
1071 void, GetAlignment(int *OUTPUT, int *OUTPUT) const,
1072 "GetAlignment() -> (hAlign, vAlign)");
1075 void, GetSize(int *OUTPUT, int *OUTPUT) const,
1076 "GetSize() -> (num_rows, num_cols)");
1078 bool GetOverflow() const;
1079 wxGridCellRenderer *GetRenderer(wxGrid* grid, int row, int col) const;
1080 wxGridCellEditor *GetEditor(wxGrid* grid, int row, int col) const;
1082 bool IsReadOnly() const;
1083 wxAttrKind GetKind();
1084 void SetDefAttr(wxGridCellAttr* defAttr);
1087 //---------------------------------------------------------------------------
1089 class wxGridCellAttrProvider
1092 %pythonAppend wxGridCellAttrProvider "self._setOORInfo(self)"
1093 wxGridCellAttrProvider();
1094 // ???? virtual ~wxGridCellAttrProvider();
1097 void _setOORInfo(PyObject* _self) {
1098 self->SetClientObject(new wxPyOORClientData(_self));
1102 wxGridCellAttr *GetAttr(int row, int col,
1103 wxGridCellAttr::wxAttrKind kind) const;
1104 void SetAttr(wxGridCellAttr *attr, int row, int col);
1105 void SetRowAttr(wxGridCellAttr *attr, int row);
1106 void SetColAttr(wxGridCellAttr *attr, int col);
1108 void UpdateAttrRows( size_t pos, int numRows );
1109 void UpdateAttrCols( size_t pos, int numCols );
1114 // A Python-aware version
1116 class wxPyGridCellAttrProvider : public wxGridCellAttrProvider
1119 wxPyGridCellAttrProvider() : wxGridCellAttrProvider() {};
1121 PYCALLBACK_GCA_INTINTKIND(wxGridCellAttrProvider, GetAttr);
1122 PYCALLBACK__GCAINTINT(wxGridCellAttrProvider, SetAttr);
1123 PYCALLBACK__GCAINT(wxGridCellAttrProvider, SetRowAttr);
1124 PYCALLBACK__GCAINT(wxGridCellAttrProvider, SetColAttr);
1131 // The python-aware version get's SWIGified
1132 class wxPyGridCellAttrProvider : public wxGridCellAttrProvider
1135 %pythonAppend wxPyGridCellAttrProvider "self._setCallbackInfo(self, PyGridCellAttrProvider)"
1136 wxPyGridCellAttrProvider();
1137 void _setCallbackInfo(PyObject* self, PyObject* _class);
1139 wxGridCellAttr *base_GetAttr(int row, int col,
1140 wxGridCellAttr::wxAttrKind kind);
1141 void base_SetAttr(wxGridCellAttr *attr, int row, int col);
1142 void base_SetRowAttr(wxGridCellAttr *attr, int row);
1143 void base_SetColAttr(wxGridCellAttr *attr, int col);
1147 //---------------------------------------------------------------------------
1148 // Grid Table Base class and Python aware version
1151 class wxGridTableBase : public wxObject
1154 // wxGridTableBase(); This is an ABC
1155 //~wxGridTableBase();
1158 void _setOORInfo(PyObject* _self) {
1159 self->SetClientObject(new wxPyOORClientData(_self));
1163 void SetAttrProvider(wxGridCellAttrProvider *attrProvider);
1164 wxGridCellAttrProvider *GetAttrProvider() const;
1165 void SetView( wxGrid *grid );
1166 wxGrid * GetView() const;
1170 virtual int GetNumberRows();
1171 virtual int GetNumberCols();
1172 virtual bool IsEmptyCell( int row, int col );
1173 virtual wxString GetValue( int row, int col );
1174 virtual void SetValue( int row, int col, const wxString& value );
1176 // virtuals overridable in wxPyGridTableBase
1177 virtual wxString GetTypeName( int row, int col );
1178 virtual bool CanGetValueAs( int row, int col, const wxString& typeName );
1179 virtual bool CanSetValueAs( int row, int col, const wxString& typeName );
1180 virtual long GetValueAsLong( int row, int col );
1181 virtual double GetValueAsDouble( int row, int col );
1182 virtual bool GetValueAsBool( int row, int col );
1183 virtual void SetValueAsLong( int row, int col, long value );
1184 virtual void SetValueAsDouble( int row, int col, double value );
1185 virtual void SetValueAsBool( int row, int col, bool value );
1187 //virtual void* GetValueAsCustom( int row, int col, const wxString& typeName );
1188 //virtual void SetValueAsCustom( int row, int col, const wxString& typeName, void* value );
1191 virtual void Clear();
1192 virtual bool InsertRows( size_t pos = 0, size_t numRows = 1 );
1193 virtual bool AppendRows( size_t numRows = 1 );
1194 virtual bool DeleteRows( size_t pos = 0, size_t numRows = 1 );
1195 virtual bool InsertCols( size_t pos = 0, size_t numCols = 1 );
1196 virtual bool AppendCols( size_t numCols = 1 );
1197 virtual bool DeleteCols( size_t pos = 0, size_t numCols = 1 );
1199 virtual wxString GetRowLabelValue( int row );
1200 virtual wxString GetColLabelValue( int col );
1201 virtual void SetRowLabelValue( int row, const wxString& value );
1202 virtual void SetColLabelValue( int col, const wxString& value );
1204 virtual bool CanHaveAttributes();
1206 virtual wxGridCellAttr *GetAttr( int row, int col,
1207 wxGridCellAttr::wxAttrKind kind);
1208 virtual void SetAttr(wxGridCellAttr* attr, int row, int col);
1209 virtual void SetRowAttr(wxGridCellAttr *attr, int row);
1210 virtual void SetColAttr(wxGridCellAttr *attr, int col);
1216 // Python-aware version
1218 class wxPyGridTableBase : public wxGridTableBase
1221 wxPyGridTableBase() : wxGridTableBase() {}
1223 PYCALLBACK_INT__pure(GetNumberRows);
1224 PYCALLBACK_INT__pure(GetNumberCols);
1225 PYCALLBACK_BOOL_INTINT_pure(IsEmptyCell);
1226 PYCALLBACK_STRING_INTINT(wxGridTableBase, GetTypeName);
1227 PYCALLBACK_BOOL_INTINTSTRING(wxGridTableBase, CanGetValueAs);
1228 PYCALLBACK_BOOL_INTINTSTRING(wxGridTableBase, CanSetValueAs);
1229 PYCALLBACK__(wxGridTableBase, Clear);
1230 PYCALLBACK_BOOL_SIZETSIZET(wxGridTableBase, InsertRows);
1231 PYCALLBACK_BOOL_SIZETSIZET(wxGridTableBase, DeleteRows);
1232 PYCALLBACK_BOOL_SIZETSIZET(wxGridTableBase, InsertCols);
1233 PYCALLBACK_BOOL_SIZETSIZET(wxGridTableBase, DeleteCols);
1234 PYCALLBACK_BOOL_SIZET(wxGridTableBase, AppendRows);
1235 PYCALLBACK_BOOL_SIZET(wxGridTableBase, AppendCols);
1236 PYCALLBACK_STRING_INT(wxGridTableBase, GetRowLabelValue);
1237 PYCALLBACK_STRING_INT(wxGridTableBase, GetColLabelValue);
1238 PYCALLBACK__INTSTRING(wxGridTableBase, SetRowLabelValue);
1239 PYCALLBACK__INTSTRING(wxGridTableBase, SetColLabelValue);
1240 PYCALLBACK_BOOL_(wxGridTableBase, CanHaveAttributes);
1241 PYCALLBACK_GCA_INTINTKIND(wxGridTableBase, GetAttr);
1242 PYCALLBACK__GCAINTINT(wxGridTableBase, SetAttr);
1243 PYCALLBACK__GCAINT(wxGridTableBase, SetRowAttr);
1244 PYCALLBACK__GCAINT(wxGridTableBase, SetColAttr);
1247 wxString GetValue(int row, int col) {
1248 bool blocked = wxPyBeginBlockThreads();
1250 if (wxPyCBH_findCallback(m_myInst, "GetValue")) {
1252 ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("(ii)",row,col));
1254 if (!PyString_Check(ro) && !PyUnicode_Check(ro)) {
1256 ro = PyObject_Str(ro);
1259 rval = Py2wxString(ro);
1263 wxPyEndBlockThreads(blocked);
1267 void SetValue(int row, int col, const wxString& val) {
1268 bool blocked = wxPyBeginBlockThreads();
1269 if (wxPyCBH_findCallback(m_myInst, "SetValue")) {
1270 PyObject* s = wx2PyString(val);
1271 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(iiO)",row,col,s));
1274 wxPyEndBlockThreads(blocked);
1278 // Map the Get/Set methods for the standard non-string types to
1279 // the GetValue and SetValue python methods.
1280 long GetValueAsLong( int row, int col ) {
1282 bool blocked = wxPyBeginBlockThreads();
1283 if (wxPyCBH_findCallback(m_myInst, "GetValue")) {
1286 ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("(ii)", row, col));
1287 if (ro && PyNumber_Check(ro)) {
1288 num = PyNumber_Int(ro);
1290 rval = PyInt_AsLong(num);
1296 wxPyEndBlockThreads(blocked);
1300 double GetValueAsDouble( int row, int col ) {
1302 bool blocked = wxPyBeginBlockThreads();
1303 if (wxPyCBH_findCallback(m_myInst, "GetValue")) {
1306 ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("(ii)", row, col));
1307 if (ro && PyNumber_Check(ro)) {
1308 num = PyNumber_Float(ro);
1310 rval = PyFloat_AsDouble(num);
1316 wxPyEndBlockThreads(blocked);
1320 bool GetValueAsBool( int row, int col ) {
1321 return (bool)GetValueAsLong(row, col);
1324 void SetValueAsLong( int row, int col, long value ) {
1325 bool blocked = wxPyBeginBlockThreads();
1326 if (wxPyCBH_findCallback(m_myInst, "SetValue")) {
1327 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(iii)", row, col, value));
1329 wxPyEndBlockThreads(blocked);
1332 void SetValueAsDouble( int row, int col, double value ) {
1333 bool blocked = wxPyBeginBlockThreads();
1334 if (wxPyCBH_findCallback(m_myInst, "SetValue")) {
1335 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(iid)", row, col, value));
1337 wxPyEndBlockThreads(blocked);
1340 void SetValueAsBool( int row, int col, bool value ) {
1341 SetValueAsLong( row, col, (long)value );
1350 // The python-aware version get's SWIGified
1351 class wxPyGridTableBase : public wxGridTableBase
1354 %pythonAppend wxPyGridTableBase "self._setCallbackInfo(self, PyGridTableBase);self._setOORInfo(self)"
1355 wxPyGridTableBase();
1356 void _setCallbackInfo(PyObject* self, PyObject* _class);
1358 %extend { void Destroy() { delete self; } }
1360 wxString base_GetTypeName( int row, int col );
1361 bool base_CanGetValueAs( int row, int col, const wxString& typeName );
1362 bool base_CanSetValueAs( int row, int col, const wxString& typeName );
1364 bool base_InsertRows( size_t pos = 0, size_t numRows = 1 );
1365 bool base_AppendRows( size_t numRows = 1 );
1366 bool base_DeleteRows( size_t pos = 0, size_t numRows = 1 );
1367 bool base_InsertCols( size_t pos = 0, size_t numCols = 1 );
1368 bool base_AppendCols( size_t numCols = 1 );
1369 bool base_DeleteCols( size_t pos = 0, size_t numCols = 1 );
1370 wxString base_GetRowLabelValue( int row );
1371 wxString base_GetColLabelValue( int col );
1372 void base_SetRowLabelValue( int row, const wxString& value );
1373 void base_SetColLabelValue( int col, const wxString& value );
1374 bool base_CanHaveAttributes();
1375 wxGridCellAttr *base_GetAttr( int row, int col,
1376 wxGridCellAttr::wxAttrKind kind );
1377 void base_SetAttr(wxGridCellAttr* attr, int row, int col);
1378 void base_SetRowAttr(wxGridCellAttr *attr, int row);
1379 void base_SetColAttr(wxGridCellAttr *attr, int col);
1383 //---------------------------------------------------------------------------
1384 // Predefined Tables
1386 class wxGridStringTable : public wxGridTableBase
1389 %pythonAppend wxGridStringTable "self._setOORInfo(self)"
1390 wxGridStringTable( int numRows=0, int numCols=0 );
1393 //---------------------------------------------------------------------------
1394 // The Table can pass messages to the grid to tell it to update itself if
1395 // something has changed.
1397 enum wxGridTableRequest
1399 wxGRIDTABLE_REQUEST_VIEW_GET_VALUES = 2000,
1400 wxGRIDTABLE_REQUEST_VIEW_SEND_VALUES,
1401 wxGRIDTABLE_NOTIFY_ROWS_INSERTED,
1402 wxGRIDTABLE_NOTIFY_ROWS_APPENDED,
1403 wxGRIDTABLE_NOTIFY_ROWS_DELETED,
1404 wxGRIDTABLE_NOTIFY_COLS_INSERTED,
1405 wxGRIDTABLE_NOTIFY_COLS_APPENDED,
1406 wxGRIDTABLE_NOTIFY_COLS_DELETED
1410 class wxGridTableMessage
1413 wxGridTableMessage( wxGridTableBase *table, int id,
1416 ~wxGridTableMessage();
1418 void SetTableObject( wxGridTableBase *table );
1419 wxGridTableBase * GetTableObject() const;
1420 void SetId( int id );
1422 void SetCommandInt( int comInt1 );
1423 int GetCommandInt();
1424 void SetCommandInt2( int comInt2 );
1425 int GetCommandInt2();
1429 //---------------------------------------------------------------------------
1432 // Typemap to allow conversion of sequence objects to wxGridCellCoords...
1433 %typemap(in) wxGridCellCoords& (wxGridCellCoords temp) {
1435 if (! wxGridCellCoords_helper($input, &$1)) SWIG_fail;
1437 %typemap(typecheck, precedence=SWIG_TYPECHECK_POINTER) wxGridCellCoords& {
1438 $1 = wxGridCellCoords_typecheck($input);
1442 // ...and here is the associated helper.
1444 bool wxGridCellCoords_helper(PyObject* source, wxGridCellCoords** obj) {
1446 if (source == Py_None) {
1447 **obj = wxGridCellCoords(-1,-1);
1451 // If source is an object instance then it may already be the right type
1452 if (wxPySwigInstance_Check(source)) {
1453 wxGridCellCoords* ptr;
1454 if (! wxPyConvertSwigPtr(source, (void **)&ptr, wxT("wxGridCellCoords")))
1459 // otherwise a 2-tuple of integers is expected
1460 else if (PySequence_Check(source) && PyObject_Length(source) == 2) {
1461 PyObject* o1 = PySequence_GetItem(source, 0);
1462 PyObject* o2 = PySequence_GetItem(source, 1);
1463 if (!PyNumber_Check(o1) || !PyNumber_Check(o2)) {
1468 **obj = wxGridCellCoords(PyInt_AsLong(o1), PyInt_AsLong(o2));
1475 PyErr_SetString(PyExc_TypeError, "Expected a 2-tuple of integers or a wxGridCellCoords object.");
1480 bool wxGridCellCoords_typecheck(PyObject* source) {
1483 if (wxPySwigInstance_Check(source) &&
1484 wxPyConvertSwigPtr(source, (void **)&ptr, wxT("wxGridCellCoords")))
1488 if (PySequence_Check(source) && PySequence_Length(source) == 2)
1496 // Typemap to convert an array of cells coords to a list of tuples...
1497 %typemap(out) wxGridCellCoordsArray {
1498 $result = wxGridCellCoordsArray_helper($1);
1501 // %typemap(ret) wxGridCellCoordsArray {
1506 // ...and the helper function for the above typemap.
1508 PyObject* wxGridCellCoordsArray_helper(const wxGridCellCoordsArray& source)
1510 PyObject* list = PyList_New(0);
1512 for (idx = 0; idx < source.GetCount(); idx += 1) {
1513 wxGridCellCoords& coord = source.Item(idx);
1514 PyObject* tup = PyTuple_New(2);
1515 PyTuple_SET_ITEM(tup, 0, PyInt_FromLong(coord.GetRow()));
1516 PyTuple_SET_ITEM(tup, 1, PyInt_FromLong(coord.GetCol()));
1517 PyList_Append(list, tup);
1528 class wxGridCellCoords
1531 wxGridCellCoords( int r=-1, int c=-1 );
1532 ~wxGridCellCoords();
1535 void SetRow( int n );
1537 void SetCol( int n );
1538 void Set( int row, int col );
1540 bool operator==( const wxGridCellCoords& other ) const;
1541 bool operator!=( const wxGridCellCoords& other ) const;
1545 PyObject* tup = PyTuple_New(2);
1546 PyTuple_SET_ITEM(tup, 0, PyInt_FromLong(self->GetRow()));
1547 PyTuple_SET_ITEM(tup, 1, PyInt_FromLong(self->GetCol()));
1552 asTuple = wx._deprecated(Get, "asTuple is deprecated, use `Get` instead")
1553 def __str__(self): return str(self.Get())
1554 def __repr__(self): return 'wxGridCellCoords'+str(self.Get())
1555 def __len__(self): return len(self.Get())
1556 def __getitem__(self, index): return self.asTuple()[index]
1557 def __setitem__(self, index, val):
1558 if index == 0: self.SetRow(val)
1559 elif index == 1: self.SetCol(val)
1560 else: raise IndexError
1566 //---------------------------------------------------------------------------
1567 //---------------------------------------------------------------------------
1571 // Fool SWIG into treating this enum as an int
1572 typedef int WXGRIDSELECTIONMODES;
1574 // but let the C++ code know what it really is.
1576 typedef wxGrid::wxGridSelectionModes WXGRIDSELECTIONMODES;
1581 MustHaveApp(wxGrid);
1583 class wxGrid : public wxScrolledWindow
1586 %pythonAppend wxGrid "self._setOORInfo(self)"
1588 wxGrid( wxWindow *parent,
1590 const wxPoint& pos = wxDefaultPosition,
1591 const wxSize& size = wxDefaultSize,
1592 long style = wxWANTS_CHARS,
1593 const wxString& name = wxPyPanelNameStr);
1595 %name(PreGrid) wxGrid();
1598 bool Create( wxWindow *parent,
1600 const wxPoint& pos = wxDefaultPosition,
1601 const wxSize& size = wxDefaultSize,
1602 long style = wxWANTS_CHARS,
1603 const wxString& name = wxPyPanelNameStr );
1606 enum wxGridSelectionModes {
1612 SelectCells = wxGridSelectCells
1613 SelectRows = wxGridSelectRows
1614 SelectColumns = wxGridSelectColumns
1617 bool CreateGrid( int numRows, int numCols,
1618 WXGRIDSELECTIONMODES selmode = wxGrid::wxGridSelectCells );
1619 void SetSelectionMode(WXGRIDSELECTIONMODES selmode);
1620 WXGRIDSELECTIONMODES GetSelectionMode();
1623 // ------ grid dimensions
1625 int GetNumberRows();
1626 int GetNumberCols();
1629 bool ProcessTableMessage( wxGridTableMessage& );
1632 wxGridTableBase * GetTable() const;
1633 bool SetTable( wxGridTableBase *table, bool takeOwnership=False,
1634 WXGRIDSELECTIONMODES selmode =
1635 wxGrid::wxGridSelectCells );
1638 bool InsertRows( int pos = 0, int numRows = 1, bool updateLabels=True );
1639 bool AppendRows( int numRows = 1, bool updateLabels=True );
1640 bool DeleteRows( int pos = 0, int numRows = 1, bool updateLabels=True );
1641 bool InsertCols( int pos = 0, int numCols = 1, bool updateLabels=True );
1642 bool AppendCols( int numCols = 1, bool updateLabels=True );
1643 bool DeleteCols( int pos = 0, int numCols = 1, bool updateLabels=True );
1646 // this function is called when the current cell highlight must be redrawn
1647 // and may be overridden by the user
1648 virtual void DrawCellHighlight( wxDC& dc, const wxGridCellAttr *attr );
1651 // ------ Cell text drawing functions
1653 void DrawTextRectangle( wxDC& dc, const wxString&, const wxRect&,
1654 int horizontalAlignment = wxLEFT,
1655 int verticalAlignment = wxTOP,
1656 int textOrientation = wxHORIZONTAL );
1658 // // Split a string containing newline chararcters into an array of
1659 // // strings and return the number of lines
1661 // void StringToLines( const wxString& value, wxArrayString& lines );
1664 void, GetTextBoxSize( wxDC& dc, wxArrayString& lines,
1665 long *OUTPUT, long *OUTPUT ),
1666 "GetTextBoxSize(DC dc, list lines) -> (width, height)");
1670 // Code that does a lot of grid modification can be enclosed
1671 // between BeginBatch() and EndBatch() calls to avoid screen
1676 int GetBatchCount();
1677 void ForceRefresh();
1680 // ------ edit control functions
1683 void EnableEditing( bool edit );
1685 void EnableCellEditControl( bool enable = True );
1686 void DisableCellEditControl();
1687 bool CanEnableCellControl() const;
1688 bool IsCellEditControlEnabled() const;
1689 bool IsCellEditControlShown() const;
1691 bool IsCurrentCellReadOnly() const;
1693 void ShowCellEditControl();
1694 void HideCellEditControl();
1695 void SaveEditControlValue();
1698 // ------ grid location functions
1699 // Note that all of these functions work with the logical coordinates of
1700 // grid cells and labels so you will need to convert from device
1701 // coordinates for mouse events etc.
1704 //void XYToCell( int x, int y, wxGridCellCoords& );
1706 wxGridCellCoords XYToCell(int x, int y) {
1707 wxGridCellCoords rv;
1708 self->XYToCell(x, y, rv);
1713 int YToRow( int y );
1714 int XToCol( int x );
1716 int YToEdgeOfRow( int y );
1717 int XToEdgeOfCol( int x );
1719 wxRect CellToRect( int row, int col );
1720 // TODO: ??? wxRect CellToRect( const wxGridCellCoords& coords );
1723 int GetGridCursorRow();
1724 int GetGridCursorCol();
1726 // check to see if a cell is either wholly visible (the default arg) or
1727 // at least partially visible in the grid window
1729 bool IsVisible( int row, int col, bool wholeCellVisible = True );
1730 // TODO: ??? bool IsVisible( const wxGridCellCoords& coords, bool wholeCellVisible = True );
1731 void MakeCellVisible( int row, int col );
1732 // TODO: ??? void MakeCellVisible( const wxGridCellCoords& coords );
1735 // ------ grid cursor movement functions
1737 void SetGridCursor( int row, int col );
1738 bool MoveCursorUp( bool expandSelection );
1739 bool MoveCursorDown( bool expandSelection );
1740 bool MoveCursorLeft( bool expandSelection );
1741 bool MoveCursorRight( bool expandSelection );
1742 bool MovePageDown();
1744 bool MoveCursorUpBlock( bool expandSelection );
1745 bool MoveCursorDownBlock( bool expandSelection );
1746 bool MoveCursorLeftBlock( bool expandSelection );
1747 bool MoveCursorRightBlock( bool expandSelection );
1750 // ------ label and gridline formatting
1752 int GetDefaultRowLabelSize();
1753 int GetRowLabelSize();
1754 int GetDefaultColLabelSize();
1755 int GetColLabelSize();
1756 wxColour GetLabelBackgroundColour();
1757 wxColour GetLabelTextColour();
1758 wxFont GetLabelFont();
1761 void, GetRowLabelAlignment( int *OUTPUT, int *OUTPUT ),
1762 "GetRowLabelAlignment() -> (horiz, vert)");
1765 void, GetColLabelAlignment( int *OUTPUT, int *OUTPUT ),
1766 "GetColLabelAlignment() -> (horiz, vert)");
1768 int GetColLabelTextOrientation();
1769 wxString GetRowLabelValue( int row );
1770 wxString GetColLabelValue( int col );
1771 wxColour GetGridLineColour();
1772 wxColour GetCellHighlightColour();
1773 int GetCellHighlightPenWidth();
1774 int GetCellHighlightROPenWidth();
1776 void SetRowLabelSize( int width );
1777 void SetColLabelSize( int height );
1778 void SetLabelBackgroundColour( const wxColour& );
1779 void SetLabelTextColour( const wxColour& );
1780 void SetLabelFont( const wxFont& );
1781 void SetRowLabelAlignment( int horiz, int vert );
1782 void SetColLabelAlignment( int horiz, int vert );
1783 void SetColLabelTextOrientation( int textOrientation );
1784 void SetRowLabelValue( int row, const wxString& );
1785 void SetColLabelValue( int col, const wxString& );
1786 void SetGridLineColour( const wxColour& );
1787 void SetCellHighlightColour( const wxColour& );
1788 void SetCellHighlightPenWidth(int width);
1789 void SetCellHighlightROPenWidth(int width);
1791 void EnableDragRowSize( bool enable = True );
1792 void DisableDragRowSize();
1793 bool CanDragRowSize();
1794 void EnableDragColSize( bool enable = True );
1795 void DisableDragColSize();
1796 bool CanDragColSize();
1797 void EnableDragGridSize(bool enable = True);
1798 void DisableDragGridSize();
1799 bool CanDragGridSize();
1801 // this sets the specified attribute for all cells in this row/col
1802 void SetAttr(int row, int col, wxGridCellAttr *attr);
1803 void SetRowAttr(int row, wxGridCellAttr *attr);
1804 void SetColAttr(int col, wxGridCellAttr *attr);
1806 // shortcuts for setting the column parameters
1808 // set the format for the data in the column: default is string
1809 void SetColFormatBool(int col);
1810 void SetColFormatNumber(int col);
1811 void SetColFormatFloat(int col, int width = -1, int precision = -1);
1812 void SetColFormatCustom(int col, const wxString& typeName);
1814 void EnableGridLines( bool enable = True );
1815 bool GridLinesEnabled();
1817 // ------ row and col formatting
1819 int GetDefaultRowSize();
1820 int GetRowSize( int row );
1821 int GetDefaultColSize();
1822 int GetColSize( int col );
1823 wxColour GetDefaultCellBackgroundColour();
1824 wxColour GetCellBackgroundColour( int row, int col );
1825 wxColour GetDefaultCellTextColour();
1826 wxColour GetCellTextColour( int row, int col );
1827 wxFont GetDefaultCellFont();
1828 wxFont GetCellFont( int row, int col );
1831 void, GetDefaultCellAlignment( int *OUTPUT, int *OUTPUT ),
1832 "GetDefaultCellAlignment() -> (horiz, vert)");
1835 void, GetCellAlignment( int row, int col, int *OUTPUT, int *OUTPUT ),
1836 "GetCellAlignment() -> (horiz, vert)");
1838 bool GetDefaultCellOverflow();
1839 bool GetCellOverflow( int row, int col );
1842 void, GetCellSize( int row, int col, int *OUTPUT, int *OUTPUT ),
1843 "GetCellSize(int row, int col) -> (num_rows, num_cols)");
1845 void SetDefaultRowSize( int height, bool resizeExistingRows = False );
1846 void SetRowSize( int row, int height );
1847 void SetDefaultColSize( int width, bool resizeExistingCols = False );
1849 void SetColSize( int col, int width );
1851 // automatically size the column or row to fit to its contents, if
1852 // setAsMin is True, this optimal width will also be set as minimal width
1854 void AutoSizeColumn( int col, bool setAsMin = True );
1855 void AutoSizeRow( int row, bool setAsMin = True );
1858 // auto size all columns (very ineffective for big grids!)
1859 void AutoSizeColumns( bool setAsMin = True );
1860 void AutoSizeRows( bool setAsMin = True );
1862 // auto size the grid, that is make the columns/rows of the "right" size
1863 // and also set the grid size to just fit its contents
1866 // autosize row height depending on label text
1867 void AutoSizeRowLabelSize( int row );
1869 // autosize column width depending on label text
1870 void AutoSizeColLabelSize( int col );
1873 // column won't be resized to be lesser width - this must be called during
1874 // the grid creation because it won't resize the column if it's already
1875 // narrower than the minimal width
1876 void SetColMinimalWidth( int col, int width );
1877 void SetRowMinimalHeight( int row, int width );
1879 void SetColMinimalAcceptableWidth( int width );
1880 void SetRowMinimalAcceptableHeight( int width );
1881 int GetColMinimalAcceptableWidth() const;
1882 int GetRowMinimalAcceptableHeight() const;
1884 void SetDefaultCellBackgroundColour( const wxColour& );
1885 void SetCellBackgroundColour( int row, int col, const wxColour& );
1886 void SetDefaultCellTextColour( const wxColour& );
1888 void SetCellTextColour( int row, int col, const wxColour& );
1889 void SetDefaultCellFont( const wxFont& );
1890 void SetCellFont( int row, int col, const wxFont& );
1891 void SetDefaultCellAlignment( int horiz, int vert );
1892 void SetCellAlignment( int row, int col, int horiz, int vert );
1893 void SetDefaultCellOverflow( bool allow );
1894 void SetCellOverflow( int row, int col, bool allow );
1895 void SetCellSize( int row, int col, int num_rows, int num_cols );
1897 // takes ownership of the pointer
1898 void SetDefaultRenderer(wxGridCellRenderer *renderer);
1899 void SetCellRenderer(int row, int col, wxGridCellRenderer *renderer);
1900 wxGridCellRenderer *GetDefaultRenderer() const;
1901 wxGridCellRenderer* GetCellRenderer(int row, int col);
1903 // takes ownership of the pointer
1904 void SetDefaultEditor(wxGridCellEditor *editor);
1905 void SetCellEditor(int row, int col, wxGridCellEditor *editor);
1906 wxGridCellEditor *GetDefaultEditor() const;
1907 wxGridCellEditor* GetCellEditor(int row, int col);
1911 // ------ cell value accessors
1913 wxString GetCellValue( int row, int col );
1914 // TODO: ??? wxString GetCellValue( const wxGridCellCoords& coords )
1916 void SetCellValue( int row, int col, const wxString& s );
1917 // TODO: ??? void SetCellValue( const wxGridCellCoords& coords, const wxString& s )
1919 // returns True if the cell can't be edited
1920 bool IsReadOnly(int row, int col) const;
1922 // make the cell editable/readonly
1923 void SetReadOnly(int row, int col, bool isReadOnly = True);
1925 // ------ selections of blocks of cells
1927 void SelectRow( int row, bool addToSelected = False );
1928 void SelectCol( int col, bool addToSelected = False );
1930 void SelectBlock( int topRow, int leftCol, int bottomRow, int rightCol,
1931 bool addToSelected = False );
1932 // TODO: ??? void SelectBlock( const wxGridCellCoords& topLeft,
1933 // TODO: ??? const wxGridCellCoords& bottomRight )
1937 void ClearSelection();
1938 bool IsInSelection( int row, int col );
1939 // TODO: ??? bool IsInSelection( const wxGridCellCoords& coords )
1941 const wxGridCellCoordsArray GetSelectedCells() const;
1942 const wxGridCellCoordsArray GetSelectionBlockTopLeft() const;
1943 const wxGridCellCoordsArray GetSelectionBlockBottomRight() const;
1944 const wxArrayInt GetSelectedRows() const;
1945 const wxArrayInt GetSelectedCols() const;
1947 void DeselectRow( int row );
1948 void DeselectCol( int col );
1949 void DeselectCell( int row, int col );
1952 // This function returns the rectangle that encloses the block of cells
1953 // limited by TopLeft and BottomRight cell in device coords and clipped
1954 // to the client size of the grid window.
1956 wxRect BlockToDeviceRect( const wxGridCellCoords & topLeft,
1957 const wxGridCellCoords & bottomRight );
1960 // Access or update the selection fore/back colours
1961 wxColour GetSelectionBackground() const;
1962 wxColour GetSelectionForeground() const;
1964 void SetSelectionBackground(const wxColour& c);
1965 void SetSelectionForeground(const wxColour& c);
1968 // Methods for a registry for mapping data types to Renderers/Editors
1969 void RegisterDataType(const wxString& typeName,
1970 wxGridCellRenderer* renderer,
1971 wxGridCellEditor* editor);
1972 wxGridCellEditor* GetDefaultEditorForCell(int row, int col) const;
1973 // TODO: ??? wxGridCellEditor* GetDefaultEditorForCell(const wxGridCellCoords& c) const
1974 wxGridCellRenderer* GetDefaultRendererForCell(int row, int col) const;
1975 wxGridCellEditor* GetDefaultEditorForType(const wxString& typeName) const;
1976 wxGridCellRenderer* GetDefaultRendererForType(const wxString& typeName) const;
1978 // grid may occupy more space than needed for its rows/columns, this
1979 // function allows to set how big this extra space is
1980 void SetMargins(int extraWidth, int extraHeight);
1983 // Accessors for component windows
1984 wxWindow* GetGridWindow();
1985 wxWindow* GetGridRowLabelWindow();
1986 wxWindow* GetGridColLabelWindow();
1987 wxWindow* GetGridCornerLabelWindow();
1990 static wxVisualAttributes
1991 GetClassDefaultAttributes(wxWindowVariant variant = wxWINDOW_VARIANT_NORMAL);
1995 //---------------------------------------------------------------------------
1996 //---------------------------------------------------------------------------
1997 // Grid events and stuff
2001 class wxGridEvent : public wxNotifyEvent
2004 wxGridEvent(int id, wxEventType type, wxGrid* obj,
2005 int row=-1, int col=-1, int x=-1, int y=-1, bool sel = True,
2006 bool control=False, bool shift=False, bool alt=False, bool meta=False);
2008 virtual int GetRow();
2009 virtual int GetCol();
2010 wxPoint GetPosition();
2020 class wxGridSizeEvent : public wxNotifyEvent
2023 wxGridSizeEvent(int id, wxEventType type, wxGrid* obj,
2024 int rowOrCol=-1, int x=-1, int y=-1,
2025 bool control=False, bool shift=False, bool alt=False, bool meta=False);
2028 wxPoint GetPosition();
2037 class wxGridRangeSelectEvent : public wxNotifyEvent
2040 wxGridRangeSelectEvent(int id, wxEventType type, wxGrid* obj,
2041 const wxGridCellCoords& topLeft,
2042 const wxGridCellCoords& bottomRight,
2044 bool control=False, bool shift=False,
2045 bool alt=False, bool meta=False);
2047 wxGridCellCoords GetTopLeftCoords();
2048 wxGridCellCoords GetBottomRightCoords();
2061 class wxGridEditorCreatedEvent : public wxCommandEvent {
2063 wxGridEditorCreatedEvent(int id, wxEventType type, wxObject* obj,
2064 int row, int col, wxControl* ctrl);
2068 wxControl* GetControl();
2069 void SetRow(int row);
2070 void SetCol(int col);
2071 void SetControl(wxControl* ctrl);
2076 %constant wxEventType wxEVT_GRID_CELL_LEFT_CLICK;
2077 %constant wxEventType wxEVT_GRID_CELL_RIGHT_CLICK;
2078 %constant wxEventType wxEVT_GRID_CELL_LEFT_DCLICK;
2079 %constant wxEventType wxEVT_GRID_CELL_RIGHT_DCLICK;
2080 %constant wxEventType wxEVT_GRID_LABEL_LEFT_CLICK;
2081 %constant wxEventType wxEVT_GRID_LABEL_RIGHT_CLICK;
2082 %constant wxEventType wxEVT_GRID_LABEL_LEFT_DCLICK;
2083 %constant wxEventType wxEVT_GRID_LABEL_RIGHT_DCLICK;
2084 %constant wxEventType wxEVT_GRID_ROW_SIZE;
2085 %constant wxEventType wxEVT_GRID_COL_SIZE;
2086 %constant wxEventType wxEVT_GRID_RANGE_SELECT;
2087 %constant wxEventType wxEVT_GRID_CELL_CHANGE;
2088 %constant wxEventType wxEVT_GRID_SELECT_CELL;
2089 %constant wxEventType wxEVT_GRID_EDITOR_SHOWN;
2090 %constant wxEventType wxEVT_GRID_EDITOR_HIDDEN;
2091 %constant wxEventType wxEVT_GRID_EDITOR_CREATED;
2096 EVT_GRID_CELL_LEFT_CLICK = wx.PyEventBinder( wxEVT_GRID_CELL_LEFT_CLICK )
2097 EVT_GRID_CELL_RIGHT_CLICK = wx.PyEventBinder( wxEVT_GRID_CELL_RIGHT_CLICK )
2098 EVT_GRID_CELL_LEFT_DCLICK = wx.PyEventBinder( wxEVT_GRID_CELL_LEFT_DCLICK )
2099 EVT_GRID_CELL_RIGHT_DCLICK = wx.PyEventBinder( wxEVT_GRID_CELL_RIGHT_DCLICK )
2100 EVT_GRID_LABEL_LEFT_CLICK = wx.PyEventBinder( wxEVT_GRID_LABEL_LEFT_CLICK )
2101 EVT_GRID_LABEL_RIGHT_CLICK = wx.PyEventBinder( wxEVT_GRID_LABEL_RIGHT_CLICK )
2102 EVT_GRID_LABEL_LEFT_DCLICK = wx.PyEventBinder( wxEVT_GRID_LABEL_LEFT_DCLICK )
2103 EVT_GRID_LABEL_RIGHT_DCLICK = wx.PyEventBinder( wxEVT_GRID_LABEL_RIGHT_DCLICK )
2104 EVT_GRID_ROW_SIZE = wx.PyEventBinder( wxEVT_GRID_ROW_SIZE )
2105 EVT_GRID_COL_SIZE = wx.PyEventBinder( wxEVT_GRID_COL_SIZE )
2106 EVT_GRID_RANGE_SELECT = wx.PyEventBinder( wxEVT_GRID_RANGE_SELECT )
2107 EVT_GRID_CELL_CHANGE = wx.PyEventBinder( wxEVT_GRID_CELL_CHANGE )
2108 EVT_GRID_SELECT_CELL = wx.PyEventBinder( wxEVT_GRID_SELECT_CELL )
2109 EVT_GRID_EDITOR_SHOWN = wx.PyEventBinder( wxEVT_GRID_EDITOR_SHOWN )
2110 EVT_GRID_EDITOR_HIDDEN = wx.PyEventBinder( wxEVT_GRID_EDITOR_HIDDEN )
2111 EVT_GRID_EDITOR_CREATED = wx.PyEventBinder( wxEVT_GRID_EDITOR_CREATED )
2114 %# The same as above but with the ability to specify an identifier
2115 EVT_GRID_CMD_CELL_LEFT_CLICK = wx.PyEventBinder( wxEVT_GRID_CELL_LEFT_CLICK, 1 )
2116 EVT_GRID_CMD_CELL_RIGHT_CLICK = wx.PyEventBinder( wxEVT_GRID_CELL_RIGHT_CLICK, 1 )
2117 EVT_GRID_CMD_CELL_LEFT_DCLICK = wx.PyEventBinder( wxEVT_GRID_CELL_LEFT_DCLICK, 1 )
2118 EVT_GRID_CMD_CELL_RIGHT_DCLICK = wx.PyEventBinder( wxEVT_GRID_CELL_RIGHT_DCLICK, 1 )
2119 EVT_GRID_CMD_LABEL_LEFT_CLICK = wx.PyEventBinder( wxEVT_GRID_LABEL_LEFT_CLICK, 1 )
2120 EVT_GRID_CMD_LABEL_RIGHT_CLICK = wx.PyEventBinder( wxEVT_GRID_LABEL_RIGHT_CLICK, 1 )
2121 EVT_GRID_CMD_LABEL_LEFT_DCLICK = wx.PyEventBinder( wxEVT_GRID_LABEL_LEFT_DCLICK, 1 )
2122 EVT_GRID_CMD_LABEL_RIGHT_DCLICK = wx.PyEventBinder( wxEVT_GRID_LABEL_RIGHT_DCLICK, 1 )
2123 EVT_GRID_CMD_ROW_SIZE = wx.PyEventBinder( wxEVT_GRID_ROW_SIZE, 1 )
2124 EVT_GRID_CMD_COL_SIZE = wx.PyEventBinder( wxEVT_GRID_COL_SIZE, 1 )
2125 EVT_GRID_CMD_RANGE_SELECT = wx.PyEventBinder( wxEVT_GRID_RANGE_SELECT, 1 )
2126 EVT_GRID_CMD_CELL_CHANGE = wx.PyEventBinder( wxEVT_GRID_CELL_CHANGE, 1 )
2127 EVT_GRID_CMD_SELECT_CELL = wx.PyEventBinder( wxEVT_GRID_SELECT_CELL, 1 )
2128 EVT_GRID_CMD_EDITOR_SHOWN = wx.PyEventBinder( wxEVT_GRID_EDITOR_SHOWN, 1 )
2129 EVT_GRID_CMD_EDITOR_HIDDEN = wx.PyEventBinder( wxEVT_GRID_EDITOR_HIDDEN, 1 )
2130 EVT_GRID_CMD_EDITOR_CREATED = wx.PyEventBinder( wxEVT_GRID_EDITOR_CREATED, 1 )
2133 //---------------------------------------------------------------------------
2138 //---------------------------------------------------------------------------
2139 //---------------------------------------------------------------------------