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_WXSTRING_NOSWIG(DefaultDateTimeFormat);
44 //---------------------------------------------------------------------------
45 // OOR related typemaps and helper functions
47 %typemap(out) wxGridCellRenderer* { $result = wxPyMake_wxGridCellRenderer($1, (bool)$owner); }
48 %typemap(out) wxGridCellEditor* { $result = wxPyMake_wxGridCellEditor($1, (bool)$owner); }
49 %typemap(out) wxGridCellAttr* { $result = wxPyMake_wxGridCellAttr($1, (bool)$owner); }
50 %typemap(out) wxGridCellAttrProvider* { $result = wxPyMake_wxGridCellAttrProvider($1, (bool)$owner); }
51 %typemap(out) wxGridTableBase* { $result = wxPyMake_wxGridTableBase($1, (bool)$owner); }
56 #define wxPyMake_TEMPLATE(TYPE) \
57 PyObject* wxPyMake_##TYPE(TYPE* source, bool setThisOwn) { \
58 PyObject* target = NULL; \
60 /* Check if there is already a pointer to a Python object in the \
61 OOR data that we can use. */ \
62 wxPyOORClientData* data = (wxPyOORClientData*)source->GetClientObject(); \
64 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 wxPyBlock_t 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); \
120 #define PYCALLBACK__GCAINTINT(PCLASS, CBNAME) \
121 void CBNAME(wxGridCellAttr *attr, int a, int b) { \
122 wxPyBlock_t blocked = wxPyBeginBlockThreads(); \
124 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
125 PyObject* obj = wxPyMake_wxGridCellAttr(attr,false); \
126 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(Oii)", obj, a, b)); \
129 wxPyEndBlockThreads(blocked); \
131 PCLASS::CBNAME(attr, a, b); \
136 #define PYCALLBACK__GCAINT(PCLASS, CBNAME) \
137 void CBNAME(wxGridCellAttr *attr, int val) { \
138 wxPyBlock_t blocked = wxPyBeginBlockThreads(); \
140 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
141 PyObject* obj = wxPyMake_wxGridCellAttr(attr,false); \
142 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(Oi)", obj, val)); \
145 wxPyEndBlockThreads(blocked); \
147 PCLASS::CBNAME(attr, val); \
152 #define PYCALLBACK_INT__pure(CBNAME) \
154 wxPyBlock_t blocked = wxPyBeginBlockThreads(); \
156 if (wxPyCBH_findCallback(m_myInst, #CBNAME)) \
157 rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("()")); \
158 wxPyEndBlockThreads(blocked); \
164 #define PYCALLBACK_BOOL_INTINT_pure(CBNAME) \
165 bool CBNAME(int a, int b) { \
166 wxPyBlock_t blocked = wxPyBeginBlockThreads(); \
168 if (wxPyCBH_findCallback(m_myInst, #CBNAME)) \
169 rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(ii)",a,b)); \
170 wxPyEndBlockThreads(blocked); \
175 #define PYCALLBACK_STRING_INTINT_pure(CBNAME) \
176 wxString CBNAME(int a, int b) { \
177 wxPyBlock_t blocked = wxPyBeginBlockThreads(); \
179 if (wxPyCBH_findCallback(m_myInst, #CBNAME)) { \
181 ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("(ii)",a,b)); \
183 rval = Py2wxString(ro); \
187 wxPyEndBlockThreads(blocked); \
192 #define PYCALLBACK__INTINTSTRING_pure(CBNAME) \
193 void CBNAME(int a, int b, const wxString& c) { \
194 wxPyBlock_t blocked = wxPyBeginBlockThreads(); \
195 if (wxPyCBH_findCallback(m_myInst, #CBNAME)) { \
196 PyObject* s = wx2PyString(c); \
197 rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(iiO)",a,b,s));\
200 wxPyEndBlockThreads(blocked); \
204 #define PYCALLBACK_STRING_INTINT(PCLASS, CBNAME) \
205 wxString CBNAME(int a, int b) { \
207 wxPyBlock_t blocked = wxPyBeginBlockThreads(); \
209 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
211 ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("(ii)",a,b)); \
213 rval = Py2wxString(ro); \
217 wxPyEndBlockThreads(blocked); \
219 rval = PCLASS::CBNAME(a, b); \
224 #define PYCALLBACK_BOOL_INTINTSTRING(PCLASS, CBNAME) \
225 bool CBNAME(int a, int b, const wxString& c) { \
228 wxPyBlock_t blocked = wxPyBeginBlockThreads(); \
229 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
230 PyObject* s = wx2PyString(c); \
231 rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(iiO)",a,b,s));\
234 wxPyEndBlockThreads(blocked); \
236 rval = PCLASS::CBNAME(a,b,c); \
243 #define PYCALLBACK_LONG_INTINT(PCLASS, CBNAME) \
244 long CBNAME(int a, int b) { \
247 wxPyBlock_t blocked = wxPyBeginBlockThreads(); \
248 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \
249 rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(ii)", a,b)); \
250 wxPyEndBlockThreads(blocked); \
252 rval = PCLASS::CBNAME(a,b); \
257 #define PYCALLBACK_BOOL_INTINT(PCLASS, CBNAME) \
258 bool CBNAME(int a, int b) { \
261 wxPyBlock_t blocked = wxPyBeginBlockThreads(); \
262 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \
263 rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(ii)", a,b)); \
264 wxPyEndBlockThreads(blocked); \
266 rval = PCLASS::CBNAME(a,b); \
272 #define PYCALLBACK_DOUBLE_INTINT(PCLASS, CBNAME) \
273 double CBNAME(int a, int b) { \
275 wxPyBlock_t blocked = wxPyBeginBlockThreads(); \
277 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
279 ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("(ii)",a,b)); \
281 PyObject* str = PyObject_Str(ro); \
282 rval = PyFloat_AsDouble(str); \
283 Py_DECREF(ro); Py_DECREF(str); \
286 wxPyEndBlockThreads(blocked); \
288 rval = PCLASS::CBNAME(a, b); \
294 #define PYCALLBACK__(PCLASS, CBNAME) \
297 wxPyBlock_t blocked = wxPyBeginBlockThreads(); \
298 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \
299 wxPyCBH_callCallback(m_myInst, Py_BuildValue("()")); \
300 wxPyEndBlockThreads(blocked); \
307 #define PYCALLBACK_BOOL_SIZETSIZET(PCLASS, CBNAME) \
308 bool CBNAME(size_t a, size_t b) { \
311 wxPyBlock_t blocked = wxPyBeginBlockThreads(); \
312 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \
313 rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(ii)", a,b)); \
314 wxPyEndBlockThreads(blocked); \
316 rval = PCLASS::CBNAME(a,b); \
322 #define PYCALLBACK_BOOL_SIZET(PCLASS, CBNAME) \
323 bool CBNAME(size_t a) { \
326 wxPyBlock_t blocked = wxPyBeginBlockThreads(); \
327 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \
328 rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(i)", a)); \
329 wxPyEndBlockThreads(blocked); \
331 rval = PCLASS::CBNAME(a); \
336 #define PYCALLBACK_STRING_INT(PCLASS, CBNAME) \
337 wxString CBNAME(int a) { \
339 wxPyBlock_t blocked = wxPyBeginBlockThreads(); \
341 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
343 ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("(i)",a)); \
345 rval = Py2wxString(ro); \
349 wxPyEndBlockThreads(blocked); \
351 rval = PCLASS::CBNAME(a); \
356 #define PYCALLBACK__INTSTRING(PCLASS, CBNAME) \
357 void CBNAME(int a, const wxString& c) { \
359 wxPyBlock_t blocked = wxPyBeginBlockThreads(); \
360 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
361 PyObject* s = wx2PyString(c); \
362 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(iO)",a,s)); \
365 wxPyEndBlockThreads(blocked); \
367 PCLASS::CBNAME(a,c); \
373 #define PYCALLBACK_BOOL_(PCLASS, CBNAME) \
377 wxPyBlock_t blocked = wxPyBeginBlockThreads(); \
378 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \
379 rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("()")); \
380 wxPyEndBlockThreads(blocked); \
382 rval = PCLASS::CBNAME(); \
388 #define PYCALLBACK__SIZETINT(PCLASS, CBNAME) \
389 void CBNAME(size_t a, int b) { \
391 wxPyBlock_t blocked = wxPyBeginBlockThreads(); \
392 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \
393 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(ii)", a,b)); \
394 wxPyEndBlockThreads(blocked); \
396 PCLASS::CBNAME(a,b); \
402 #define PYCALLBACK__INTINTLONG(PCLASS, CBNAME) \
403 void CBNAME(int a, int b, long c) { \
405 wxPyBlock_t blocked = wxPyBeginBlockThreads(); \
406 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \
407 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(iii)", a,b,c)); \
408 wxPyEndBlockThreads(blocked); \
410 PCLASS::CBNAME(a,b,c); \
416 #define PYCALLBACK__INTINTDOUBLE(PCLASS, CBNAME) \
417 void CBNAME(int a, int b, double c) { \
419 wxPyBlock_t blocked = wxPyBeginBlockThreads(); \
420 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \
421 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(iif)", a,b,c)); \
422 wxPyEndBlockThreads(blocked); \
424 PCLASS::CBNAME(a,b,c); \
429 #define PYCALLBACK__INTINTBOOL(PCLASS, CBNAME) \
430 void CBNAME(int a, int b, bool c) { \
432 wxPyBlock_t blocked = wxPyBeginBlockThreads(); \
433 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \
434 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(iii)", a,b,c)); \
435 wxPyEndBlockThreads(blocked); \
437 PCLASS::CBNAME(a,b,c); \
444 //---------------------------------------------------------------------------
446 class wxGridCellCoords;
447 class wxGridCellAttr;
449 #define wxGRID_VALUE_STRING "string"
450 #define wxGRID_VALUE_BOOL "bool"
451 #define wxGRID_VALUE_NUMBER "long"
452 #define wxGRID_VALUE_FLOAT "double"
453 #define wxGRID_VALUE_CHOICE "choice"
454 #define wxGRID_VALUE_TEXT "string"
455 #define wxGRID_VALUE_LONG "long"
456 #define wxGRID_VALUE_CHOICEINT "choiceint"
457 #define wxGRID_VALUE_DATETIME "datetime"
461 const wxGridCellCoords wxGridNoCellCoords;
462 const wxRect wxGridNoCellRect;
467 #define wxGRID_DEFAULT_NUMBER_ROWS WXGRID_DEFAULT_NUMBER_ROWS
468 #define wxGRID_DEFAULT_NUMBER_COLS WXGRID_DEFAULT_NUMBER_COLS
469 #define wxGRID_DEFAULT_ROW_HEIGHT WXGRID_DEFAULT_ROW_HEIGHT
470 #define wxGRID_DEFAULT_COL_WIDTH WXGRID_DEFAULT_COL_WIDTH
471 #define wxGRID_DEFAULT_COL_LABEL_HEIGHT WXGRID_DEFAULT_COL_LABEL_HEIGHT
472 #define wxGRID_DEFAULT_ROW_LABEL_WIDTH WXGRID_DEFAULT_ROW_LABEL_WIDTH
473 #define wxGRID_LABEL_EDGE_ZONE WXGRID_LABEL_EDGE_ZONE
474 #define wxGRID_MIN_ROW_HEIGHT WXGRID_MIN_ROW_HEIGHT
475 #define wxGRID_MIN_COL_WIDTH WXGRID_MIN_COL_WIDTH
476 #define wxGRID_DEFAULT_SCROLLBAR_WIDTH WXGRID_DEFAULT_SCROLLBAR_WIDTH
480 wxGRID_DEFAULT_NUMBER_ROWS,
481 wxGRID_DEFAULT_NUMBER_COLS,
482 wxGRID_DEFAULT_ROW_HEIGHT,
483 wxGRID_DEFAULT_COL_WIDTH,
484 wxGRID_DEFAULT_COL_LABEL_HEIGHT,
485 wxGRID_DEFAULT_ROW_LABEL_WIDTH,
486 wxGRID_LABEL_EDGE_ZONE,
487 wxGRID_MIN_ROW_HEIGHT,
488 wxGRID_MIN_COL_WIDTH,
489 wxGRID_DEFAULT_SCROLLBAR_WIDTH
493 //---------------------------------------------------------------------------
495 // TODO: Use these to have SWIG automatically handle the IncRef/DecRef calls:
497 // %ref wxGridCellWorker "$this->IncRef();";
498 // %unref wxGridCellWorker "$this->DecRef();";
501 class wxGridCellWorker
505 void _setOORInfo(PyObject* _self) {
506 if (!self->GetClientObject())
507 self->SetClientObject(new wxPyOORClientData(_self));
510 // A dummy dtor to shut up SWIG. (The real one is protected and can
511 // only be called by DecRef)
512 ~wxGridCellWorker() {
516 void SetParameters(const wxString& params);
523 // wxGridCellRenderer is an ABC, and several derived classes are available.
524 // Classes implemented in Python should be derived from wxPyGridCellRenderer.
526 class wxGridCellRenderer : public wxGridCellWorker
528 virtual void Draw(wxGrid& grid,
529 wxGridCellAttr& attr,
534 virtual wxSize GetBestSize(wxGrid& grid,
535 wxGridCellAttr& attr,
538 virtual wxGridCellRenderer *Clone() const;
543 // The C++ version of wxPyGridCellRenderer
545 class wxPyGridCellRenderer : public wxGridCellRenderer
548 wxPyGridCellRenderer() : wxGridCellRenderer() {};
550 // Implement Python callback aware virtual methods
551 void Draw(wxGrid& grid, wxGridCellAttr& attr,
552 wxDC& dc, const wxRect& rect,
553 int row, int col, bool isSelected) {
554 wxPyBlock_t blocked = wxPyBeginBlockThreads();
555 if (wxPyCBH_findCallback(m_myInst, "Draw")) {
556 PyObject* go = wxPyMake_wxObject(&grid,false);
557 PyObject* dco = wxPyMake_wxObject(&dc,false);
558 PyObject* ao = wxPyMake_wxGridCellAttr(&attr,false);
559 PyObject* ro = wxPyConstructObject((void*)&rect, wxT("wxRect"), 0);
561 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(OOOOiii)", go, ao, dco, ro,
562 row, col, isSelected));
568 wxPyEndBlockThreads(blocked);
571 wxSize GetBestSize(wxGrid& grid, wxGridCellAttr& attr, wxDC& dc,
574 wxPyBlock_t blocked = wxPyBeginBlockThreads();
575 if (wxPyCBH_findCallback(m_myInst, "GetBestSize")) {
578 PyObject* go = wxPyMake_wxObject(&grid,false);
579 PyObject* dco = wxPyMake_wxObject(&dc,false);
580 PyObject* ao = wxPyMake_wxGridCellAttr(&attr,false);
582 ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("(OOOii)",
590 const char* errmsg = "GetBestSize should return a 2-tuple of integers or a wxSize object.";
591 if (wxPyConvertSwigPtr(ro, (void **)&ptr, wxT("wxSize"))) {
594 else if (PySequence_Check(ro) && PyObject_Length(ro) == 2) {
595 PyObject* o1 = PySequence_GetItem(ro, 0);
596 PyObject* o2 = PySequence_GetItem(ro, 1);
597 if (PyNumber_Check(o1) && PyNumber_Check(o2))
598 rval = wxSize(PyInt_AsLong(o1), PyInt_AsLong(o2));
600 PyErr_SetString(PyExc_TypeError, errmsg);
605 PyErr_SetString(PyExc_TypeError, errmsg);
610 wxPyEndBlockThreads(blocked);
615 wxGridCellRenderer *Clone() const {
616 wxGridCellRenderer* rval = NULL;
617 wxPyBlock_t blocked = wxPyBeginBlockThreads();
618 if (wxPyCBH_findCallback(m_myInst, "Clone")) {
620 wxGridCellRenderer* ptr;
621 ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("()"));
623 if (wxPyConvertSwigPtr(ro, (void **)&ptr, wxT("wxGridCellRenderer")))
628 wxPyEndBlockThreads(blocked);
632 DEC_PYCALLBACK__STRING(SetParameters);
637 IMP_PYCALLBACK__STRING( wxPyGridCellRenderer, wxGridCellRenderer, SetParameters);
642 // Let SWIG know about it so it can create the Python version
643 class wxPyGridCellRenderer : public wxGridCellRenderer {
645 %pythonAppend wxPyGridCellRenderer "self._setCallbackInfo(self, PyGridCellRenderer);self._setOORInfo(self)"
647 wxPyGridCellRenderer();
648 void _setCallbackInfo(PyObject* self, PyObject* _class);
650 void SetParameters(const wxString& params);
651 %MAKE_BASE_FUNC(PyGridCellRenderer, SetParameters);
654 //---------------------------------------------------------------------------
655 // Predefined Renderers
657 class wxGridCellStringRenderer : public wxGridCellRenderer
660 %pythonAppend wxGridCellStringRenderer "self._setOORInfo(self)"
661 wxGridCellStringRenderer();
665 class wxGridCellNumberRenderer : public wxGridCellStringRenderer
668 %pythonAppend wxGridCellNumberRenderer "self._setOORInfo(self)"
669 wxGridCellNumberRenderer();
673 class wxGridCellFloatRenderer : public wxGridCellStringRenderer
676 %pythonAppend wxGridCellFloatRenderer "self._setOORInfo(self)"
677 wxGridCellFloatRenderer(int width = -1, int precision = -1);
679 int GetWidth() const;
680 void SetWidth(int width);
681 int GetPrecision() const;
682 void SetPrecision(int precision);
686 class wxGridCellBoolRenderer : public wxGridCellRenderer
689 %pythonAppend wxGridCellBoolRenderer "self._setOORInfo(self)"
690 wxGridCellBoolRenderer();
694 class wxGridCellDateTimeRenderer : public wxGridCellStringRenderer
697 %pythonAppend wxGridCellDateTimeRenderer "self._setOORInfo(self)"
698 wxGridCellDateTimeRenderer(wxString outformat = wxPyDefaultDateTimeFormat,
699 wxString informat = wxPyDefaultDateTimeFormat);
703 class wxGridCellEnumRenderer : public wxGridCellStringRenderer
706 %pythonAppend wxGridCellEnumRenderer "self._setOORInfo(self)"
707 wxGridCellEnumRenderer( const wxString& choices = wxPyEmptyString );
711 class wxGridCellAutoWrapStringRenderer : public wxGridCellStringRenderer
714 %pythonAppend wxGridCellAutoWrapStringRenderer "self._setOORInfo(self)"
715 wxGridCellAutoWrapStringRenderer();
719 //---------------------------------------------------------------------------
720 // wxGridCellEditor is an ABC, and several derived classes are available.
721 // Classes implemented in Python should be derived from wxPyGridCellEditor.
723 class wxGridCellEditor : public wxGridCellWorker
727 wxControl* GetControl();
728 void SetControl(wxControl* control);
730 wxGridCellAttr* GetCellAttr();
731 void SetCellAttr(wxGridCellAttr* attr);
733 virtual void Create(wxWindow* parent,
735 wxEvtHandler* evtHandler);
736 virtual void BeginEdit(int row, int col, wxGrid* grid);
737 virtual bool EndEdit(int row, int col, wxGrid* grid);
738 virtual void Reset();
739 virtual wxGridCellEditor *Clone() const;
741 virtual void SetSize(const wxRect& rect);
742 virtual void Show(bool show, wxGridCellAttr *attr = NULL);
743 virtual void PaintBackground(const wxRect& rectCell, wxGridCellAttr *attr);
744 virtual bool IsAcceptedKey(wxKeyEvent& event);
745 virtual void StartingKey(wxKeyEvent& event);
746 virtual void StartingClick();
747 virtual void HandleReturn(wxKeyEvent& event);
749 %pythonAppend Destroy "args[0].thisown = 0"
750 virtual void Destroy();
755 // The C++ version of wxPyGridCellEditor
757 class wxPyGridCellEditor : public wxGridCellEditor
760 wxPyGridCellEditor() : wxGridCellEditor() {}
762 void Create(wxWindow* parent, wxWindowID id, wxEvtHandler* evtHandler) {
763 wxPyBlock_t blocked = wxPyBeginBlockThreads();
764 if (wxPyCBH_findCallback(m_myInst, "Create")) {
765 PyObject* po = wxPyMake_wxObject(parent,false);
766 PyObject* eo = wxPyMake_wxObject(evtHandler,false);
768 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(OiO)", po, id, eo));
772 wxPyEndBlockThreads(blocked);
776 void BeginEdit(int row, int col, wxGrid* grid) {
777 wxPyBlock_t blocked = wxPyBeginBlockThreads();
778 if (wxPyCBH_findCallback(m_myInst, "BeginEdit")) {
779 PyObject* go = wxPyMake_wxObject(grid,false);
780 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(iiO)", row, col, go));
783 wxPyEndBlockThreads(blocked);
787 bool EndEdit(int row, int col, wxGrid* grid) {
789 wxPyBlock_t blocked = wxPyBeginBlockThreads();
790 if (wxPyCBH_findCallback(m_myInst, "EndEdit")) {
791 PyObject* go = wxPyMake_wxObject(grid,false);
792 rv = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(iiO)", row, col, go));
795 wxPyEndBlockThreads(blocked);
800 wxGridCellEditor* Clone() const {
801 wxGridCellEditor* rval = NULL;
802 wxPyBlock_t blocked = wxPyBeginBlockThreads();
803 if (wxPyCBH_findCallback(m_myInst, "Clone")) {
805 wxGridCellEditor* ptr;
806 ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("()"));
808 if (wxPyConvertSwigPtr(ro, (void **)&ptr, wxT("wxGridCellEditor")))
813 wxPyEndBlockThreads(blocked);
818 void Show(bool show, wxGridCellAttr *attr) {
820 wxPyBlock_t blocked = wxPyBeginBlockThreads();
821 if ((found = wxPyCBH_findCallback(m_myInst, "Show"))) {
822 PyObject* ao = wxPyMake_wxGridCellAttr(attr,false);
823 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(iO)", show, ao));
826 wxPyEndBlockThreads(blocked);
828 wxGridCellEditor::Show(show, attr);
832 void PaintBackground(const wxRect& rectCell, wxGridCellAttr *attr) {
834 wxPyBlock_t blocked = wxPyBeginBlockThreads();
835 if ((found = wxPyCBH_findCallback(m_myInst, "PaintBackground)"))) {
836 PyObject* ao = wxPyMake_wxGridCellAttr(attr,false);
837 PyObject* ro = wxPyConstructObject((void*)&rectCell, wxT("wxRect"), 0);
839 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(OO)", ro, ao));
844 wxPyEndBlockThreads(blocked);
846 wxGridCellEditor::PaintBackground(rectCell, attr);
850 DEC_PYCALLBACK___pure(Reset);
851 DEC_PYCALLBACK__constany(SetSize, wxRect);
852 DEC_PYCALLBACK_bool_any(IsAcceptedKey, wxKeyEvent);
853 DEC_PYCALLBACK__any(StartingKey, wxKeyEvent);
854 DEC_PYCALLBACK__any(HandleReturn, wxKeyEvent);
855 DEC_PYCALLBACK__(StartingClick);
856 DEC_PYCALLBACK__(Destroy);
857 DEC_PYCALLBACK__STRING(SetParameters);
858 DEC_PYCALLBACK_STRING__constpure(GetValue);
864 IMP_PYCALLBACK__STRING( wxPyGridCellEditor, wxGridCellEditor, SetParameters);
865 IMP_PYCALLBACK___pure(wxPyGridCellEditor, wxGridCellEditor, Reset);
866 IMP_PYCALLBACK__constany(wxPyGridCellEditor, wxGridCellEditor, SetSize, wxRect);
867 IMP_PYCALLBACK_bool_any(wxPyGridCellEditor, wxGridCellEditor, IsAcceptedKey, wxKeyEvent);
868 IMP_PYCALLBACK__any(wxPyGridCellEditor, wxGridCellEditor, StartingKey, wxKeyEvent);
869 IMP_PYCALLBACK__any(wxPyGridCellEditor, wxGridCellEditor, HandleReturn, wxKeyEvent);
870 IMP_PYCALLBACK__(wxPyGridCellEditor, wxGridCellEditor, StartingClick);
871 IMP_PYCALLBACK__(wxPyGridCellEditor, wxGridCellEditor, Destroy);
872 IMP_PYCALLBACK_STRING__constpure(wxPyGridCellEditor, wxGridCellEditor, GetValue);
877 // Let SWIG know about it so it can create the Python version
878 class wxPyGridCellEditor : public wxGridCellEditor {
880 %pythonAppend wxPyGridCellEditor "self._setCallbackInfo(self, PyGridCellEditor);self._setOORInfo(self)"
882 wxPyGridCellEditor();
883 void _setCallbackInfo(PyObject* self, PyObject* _class);
885 void SetSize(const wxRect& rect);
886 void Show(bool show, wxGridCellAttr *attr = NULL);
887 void PaintBackground(const wxRect& rectCell, wxGridCellAttr *attr);
888 bool IsAcceptedKey(wxKeyEvent& event);
889 void StartingKey(wxKeyEvent& event);
890 void StartingClick();
891 void HandleReturn(wxKeyEvent& event);
893 void SetParameters(const wxString& params);
895 %MAKE_BASE_FUNC(PyGridCellEditor, SetSize);
896 %MAKE_BASE_FUNC(PyGridCellEditor, Show);
897 %MAKE_BASE_FUNC(PyGridCellEditor, PaintBackground);
898 %MAKE_BASE_FUNC(PyGridCellEditor, IsAcceptedKey);
899 %MAKE_BASE_FUNC(PyGridCellEditor, StartingKey);
900 %MAKE_BASE_FUNC(PyGridCellEditor, StartingClick);
901 %MAKE_BASE_FUNC(PyGridCellEditor, HandleReturn);
902 %MAKE_BASE_FUNC(PyGridCellEditor, Destroy);
903 %MAKE_BASE_FUNC(PyGridCellEditor, SetParameters);
906 //---------------------------------------------------------------------------
907 // Predefined Editors
909 class wxGridCellTextEditor : public wxGridCellEditor
912 %pythonAppend wxGridCellTextEditor "self._setOORInfo(self)"
913 wxGridCellTextEditor();
914 virtual wxString GetValue();
918 class wxGridCellNumberEditor : public wxGridCellTextEditor
921 %pythonAppend wxGridCellNumberEditor "self._setOORInfo(self)"
922 wxGridCellNumberEditor(int min = -1, int max = -1);
923 virtual wxString GetValue();
927 class wxGridCellFloatEditor : public wxGridCellTextEditor
930 %pythonAppend wxGridCellFloatEditor "self._setOORInfo(self)"
931 wxGridCellFloatEditor(int width = -1, int precision = -1);
932 virtual wxString GetValue();
936 class wxGridCellBoolEditor : public wxGridCellEditor
939 %pythonAppend wxGridCellBoolEditor "self._setOORInfo(self)"
940 wxGridCellBoolEditor();
941 virtual wxString GetValue();
944 class wxGridCellChoiceEditor : public wxGridCellEditor
947 %pythonAppend wxGridCellChoiceEditor "self._setOORInfo(self)"
948 wxGridCellChoiceEditor(int choices = 0,
949 const wxString* choices_array = NULL,
950 bool allowOthers = false);
951 virtual wxString GetValue();
955 class wxGridCellEnumEditor : public wxGridCellChoiceEditor
958 %pythonAppend wxGridCellEnumEditor "self._setOORInfo(self)"
959 wxGridCellEnumEditor( const wxString& choices = wxPyEmptyString );
960 virtual wxString GetValue();
964 class wxGridCellAutoWrapStringEditor : public wxGridCellTextEditor
967 %pythonAppend wxGridCellAutoWrapStringEditor "self._setOORInfo(self)"
968 wxGridCellAutoWrapStringEditor();
969 virtual wxString GetValue();
974 //---------------------------------------------------------------------------
991 void _setOORInfo(PyObject* _self) {
992 if (!self->GetClientObject())
993 self->SetClientObject(new wxPyOORClientData(_self));
997 %pythonAppend wxGridCellAttr "self._setOORInfo(self)"
999 wxGridCellAttr(wxGridCellAttr *attrDefault = NULL);
1002 // A dummy dtor to shut up SWIG. (The real one is protected and can
1003 // only be called by DecRef)
1008 wxGridCellAttr *Clone() const;
1009 void MergeWith(wxGridCellAttr *mergefrom);
1014 void SetTextColour(const wxColour& colText);
1015 void SetBackgroundColour(const wxColour& colBack);
1016 void SetFont(const wxFont& font);
1017 void SetAlignment(int hAlign, int vAlign);
1018 void SetSize(int num_rows, int num_cols);
1019 void SetOverflow( bool allow = true );
1020 void SetReadOnly(bool isReadOnly = true);
1022 void SetRenderer(wxGridCellRenderer *renderer);
1023 void SetEditor(wxGridCellEditor* editor);
1024 void SetKind(wxAttrKind kind);
1026 bool HasTextColour() const;
1027 bool HasBackgroundColour() const;
1028 bool HasFont() const;
1029 bool HasAlignment() const;
1030 bool HasRenderer() const;
1031 bool HasEditor() const;
1032 bool HasReadWriteMode() const;
1033 bool HasOverflowMode() const;
1035 wxColour GetTextColour() const;
1036 wxColour GetBackgroundColour() const;
1037 wxFont GetFont() const;
1040 void, GetAlignment(int *OUTPUT, int *OUTPUT) const,
1041 "GetAlignment() -> (hAlign, vAlign)");
1044 void, GetSize(int *OUTPUT, int *OUTPUT) const,
1045 "GetSize() -> (num_rows, num_cols)");
1047 bool GetOverflow() const;
1048 wxGridCellRenderer *GetRenderer(wxGrid* grid, int row, int col) const;
1049 wxGridCellEditor *GetEditor(wxGrid* grid, int row, int col) const;
1051 bool IsReadOnly() const;
1052 wxAttrKind GetKind();
1053 void SetDefAttr(wxGridCellAttr* defAttr);
1056 //---------------------------------------------------------------------------
1058 class wxGridCellAttrProvider
1061 %pythonAppend wxGridCellAttrProvider "self._setOORInfo(self)"
1062 wxGridCellAttrProvider();
1063 // ???? virtual ~wxGridCellAttrProvider();
1066 void _setOORInfo(PyObject* _self) {
1067 if (!self->GetClientObject())
1068 self->SetClientObject(new wxPyOORClientData(_self));
1072 wxGridCellAttr *GetAttr(int row, int col,
1073 wxGridCellAttr::wxAttrKind kind) const;
1074 void SetAttr(wxGridCellAttr *attr, int row, int col);
1075 void SetRowAttr(wxGridCellAttr *attr, int row);
1076 void SetColAttr(wxGridCellAttr *attr, int col);
1078 void UpdateAttrRows( size_t pos, int numRows );
1079 void UpdateAttrCols( size_t pos, int numCols );
1084 // A Python-aware version
1086 class wxPyGridCellAttrProvider : public wxGridCellAttrProvider
1089 wxPyGridCellAttrProvider() : wxGridCellAttrProvider() {};
1091 PYCALLBACK_GCA_INTINTKIND(wxGridCellAttrProvider, GetAttr);
1092 PYCALLBACK__GCAINTINT(wxGridCellAttrProvider, SetAttr);
1093 PYCALLBACK__GCAINT(wxGridCellAttrProvider, SetRowAttr);
1094 PYCALLBACK__GCAINT(wxGridCellAttrProvider, SetColAttr);
1101 // The python-aware version get's SWIGified
1102 class wxPyGridCellAttrProvider : public wxGridCellAttrProvider
1105 %pythonAppend wxPyGridCellAttrProvider "self._setCallbackInfo(self, PyGridCellAttrProvider)"
1106 wxPyGridCellAttrProvider();
1107 void _setCallbackInfo(PyObject* self, PyObject* _class);
1109 wxGridCellAttr *GetAttr(int row, int col,
1110 wxGridCellAttr::wxAttrKind kind);
1111 void SetAttr(wxGridCellAttr *attr, int row, int col);
1112 void SetRowAttr(wxGridCellAttr *attr, int row);
1113 void SetColAttr(wxGridCellAttr *attr, int col);
1115 %MAKE_BASE_FUNC(PyGridCellAttrProvider, GetAttr);
1116 %MAKE_BASE_FUNC(PyGridCellAttrProvider, SetAttr);
1117 %MAKE_BASE_FUNC(PyGridCellAttrProvider, SetRowAttr);
1118 %MAKE_BASE_FUNC(PyGridCellAttrProvider, SetColAttr);
1122 //---------------------------------------------------------------------------
1123 // Grid Table Base class and Python aware version
1126 class wxGridTableBase : public wxObject
1129 // wxGridTableBase(); This is an ABC
1133 void _setOORInfo(PyObject* _self) {
1134 if (!self->GetClientObject())
1135 self->SetClientObject(new wxPyOORClientData(_self));
1139 void SetAttrProvider(wxGridCellAttrProvider *attrProvider);
1140 wxGridCellAttrProvider *GetAttrProvider() const;
1141 void SetView( wxGrid *grid );
1142 wxGrid * GetView() const;
1146 virtual int GetNumberRows();
1147 virtual int GetNumberCols();
1148 virtual bool IsEmptyCell( int row, int col );
1149 virtual wxString GetValue( int row, int col );
1150 virtual void SetValue( int row, int col, const wxString& value );
1152 // virtuals overridable in wxPyGridTableBase
1153 virtual wxString GetTypeName( int row, int col );
1154 virtual bool CanGetValueAs( int row, int col, const wxString& typeName );
1155 virtual bool CanSetValueAs( int row, int col, const wxString& typeName );
1156 virtual long GetValueAsLong( int row, int col );
1157 virtual double GetValueAsDouble( int row, int col );
1158 virtual bool GetValueAsBool( int row, int col );
1159 virtual void SetValueAsLong( int row, int col, long value );
1160 virtual void SetValueAsDouble( int row, int col, double value );
1161 virtual void SetValueAsBool( int row, int col, bool value );
1163 //virtual void* GetValueAsCustom( int row, int col, const wxString& typeName );
1164 //virtual void SetValueAsCustom( int row, int col, const wxString& typeName, void* value );
1167 virtual void Clear();
1168 virtual bool InsertRows( size_t pos = 0, size_t numRows = 1 );
1169 virtual bool AppendRows( size_t numRows = 1 );
1170 virtual bool DeleteRows( size_t pos = 0, size_t numRows = 1 );
1171 virtual bool InsertCols( size_t pos = 0, size_t numCols = 1 );
1172 virtual bool AppendCols( size_t numCols = 1 );
1173 virtual bool DeleteCols( size_t pos = 0, size_t numCols = 1 );
1175 virtual wxString GetRowLabelValue( int row );
1176 virtual wxString GetColLabelValue( int col );
1177 virtual void SetRowLabelValue( int row, const wxString& value );
1178 virtual void SetColLabelValue( int col, const wxString& value );
1180 virtual bool CanHaveAttributes();
1182 virtual wxGridCellAttr *GetAttr( int row, int col,
1183 wxGridCellAttr::wxAttrKind kind);
1184 virtual void SetAttr(wxGridCellAttr* attr, int row, int col);
1185 virtual void SetRowAttr(wxGridCellAttr *attr, int row);
1186 virtual void SetColAttr(wxGridCellAttr *attr, int col);
1192 // Python-aware version
1194 class wxPyGridTableBase : public wxGridTableBase
1197 wxPyGridTableBase() : wxGridTableBase() {}
1199 PYCALLBACK_INT__pure(GetNumberRows);
1200 PYCALLBACK_INT__pure(GetNumberCols);
1201 PYCALLBACK_BOOL_INTINT_pure(IsEmptyCell);
1202 PYCALLBACK_STRING_INTINT(wxGridTableBase, GetTypeName);
1203 PYCALLBACK_BOOL_INTINTSTRING(wxGridTableBase, CanGetValueAs);
1204 PYCALLBACK_BOOL_INTINTSTRING(wxGridTableBase, CanSetValueAs);
1205 PYCALLBACK__(wxGridTableBase, Clear);
1206 PYCALLBACK_BOOL_SIZETSIZET(wxGridTableBase, InsertRows);
1207 PYCALLBACK_BOOL_SIZETSIZET(wxGridTableBase, DeleteRows);
1208 PYCALLBACK_BOOL_SIZETSIZET(wxGridTableBase, InsertCols);
1209 PYCALLBACK_BOOL_SIZETSIZET(wxGridTableBase, DeleteCols);
1210 PYCALLBACK_BOOL_SIZET(wxGridTableBase, AppendRows);
1211 PYCALLBACK_BOOL_SIZET(wxGridTableBase, AppendCols);
1212 PYCALLBACK_STRING_INT(wxGridTableBase, GetRowLabelValue);
1213 PYCALLBACK_STRING_INT(wxGridTableBase, GetColLabelValue);
1214 PYCALLBACK__INTSTRING(wxGridTableBase, SetRowLabelValue);
1215 PYCALLBACK__INTSTRING(wxGridTableBase, SetColLabelValue);
1216 PYCALLBACK_BOOL_(wxGridTableBase, CanHaveAttributes);
1217 PYCALLBACK_GCA_INTINTKIND(wxGridTableBase, GetAttr);
1218 PYCALLBACK__GCAINTINT(wxGridTableBase, SetAttr);
1219 PYCALLBACK__GCAINT(wxGridTableBase, SetRowAttr);
1220 PYCALLBACK__GCAINT(wxGridTableBase, SetColAttr);
1223 wxString GetValue(int row, int col) {
1224 wxPyBlock_t blocked = wxPyBeginBlockThreads();
1226 if (wxPyCBH_findCallback(m_myInst, "GetValue")) {
1228 ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("(ii)",row,col));
1230 if (!PyString_Check(ro) && !PyUnicode_Check(ro)) {
1232 ro = PyObject_Str(ro);
1235 rval = Py2wxString(ro);
1239 wxPyEndBlockThreads(blocked);
1243 void SetValue(int row, int col, const wxString& val) {
1244 wxPyBlock_t blocked = wxPyBeginBlockThreads();
1245 if (wxPyCBH_findCallback(m_myInst, "SetValue")) {
1246 PyObject* s = wx2PyString(val);
1247 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(iiO)",row,col,s));
1250 wxPyEndBlockThreads(blocked);
1254 // Map the Get/Set methods for the standard non-string types to
1255 // the GetValue and SetValue python methods.
1256 long GetValueAsLong( int row, int col ) {
1258 wxPyBlock_t blocked = wxPyBeginBlockThreads();
1259 if (wxPyCBH_findCallback(m_myInst, "GetValue")) {
1262 ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("(ii)", row, col));
1263 if (ro && PyNumber_Check(ro)) {
1264 num = PyNumber_Int(ro);
1266 rval = PyInt_AsLong(num);
1272 wxPyEndBlockThreads(blocked);
1276 double GetValueAsDouble( int row, int col ) {
1278 wxPyBlock_t blocked = wxPyBeginBlockThreads();
1279 if (wxPyCBH_findCallback(m_myInst, "GetValue")) {
1282 ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("(ii)", row, col));
1283 if (ro && PyNumber_Check(ro)) {
1284 num = PyNumber_Float(ro);
1286 rval = PyFloat_AsDouble(num);
1292 wxPyEndBlockThreads(blocked);
1296 bool GetValueAsBool( int row, int col ) {
1297 return (bool)GetValueAsLong(row, col);
1300 void SetValueAsLong( int row, int col, long value ) {
1301 wxPyBlock_t blocked = wxPyBeginBlockThreads();
1302 if (wxPyCBH_findCallback(m_myInst, "SetValue")) {
1303 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(iii)", row, col, value));
1305 wxPyEndBlockThreads(blocked);
1308 void SetValueAsDouble( int row, int col, double value ) {
1309 wxPyBlock_t blocked = wxPyBeginBlockThreads();
1310 if (wxPyCBH_findCallback(m_myInst, "SetValue")) {
1311 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(iid)", row, col, value));
1313 wxPyEndBlockThreads(blocked);
1316 void SetValueAsBool( int row, int col, bool value ) {
1317 SetValueAsLong( row, col, (long)value );
1326 // The python-aware version get's SWIGified
1327 class wxPyGridTableBase : public wxGridTableBase
1330 %pythonAppend wxPyGridTableBase "self._setCallbackInfo(self, PyGridTableBase);self._setOORInfo(self)"
1331 wxPyGridTableBase();
1332 void _setCallbackInfo(PyObject* self, PyObject* _class);
1334 %pythonAppend Destroy "args[0].thisown = 0"
1335 %extend { void Destroy() { delete self; } }
1337 wxString GetTypeName( int row, int col );
1338 bool CanGetValueAs( int row, int col, const wxString& typeName );
1339 bool CanSetValueAs( int row, int col, const wxString& typeName );
1341 bool InsertRows( size_t pos = 0, size_t numRows = 1 );
1342 bool AppendRows( size_t numRows = 1 );
1343 bool DeleteRows( size_t pos = 0, size_t numRows = 1 );
1344 bool InsertCols( size_t pos = 0, size_t numCols = 1 );
1345 bool AppendCols( size_t numCols = 1 );
1346 bool DeleteCols( size_t pos = 0, size_t numCols = 1 );
1347 wxString GetRowLabelValue( int row );
1348 wxString GetColLabelValue( int col );
1349 void SetRowLabelValue( int row, const wxString& value );
1350 void SetColLabelValue( int col, const wxString& value );
1351 bool CanHaveAttributes();
1352 wxGridCellAttr *GetAttr( int row, int col,
1353 wxGridCellAttr::wxAttrKind kind );
1354 void SetAttr(wxGridCellAttr* attr, int row, int col);
1355 void SetRowAttr(wxGridCellAttr *attr, int row);
1356 void SetColAttr(wxGridCellAttr *attr, int col);
1358 %MAKE_BASE_FUNC(PyGridTableBase, GetTypeName);
1359 %MAKE_BASE_FUNC(PyGridTableBase, CanGetValueAs);
1360 %MAKE_BASE_FUNC(PyGridTableBase, CanSetValueAs);
1361 %MAKE_BASE_FUNC(PyGridTableBase, Clear);
1362 %MAKE_BASE_FUNC(PyGridTableBase, InsertRows);
1363 %MAKE_BASE_FUNC(PyGridTableBase, AppendRows);
1364 %MAKE_BASE_FUNC(PyGridTableBase, DeleteRows);
1365 %MAKE_BASE_FUNC(PyGridTableBase, InsertCols);
1366 %MAKE_BASE_FUNC(PyGridTableBase, AppendCols);
1367 %MAKE_BASE_FUNC(PyGridTableBase, DeleteCols);
1368 %MAKE_BASE_FUNC(PyGridTableBase, GetRowLabelValue);
1369 %MAKE_BASE_FUNC(PyGridTableBase, GetColLabelValue);
1370 %MAKE_BASE_FUNC(PyGridTableBase, SetRowLabelValue);
1371 %MAKE_BASE_FUNC(PyGridTableBase, SetColLabelValue);
1372 %MAKE_BASE_FUNC(PyGridTableBase, CanHaveAttributes);
1373 %MAKE_BASE_FUNC(PyGridTableBase, GetAttr);
1374 %MAKE_BASE_FUNC(PyGridTableBase, SetAttr);
1375 %MAKE_BASE_FUNC(PyGridTableBase, SetRowAttr);
1376 %MAKE_BASE_FUNC(PyGridTableBase, SetColAttr);
1380 //---------------------------------------------------------------------------
1381 // Predefined Tables
1383 class wxGridStringTable : public wxGridTableBase
1386 %pythonAppend wxGridStringTable "self._setOORInfo(self)"
1387 wxGridStringTable( int numRows=0, int numCols=0 );
1390 //---------------------------------------------------------------------------
1391 // The Table can pass messages to the grid to tell it to update itself if
1392 // something has changed.
1394 enum wxGridTableRequest
1396 wxGRIDTABLE_REQUEST_VIEW_GET_VALUES = 2000,
1397 wxGRIDTABLE_REQUEST_VIEW_SEND_VALUES,
1398 wxGRIDTABLE_NOTIFY_ROWS_INSERTED,
1399 wxGRIDTABLE_NOTIFY_ROWS_APPENDED,
1400 wxGRIDTABLE_NOTIFY_ROWS_DELETED,
1401 wxGRIDTABLE_NOTIFY_COLS_INSERTED,
1402 wxGRIDTABLE_NOTIFY_COLS_APPENDED,
1403 wxGRIDTABLE_NOTIFY_COLS_DELETED
1407 class wxGridTableMessage
1410 wxGridTableMessage( wxGridTableBase *table, int id,
1413 ~wxGridTableMessage();
1415 void SetTableObject( wxGridTableBase *table );
1416 wxGridTableBase * GetTableObject() const;
1417 void SetId( int id );
1419 void SetCommandInt( int comInt1 );
1420 int GetCommandInt();
1421 void SetCommandInt2( int comInt2 );
1422 int GetCommandInt2();
1426 //---------------------------------------------------------------------------
1429 // Typemap to allow conversion of sequence objects to wxGridCellCoords...
1430 %typemap(in) wxGridCellCoords& (wxGridCellCoords temp) {
1432 if (! wxGridCellCoords_helper($input, &$1)) SWIG_fail;
1434 %typemap(typecheck, precedence=SWIG_TYPECHECK_POINTER) wxGridCellCoords& {
1435 $1 = wxGridCellCoords_typecheck($input);
1439 // ...and here is the associated helper.
1441 bool wxGridCellCoords_helper(PyObject* source, wxGridCellCoords** obj) {
1443 if (source == Py_None) {
1444 **obj = wxGridCellCoords(-1,-1);
1448 // If source is an object instance then it may already be the right type
1449 if (wxPySwigInstance_Check(source)) {
1450 wxGridCellCoords* ptr;
1451 if (! wxPyConvertSwigPtr(source, (void **)&ptr, wxT("wxGridCellCoords")))
1456 // otherwise a 2-tuple of integers is expected
1457 else if (PySequence_Check(source) && PyObject_Length(source) == 2) {
1458 PyObject* o1 = PySequence_GetItem(source, 0);
1459 PyObject* o2 = PySequence_GetItem(source, 1);
1460 if (!PyNumber_Check(o1) || !PyNumber_Check(o2)) {
1465 **obj = wxGridCellCoords(PyInt_AsLong(o1), PyInt_AsLong(o2));
1472 PyErr_SetString(PyExc_TypeError, "Expected a 2-tuple of integers or a wxGridCellCoords object.");
1477 bool wxGridCellCoords_typecheck(PyObject* source) {
1480 if (wxPySwigInstance_Check(source) &&
1481 wxPyConvertSwigPtr(source, (void **)&ptr, wxT("wxGridCellCoords")))
1485 if (PySequence_Check(source) && PySequence_Length(source) == 2)
1493 // Typemap to convert an array of cells coords to a list of tuples...
1494 %typemap(out) wxGridCellCoordsArray {
1495 $result = wxGridCellCoordsArray_helper($1);
1498 // %typemap(ret) wxGridCellCoordsArray {
1503 // ...and the helper function for the above typemap.
1505 PyObject* wxGridCellCoordsArray_helper(const wxGridCellCoordsArray& source)
1507 PyObject* list = PyList_New(0);
1509 for (idx = 0; idx < source.GetCount(); idx += 1) {
1510 wxGridCellCoords& coord = source.Item(idx);
1511 PyObject* tup = PyTuple_New(2);
1512 PyTuple_SET_ITEM(tup, 0, PyInt_FromLong(coord.GetRow()));
1513 PyTuple_SET_ITEM(tup, 1, PyInt_FromLong(coord.GetCol()));
1514 PyList_Append(list, tup);
1525 class wxGridCellCoords
1528 wxGridCellCoords( int r=-1, int c=-1 );
1529 ~wxGridCellCoords();
1532 void SetRow( int n );
1534 void SetCol( int n );
1535 void Set( int row, int col );
1539 DocStr(__eq__, "Test for equality of GridCellCoords objects.", "");
1540 bool __eq__(PyObject* other) {
1541 wxGridCellCoords temp, *obj = &temp;
1542 if ( other == Py_None ) return false;
1543 if ( ! wxGridCellCoords_helper(other, &obj) ) {
1547 return self->operator==(*obj);
1552 DocStr(__ne__, "Test for inequality of GridCellCoords objects.", "");
1553 bool __ne__(PyObject* other) {
1554 wxGridCellCoords temp, *obj = &temp;
1555 if ( other == Py_None ) return true;
1556 if ( ! wxGridCellCoords_helper(other, &obj)) {
1560 return self->operator!=(*obj);
1567 PyObject* tup = PyTuple_New(2);
1568 PyTuple_SET_ITEM(tup, 0, PyInt_FromLong(self->GetRow()));
1569 PyTuple_SET_ITEM(tup, 1, PyInt_FromLong(self->GetCol()));
1574 asTuple = wx._deprecated(Get, "asTuple is deprecated, use `Get` instead")
1575 def __str__(self): return str(self.Get())
1576 def __repr__(self): return 'wxGridCellCoords'+str(self.Get())
1577 def __len__(self): return len(self.Get())
1578 def __getitem__(self, index): return self.asTuple()[index]
1579 def __setitem__(self, index, val):
1580 if index == 0: self.SetRow(val)
1581 elif index == 1: self.SetCol(val)
1582 else: raise IndexError
1588 //---------------------------------------------------------------------------
1589 //---------------------------------------------------------------------------
1593 // Fool SWIG into treating this enum as an int
1594 typedef int WXGRIDSELECTIONMODES;
1596 // but let the C++ code know what it really is.
1598 typedef wxGrid::wxGridSelectionModes WXGRIDSELECTIONMODES;
1603 MustHaveApp(wxGrid);
1605 class wxGrid : public wxScrolledWindow
1608 %pythonAppend wxGrid "self._setOORInfo(self)"
1609 %pythonAppend wxGrid() ""
1611 %typemap(out) wxGrid*; // turn off this typemap
1613 wxGrid( wxWindow *parent,
1615 const wxPoint& pos = wxDefaultPosition,
1616 const wxSize& size = wxDefaultSize,
1617 long style = wxWANTS_CHARS,
1618 const wxString& name = wxPyPanelNameStr);
1620 %RenameCtor(PreGrid, wxGrid());
1623 // Turn it back on again
1624 %typemap(out) wxGrid* { $result = wxPyMake_wxObject($1, $owner); }
1627 bool Create( wxWindow *parent,
1629 const wxPoint& pos = wxDefaultPosition,
1630 const wxSize& size = wxDefaultSize,
1631 long style = wxWANTS_CHARS,
1632 const wxString& name = wxPyPanelNameStr );
1635 enum wxGridSelectionModes {
1641 SelectCells = wxGridSelectCells
1642 SelectRows = wxGridSelectRows
1643 SelectColumns = wxGridSelectColumns
1646 bool CreateGrid( int numRows, int numCols,
1647 WXGRIDSELECTIONMODES selmode = wxGrid::wxGridSelectCells );
1648 void SetSelectionMode(WXGRIDSELECTIONMODES selmode);
1649 WXGRIDSELECTIONMODES GetSelectionMode();
1652 // ------ grid dimensions
1654 int GetNumberRows();
1655 int GetNumberCols();
1658 bool ProcessTableMessage( wxGridTableMessage& );
1661 wxGridTableBase * GetTable() const;
1663 %disownarg(wxGridTableBase *);
1664 bool SetTable( wxGridTableBase *table, bool takeOwnership=false,
1665 WXGRIDSELECTIONMODES selmode =
1666 wxGrid::wxGridSelectCells );
1667 %cleardisown(wxGridTableBase *);
1670 bool InsertRows( int pos = 0, int numRows = 1, bool updateLabels=true );
1671 bool AppendRows( int numRows = 1, bool updateLabels=true );
1672 bool DeleteRows( int pos = 0, int numRows = 1, bool updateLabels=true );
1673 bool InsertCols( int pos = 0, int numCols = 1, bool updateLabels=true );
1674 bool AppendCols( int numCols = 1, bool updateLabels=true );
1675 bool DeleteCols( int pos = 0, int numCols = 1, bool updateLabels=true );
1678 // this function is called when the current cell highlight must be redrawn
1679 // and may be overridden by the user
1680 virtual void DrawCellHighlight( wxDC& dc, const wxGridCellAttr *attr );
1683 // ------ Cell text drawing functions
1685 void DrawTextRectangle( wxDC& dc, const wxString&, const wxRect&,
1686 int horizontalAlignment = wxLEFT,
1687 int verticalAlignment = wxTOP,
1688 int textOrientation = wxHORIZONTAL );
1690 // // Split a string containing newline chararcters into an array of
1691 // // strings and return the number of lines
1693 // void StringToLines( const wxString& value, wxArrayString& lines );
1696 void, GetTextBoxSize( wxDC& dc, wxArrayString& lines,
1697 long *OUTPUT, long *OUTPUT ),
1698 "GetTextBoxSize(DC dc, list lines) -> (width, height)");
1702 // Code that does a lot of grid modification can be enclosed
1703 // between BeginBatch() and EndBatch() calls to avoid screen
1708 int GetBatchCount();
1709 void ForceRefresh();
1712 // ------ edit control functions
1715 void EnableEditing( bool edit );
1717 void EnableCellEditControl( bool enable = true );
1718 void DisableCellEditControl();
1719 bool CanEnableCellControl() const;
1720 bool IsCellEditControlEnabled() const;
1721 bool IsCellEditControlShown() const;
1723 bool IsCurrentCellReadOnly() const;
1725 void ShowCellEditControl();
1726 void HideCellEditControl();
1727 void SaveEditControlValue();
1730 // ------ grid location functions
1731 // Note that all of these functions work with the logical coordinates of
1732 // grid cells and labels so you will need to convert from device
1733 // coordinates for mouse events etc.
1736 //void XYToCell( int x, int y, wxGridCellCoords& );
1738 wxGridCellCoords XYToCell(int x, int y) {
1739 wxGridCellCoords rv;
1740 self->XYToCell(x, y, rv);
1745 int YToRow( int y );
1746 int XToCol( int x );
1748 int YToEdgeOfRow( int y );
1749 int XToEdgeOfCol( int x );
1751 wxRect CellToRect( int row, int col );
1752 // TODO: ??? wxRect CellToRect( const wxGridCellCoords& coords );
1755 int GetGridCursorRow();
1756 int GetGridCursorCol();
1758 // check to see if a cell is either wholly visible (the default arg) or
1759 // at least partially visible in the grid window
1761 bool IsVisible( int row, int col, bool wholeCellVisible = true );
1762 // TODO: ??? bool IsVisible( const wxGridCellCoords& coords, bool wholeCellVisible = true );
1763 void MakeCellVisible( int row, int col );
1764 // TODO: ??? void MakeCellVisible( const wxGridCellCoords& coords );
1767 // ------ grid cursor movement functions
1769 void SetGridCursor( int row, int col );
1770 bool MoveCursorUp( bool expandSelection );
1771 bool MoveCursorDown( bool expandSelection );
1772 bool MoveCursorLeft( bool expandSelection );
1773 bool MoveCursorRight( bool expandSelection );
1774 bool MovePageDown();
1776 bool MoveCursorUpBlock( bool expandSelection );
1777 bool MoveCursorDownBlock( bool expandSelection );
1778 bool MoveCursorLeftBlock( bool expandSelection );
1779 bool MoveCursorRightBlock( bool expandSelection );
1782 // ------ label and gridline formatting
1784 int GetDefaultRowLabelSize();
1785 int GetRowLabelSize();
1786 int GetDefaultColLabelSize();
1787 int GetColLabelSize();
1788 wxColour GetLabelBackgroundColour();
1789 wxColour GetLabelTextColour();
1790 wxFont GetLabelFont();
1793 void, GetRowLabelAlignment( int *OUTPUT, int *OUTPUT ),
1794 "GetRowLabelAlignment() -> (horiz, vert)");
1797 void, GetColLabelAlignment( int *OUTPUT, int *OUTPUT ),
1798 "GetColLabelAlignment() -> (horiz, vert)");
1800 int GetColLabelTextOrientation();
1801 wxString GetRowLabelValue( int row );
1802 wxString GetColLabelValue( int col );
1803 wxColour GetGridLineColour();
1804 wxColour GetCellHighlightColour();
1805 int GetCellHighlightPenWidth();
1806 int GetCellHighlightROPenWidth();
1808 void SetRowLabelSize( int width );
1809 void SetColLabelSize( int height );
1810 void SetLabelBackgroundColour( const wxColour& );
1811 void SetLabelTextColour( const wxColour& );
1812 void SetLabelFont( const wxFont& );
1813 void SetRowLabelAlignment( int horiz, int vert );
1814 void SetColLabelAlignment( int horiz, int vert );
1815 void SetColLabelTextOrientation( int textOrientation );
1816 void SetRowLabelValue( int row, const wxString& );
1817 void SetColLabelValue( int col, const wxString& );
1818 void SetGridLineColour( const wxColour& );
1819 void SetCellHighlightColour( const wxColour& );
1820 void SetCellHighlightPenWidth(int width);
1821 void SetCellHighlightROPenWidth(int width);
1823 void EnableDragRowSize( bool enable = true );
1824 void DisableDragRowSize();
1825 bool CanDragRowSize();
1826 void EnableDragColSize( bool enable = true );
1827 void DisableDragColSize();
1828 bool CanDragColSize();
1829 void EnableDragGridSize(bool enable = true);
1830 void DisableDragGridSize();
1831 bool CanDragGridSize();
1833 void EnableDragCell( bool enable = true );
1834 void DisableDragCell();
1837 // this sets the specified attribute for all cells in this row/col
1838 void SetAttr(int row, int col, wxGridCellAttr *attr);
1839 void SetRowAttr(int row, wxGridCellAttr *attr);
1840 void SetColAttr(int col, wxGridCellAttr *attr);
1842 // returns the attribute we may modify in place: a new one if this cell
1843 // doesn't have any yet or the existing one if it does
1845 // DecRef() must be called on the returned pointer, as usual
1846 wxGridCellAttr *GetOrCreateCellAttr(int row, int col) const;
1849 // shortcuts for setting the column parameters
1851 // set the format for the data in the column: default is string
1852 void SetColFormatBool(int col);
1853 void SetColFormatNumber(int col);
1854 void SetColFormatFloat(int col, int width = -1, int precision = -1);
1855 void SetColFormatCustom(int col, const wxString& typeName);
1857 void EnableGridLines( bool enable = true );
1858 bool GridLinesEnabled();
1860 // ------ row and col formatting
1862 int GetDefaultRowSize();
1863 int GetRowSize( int row );
1864 int GetDefaultColSize();
1865 int GetColSize( int col );
1866 wxColour GetDefaultCellBackgroundColour();
1867 wxColour GetCellBackgroundColour( int row, int col );
1868 wxColour GetDefaultCellTextColour();
1869 wxColour GetCellTextColour( int row, int col );
1870 wxFont GetDefaultCellFont();
1871 wxFont GetCellFont( int row, int col );
1874 void, GetDefaultCellAlignment( int *OUTPUT, int *OUTPUT ),
1875 "GetDefaultCellAlignment() -> (horiz, vert)");
1878 void, GetCellAlignment( int row, int col, int *OUTPUT, int *OUTPUT ),
1879 "GetCellAlignment() -> (horiz, vert)");
1881 bool GetDefaultCellOverflow();
1882 bool GetCellOverflow( int row, int col );
1885 void, GetCellSize( int row, int col, int *OUTPUT, int *OUTPUT ),
1886 "GetCellSize(int row, int col) -> (num_rows, num_cols)");
1888 void SetDefaultRowSize( int height, bool resizeExistingRows = false );
1889 void SetRowSize( int row, int height );
1890 void SetDefaultColSize( int width, bool resizeExistingCols = false );
1892 void SetColSize( int col, int width );
1894 // automatically size the column or row to fit to its contents, if
1895 // setAsMin is True, this optimal width will also be set as minimal width
1897 void AutoSizeColumn( int col, bool setAsMin = true );
1898 void AutoSizeRow( int row, bool setAsMin = true );
1901 // auto size all columns (very ineffective for big grids!)
1902 void AutoSizeColumns( bool setAsMin = true );
1903 void AutoSizeRows( bool setAsMin = true );
1905 // auto size the grid, that is make the columns/rows of the "right" size
1906 // and also set the grid size to just fit its contents
1909 // autosize row height depending on label text
1910 void AutoSizeRowLabelSize( int row );
1912 // autosize column width depending on label text
1913 void AutoSizeColLabelSize( int col );
1916 // column won't be resized to be lesser width - this must be called during
1917 // the grid creation because it won't resize the column if it's already
1918 // narrower than the minimal width
1919 void SetColMinimalWidth( int col, int width );
1920 void SetRowMinimalHeight( int row, int width );
1922 void SetColMinimalAcceptableWidth( int width );
1923 void SetRowMinimalAcceptableHeight( int width );
1924 int GetColMinimalAcceptableWidth() const;
1925 int GetRowMinimalAcceptableHeight() const;
1927 void SetDefaultCellBackgroundColour( const wxColour& );
1928 void SetCellBackgroundColour( int row, int col, const wxColour& );
1929 void SetDefaultCellTextColour( const wxColour& );
1931 void SetCellTextColour( int row, int col, const wxColour& );
1932 void SetDefaultCellFont( const wxFont& );
1933 void SetCellFont( int row, int col, const wxFont& );
1934 void SetDefaultCellAlignment( int horiz, int vert );
1935 void SetCellAlignment( int row, int col, int horiz, int vert );
1936 void SetDefaultCellOverflow( bool allow );
1937 void SetCellOverflow( int row, int col, bool allow );
1938 void SetCellSize( int row, int col, int num_rows, int num_cols );
1940 // takes ownership of the pointer
1941 void SetDefaultRenderer(wxGridCellRenderer *renderer);
1942 void SetCellRenderer(int row, int col, wxGridCellRenderer *renderer);
1943 wxGridCellRenderer *GetDefaultRenderer() const;
1944 wxGridCellRenderer* GetCellRenderer(int row, int col);
1946 // takes ownership of the pointer
1947 void SetDefaultEditor(wxGridCellEditor *editor);
1948 void SetCellEditor(int row, int col, wxGridCellEditor *editor);
1949 wxGridCellEditor *GetDefaultEditor() const;
1950 wxGridCellEditor* GetCellEditor(int row, int col);
1954 // ------ cell value accessors
1956 wxString GetCellValue( int row, int col );
1957 // TODO: ??? wxString GetCellValue( const wxGridCellCoords& coords )
1959 void SetCellValue( int row, int col, const wxString& s );
1960 // TODO: ??? void SetCellValue( const wxGridCellCoords& coords, const wxString& s )
1962 // returns True if the cell can't be edited
1963 bool IsReadOnly(int row, int col) const;
1965 // make the cell editable/readonly
1966 void SetReadOnly(int row, int col, bool isReadOnly = true);
1968 // ------ selections of blocks of cells
1970 void SelectRow( int row, bool addToSelected = false );
1971 void SelectCol( int col, bool addToSelected = false );
1973 void SelectBlock( int topRow, int leftCol, int bottomRow, int rightCol,
1974 bool addToSelected = false );
1975 // TODO: ??? void SelectBlock( const wxGridCellCoords& topLeft,
1976 // TODO: ??? const wxGridCellCoords& bottomRight )
1980 void ClearSelection();
1981 bool IsInSelection( int row, int col );
1982 // TODO: ??? bool IsInSelection( const wxGridCellCoords& coords )
1984 const wxGridCellCoordsArray GetSelectedCells() const;
1985 const wxGridCellCoordsArray GetSelectionBlockTopLeft() const;
1986 const wxGridCellCoordsArray GetSelectionBlockBottomRight() const;
1987 const wxArrayInt GetSelectedRows() const;
1988 const wxArrayInt GetSelectedCols() const;
1990 void DeselectRow( int row );
1991 void DeselectCol( int col );
1992 void DeselectCell( int row, int col );
1995 // This function returns the rectangle that encloses the block of cells
1996 // limited by TopLeft and BottomRight cell in device coords and clipped
1997 // to the client size of the grid window.
1999 wxRect BlockToDeviceRect( const wxGridCellCoords & topLeft,
2000 const wxGridCellCoords & bottomRight );
2003 // Access or update the selection fore/back colours
2004 wxColour GetSelectionBackground() const;
2005 wxColour GetSelectionForeground() const;
2007 void SetSelectionBackground(const wxColour& c);
2008 void SetSelectionForeground(const wxColour& c);
2011 // Methods for a registry for mapping data types to Renderers/Editors
2012 void RegisterDataType(const wxString& typeName,
2013 wxGridCellRenderer* renderer,
2014 wxGridCellEditor* editor);
2015 wxGridCellEditor* GetDefaultEditorForCell(int row, int col) const;
2016 // TODO: ??? wxGridCellEditor* GetDefaultEditorForCell(const wxGridCellCoords& c) const
2017 wxGridCellRenderer* GetDefaultRendererForCell(int row, int col) const;
2018 wxGridCellEditor* GetDefaultEditorForType(const wxString& typeName) const;
2019 wxGridCellRenderer* GetDefaultRendererForType(const wxString& typeName) const;
2021 // grid may occupy more space than needed for its rows/columns, this
2022 // function allows to set how big this extra space is
2023 void SetMargins(int extraWidth, int extraHeight);
2026 // Accessors for component windows
2027 wxWindow* GetGridWindow();
2028 wxWindow* GetGridRowLabelWindow();
2029 wxWindow* GetGridColLabelWindow();
2030 wxWindow* GetGridCornerLabelWindow();
2032 // Allow adjustment of scroll increment. The default is (15, 15).
2033 void SetScrollLineX(int x);
2034 void SetScrollLineY(int y);
2035 int GetScrollLineX() const;
2036 int GetScrollLineY() const;
2038 int GetScrollX(int x) const;
2039 int GetScrollY(int y) const;
2041 static wxVisualAttributes
2042 GetClassDefaultAttributes(wxWindowVariant variant = wxWINDOW_VARIANT_NORMAL);
2046 //---------------------------------------------------------------------------
2047 //---------------------------------------------------------------------------
2048 // Grid events and stuff
2052 class wxGridEvent : public wxNotifyEvent
2055 wxGridEvent(int id, wxEventType type, wxGrid* obj,
2056 int row=-1, int col=-1, int x=-1, int y=-1, bool sel = true,
2057 bool control=false, bool shift=false, bool alt=false, bool meta=false);
2059 virtual int GetRow();
2060 virtual int GetCol();
2061 wxPoint GetPosition();
2071 class wxGridSizeEvent : public wxNotifyEvent
2074 wxGridSizeEvent(int id, wxEventType type, wxGrid* obj,
2075 int rowOrCol=-1, int x=-1, int y=-1,
2076 bool control=false, bool shift=false, bool alt=false, bool meta=false);
2079 wxPoint GetPosition();
2088 class wxGridRangeSelectEvent : public wxNotifyEvent
2091 wxGridRangeSelectEvent(int id, wxEventType type, wxGrid* obj,
2092 const wxGridCellCoords& topLeft,
2093 const wxGridCellCoords& bottomRight,
2095 bool control=false, bool shift=false,
2096 bool alt=false, bool meta=false);
2098 wxGridCellCoords GetTopLeftCoords();
2099 wxGridCellCoords GetBottomRightCoords();
2113 class wxGridEditorCreatedEvent : public wxCommandEvent {
2115 wxGridEditorCreatedEvent(int id, wxEventType type, wxObject* obj,
2116 int row, int col, wxControl* ctrl);
2120 wxControl* GetControl();
2121 void SetRow(int row);
2122 void SetCol(int col);
2123 void SetControl(wxControl* ctrl);
2128 %constant wxEventType wxEVT_GRID_CELL_LEFT_CLICK;
2129 %constant wxEventType wxEVT_GRID_CELL_RIGHT_CLICK;
2130 %constant wxEventType wxEVT_GRID_CELL_LEFT_DCLICK;
2131 %constant wxEventType wxEVT_GRID_CELL_RIGHT_DCLICK;
2132 %constant wxEventType wxEVT_GRID_LABEL_LEFT_CLICK;
2133 %constant wxEventType wxEVT_GRID_LABEL_RIGHT_CLICK;
2134 %constant wxEventType wxEVT_GRID_LABEL_LEFT_DCLICK;
2135 %constant wxEventType wxEVT_GRID_LABEL_RIGHT_DCLICK;
2136 %constant wxEventType wxEVT_GRID_ROW_SIZE;
2137 %constant wxEventType wxEVT_GRID_COL_SIZE;
2138 %constant wxEventType wxEVT_GRID_RANGE_SELECT;
2139 %constant wxEventType wxEVT_GRID_CELL_CHANGE;
2140 %constant wxEventType wxEVT_GRID_SELECT_CELL;
2141 %constant wxEventType wxEVT_GRID_EDITOR_SHOWN;
2142 %constant wxEventType wxEVT_GRID_EDITOR_HIDDEN;
2143 %constant wxEventType wxEVT_GRID_EDITOR_CREATED;
2144 %constant wxEventType wxEVT_GRID_CELL_BEGIN_DRAG;
2149 EVT_GRID_CELL_LEFT_CLICK = wx.PyEventBinder( wxEVT_GRID_CELL_LEFT_CLICK )
2150 EVT_GRID_CELL_RIGHT_CLICK = wx.PyEventBinder( wxEVT_GRID_CELL_RIGHT_CLICK )
2151 EVT_GRID_CELL_LEFT_DCLICK = wx.PyEventBinder( wxEVT_GRID_CELL_LEFT_DCLICK )
2152 EVT_GRID_CELL_RIGHT_DCLICK = wx.PyEventBinder( wxEVT_GRID_CELL_RIGHT_DCLICK )
2153 EVT_GRID_LABEL_LEFT_CLICK = wx.PyEventBinder( wxEVT_GRID_LABEL_LEFT_CLICK )
2154 EVT_GRID_LABEL_RIGHT_CLICK = wx.PyEventBinder( wxEVT_GRID_LABEL_RIGHT_CLICK )
2155 EVT_GRID_LABEL_LEFT_DCLICK = wx.PyEventBinder( wxEVT_GRID_LABEL_LEFT_DCLICK )
2156 EVT_GRID_LABEL_RIGHT_DCLICK = wx.PyEventBinder( wxEVT_GRID_LABEL_RIGHT_DCLICK )
2157 EVT_GRID_ROW_SIZE = wx.PyEventBinder( wxEVT_GRID_ROW_SIZE )
2158 EVT_GRID_COL_SIZE = wx.PyEventBinder( wxEVT_GRID_COL_SIZE )
2159 EVT_GRID_RANGE_SELECT = wx.PyEventBinder( wxEVT_GRID_RANGE_SELECT )
2160 EVT_GRID_CELL_CHANGE = wx.PyEventBinder( wxEVT_GRID_CELL_CHANGE )
2161 EVT_GRID_SELECT_CELL = wx.PyEventBinder( wxEVT_GRID_SELECT_CELL )
2162 EVT_GRID_EDITOR_SHOWN = wx.PyEventBinder( wxEVT_GRID_EDITOR_SHOWN )
2163 EVT_GRID_EDITOR_HIDDEN = wx.PyEventBinder( wxEVT_GRID_EDITOR_HIDDEN )
2164 EVT_GRID_EDITOR_CREATED = wx.PyEventBinder( wxEVT_GRID_EDITOR_CREATED )
2165 EVT_GRID_CELL_BEGIN_DRAG = wx.PyEventBinder( wxEVT_GRID_CELL_BEGIN_DRAG )
2168 %# The same as above but with the ability to specify an identifier
2169 EVT_GRID_CMD_CELL_LEFT_CLICK = wx.PyEventBinder( wxEVT_GRID_CELL_LEFT_CLICK, 1 )
2170 EVT_GRID_CMD_CELL_RIGHT_CLICK = wx.PyEventBinder( wxEVT_GRID_CELL_RIGHT_CLICK, 1 )
2171 EVT_GRID_CMD_CELL_LEFT_DCLICK = wx.PyEventBinder( wxEVT_GRID_CELL_LEFT_DCLICK, 1 )
2172 EVT_GRID_CMD_CELL_RIGHT_DCLICK = wx.PyEventBinder( wxEVT_GRID_CELL_RIGHT_DCLICK, 1 )
2173 EVT_GRID_CMD_LABEL_LEFT_CLICK = wx.PyEventBinder( wxEVT_GRID_LABEL_LEFT_CLICK, 1 )
2174 EVT_GRID_CMD_LABEL_RIGHT_CLICK = wx.PyEventBinder( wxEVT_GRID_LABEL_RIGHT_CLICK, 1 )
2175 EVT_GRID_CMD_LABEL_LEFT_DCLICK = wx.PyEventBinder( wxEVT_GRID_LABEL_LEFT_DCLICK, 1 )
2176 EVT_GRID_CMD_LABEL_RIGHT_DCLICK = wx.PyEventBinder( wxEVT_GRID_LABEL_RIGHT_DCLICK, 1 )
2177 EVT_GRID_CMD_ROW_SIZE = wx.PyEventBinder( wxEVT_GRID_ROW_SIZE, 1 )
2178 EVT_GRID_CMD_COL_SIZE = wx.PyEventBinder( wxEVT_GRID_COL_SIZE, 1 )
2179 EVT_GRID_CMD_RANGE_SELECT = wx.PyEventBinder( wxEVT_GRID_RANGE_SELECT, 1 )
2180 EVT_GRID_CMD_CELL_CHANGE = wx.PyEventBinder( wxEVT_GRID_CELL_CHANGE, 1 )
2181 EVT_GRID_CMD_SELECT_CELL = wx.PyEventBinder( wxEVT_GRID_SELECT_CELL, 1 )
2182 EVT_GRID_CMD_EDITOR_SHOWN = wx.PyEventBinder( wxEVT_GRID_EDITOR_SHOWN, 1 )
2183 EVT_GRID_CMD_EDITOR_HIDDEN = wx.PyEventBinder( wxEVT_GRID_EDITOR_HIDDEN, 1 )
2184 EVT_GRID_CMD_EDITOR_CREATED = wx.PyEventBinder( wxEVT_GRID_EDITOR_CREATED, 1 )
2185 EVT_GRID_CMD_CELL_BEGIN_DRAG = wx.PyEventBinder( wxEVT_GRID_CELL_BEGIN_DRAG, 1 )
2189 //---------------------------------------------------------------------------
2194 //---------------------------------------------------------------------------
2195 //---------------------------------------------------------------------------