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 MAKE_CONST_WXSTRING_NOSWIG(EmptyString);
39 MAKE_CONST_WXSTRING_NOSWIG(PanelNameStr);
40 MAKE_CONST_WXSTRING_NOSWIG(DefaultDateTimeFormat);
42 //---------------------------------------------------------------------------
43 // OOR related typemaps and helper functions
45 %typemap(out) wxGridCellRenderer* { $result = wxPyMake_wxGridCellRenderer($1, (bool)$owner); }
46 %typemap(out) wxGridCellEditor* { $result = wxPyMake_wxGridCellEditor($1, (bool)$owner); }
47 %typemap(out) wxGridCellAttr* { $result = wxPyMake_wxGridCellAttr($1, (bool)$owner); }
48 %typemap(out) wxGridCellAttrProvider* { $result = wxPyMake_wxGridCellAttrProvider($1, (bool)$owner); }
49 %typemap(out) wxGridTableBase* { $result = wxPyMake_wxGridTableBase($1, (bool)$owner); }
54 #define wxPyMake_TEMPLATE(TYPE) \
55 PyObject* wxPyMake_##TYPE(TYPE* source, bool setThisOwn) { \
56 PyObject* target = NULL; \
58 /* Check if there is already a pointer to a Python object in the \
59 OOR data that we can use. */ \
60 wxPyOORClientData* data = (wxPyOORClientData*)source->GetClientObject(); \
62 target = data->m_obj; \
66 /* Otherwise make a new wrapper for it the old fashioned way and \
67 give it the OOR treatment */ \
69 target = wxPyConstructObject(source, wxT(#TYPE), setThisOwn); \
71 source->SetClientObject(new wxPyOORClientData(target)); \
73 } else { /* source was NULL so return None. */ \
74 Py_INCREF(Py_None); target = Py_None; \
80 wxPyMake_TEMPLATE(wxGridCellRenderer)
81 wxPyMake_TEMPLATE(wxGridCellEditor)
82 wxPyMake_TEMPLATE(wxGridCellAttr)
83 wxPyMake_TEMPLATE(wxGridCellAttrProvider)
84 wxPyMake_TEMPLATE(wxGridTableBase)
88 //---------------------------------------------------------------------------
89 // Macros, similar to what's in helpers.h, to aid in the creation of
90 // virtual methods that are able to make callbacks to Python. Many of these
91 // are specific to wxGrid and so are kept here to reduce the mess in helpers.h
96 #define PYCALLBACK_GCA_INTINTKIND(PCLASS, CBNAME) \
97 wxGridCellAttr* CBNAME(int a, int b, wxGridCellAttr::wxAttrKind c) { \
98 wxGridCellAttr* rval = NULL; \
100 wxPyBlock_t blocked = wxPyBeginBlockThreads(); \
101 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
103 wxGridCellAttr* ptr; \
104 ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("(iii)", a, b, c)); \
106 if (wxPyConvertSwigPtr(ro, (void **)&ptr, wxT("wxGridCellAttr"))) \
111 wxPyEndBlockThreads(blocked); \
113 rval = PCLASS::CBNAME(a, b, c); \
118 #define PYCALLBACK__GCAINTINT(PCLASS, CBNAME) \
119 void CBNAME(wxGridCellAttr *attr, int a, int b) { \
120 wxPyBlock_t blocked = wxPyBeginBlockThreads(); \
122 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
123 PyObject* obj = wxPyMake_wxGridCellAttr(attr,false); \
124 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(Oii)", obj, a, b)); \
127 wxPyEndBlockThreads(blocked); \
129 PCLASS::CBNAME(attr, a, b); \
134 #define PYCALLBACK__GCAINT(PCLASS, CBNAME) \
135 void CBNAME(wxGridCellAttr *attr, int val) { \
136 wxPyBlock_t blocked = wxPyBeginBlockThreads(); \
138 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
139 PyObject* obj = wxPyMake_wxGridCellAttr(attr,false); \
140 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(Oi)", obj, val)); \
143 wxPyEndBlockThreads(blocked); \
145 PCLASS::CBNAME(attr, val); \
150 #define PYCALLBACK_INT__pure(CBNAME) \
152 wxPyBlock_t blocked = wxPyBeginBlockThreads(); \
154 if (wxPyCBH_findCallback(m_myInst, #CBNAME)) \
155 rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("()")); \
156 wxPyEndBlockThreads(blocked); \
162 #define PYCALLBACK_BOOL_INTINT_pure(CBNAME) \
163 bool CBNAME(int a, int b) { \
164 wxPyBlock_t blocked = wxPyBeginBlockThreads(); \
166 if (wxPyCBH_findCallback(m_myInst, #CBNAME)) \
167 rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(ii)",a,b)); \
168 wxPyEndBlockThreads(blocked); \
173 #define PYCALLBACK_STRING_INTINT_pure(CBNAME) \
174 wxString CBNAME(int a, int b) { \
175 wxPyBlock_t blocked = wxPyBeginBlockThreads(); \
177 if (wxPyCBH_findCallback(m_myInst, #CBNAME)) { \
179 ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("(ii)",a,b)); \
181 rval = Py2wxString(ro); \
185 wxPyEndBlockThreads(blocked); \
190 #define PYCALLBACK__INTINTSTRING_pure(CBNAME) \
191 void CBNAME(int a, int b, const wxString& c) { \
192 wxPyBlock_t blocked = wxPyBeginBlockThreads(); \
193 if (wxPyCBH_findCallback(m_myInst, #CBNAME)) { \
194 PyObject* s = wx2PyString(c); \
195 rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(iiO)",a,b,s));\
198 wxPyEndBlockThreads(blocked); \
202 #define PYCALLBACK_STRING_INTINT(PCLASS, CBNAME) \
203 wxString CBNAME(int a, int b) { \
205 wxPyBlock_t blocked = wxPyBeginBlockThreads(); \
207 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
209 ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("(ii)",a,b)); \
211 rval = Py2wxString(ro); \
215 wxPyEndBlockThreads(blocked); \
217 rval = PCLASS::CBNAME(a, b); \
222 #define PYCALLBACK_BOOL_INTINTSTRING(PCLASS, CBNAME) \
223 bool CBNAME(int a, int b, const wxString& c) { \
226 wxPyBlock_t blocked = wxPyBeginBlockThreads(); \
227 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
228 PyObject* s = wx2PyString(c); \
229 rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(iiO)",a,b,s));\
232 wxPyEndBlockThreads(blocked); \
234 rval = PCLASS::CBNAME(a,b,c); \
241 #define PYCALLBACK_LONG_INTINT(PCLASS, CBNAME) \
242 long CBNAME(int a, int b) { \
245 wxPyBlock_t blocked = wxPyBeginBlockThreads(); \
246 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \
247 rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(ii)", a,b)); \
248 wxPyEndBlockThreads(blocked); \
250 rval = PCLASS::CBNAME(a,b); \
255 #define PYCALLBACK_BOOL_INTINT(PCLASS, CBNAME) \
256 bool CBNAME(int a, int b) { \
259 wxPyBlock_t blocked = wxPyBeginBlockThreads(); \
260 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \
261 rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(ii)", a,b)); \
262 wxPyEndBlockThreads(blocked); \
264 rval = PCLASS::CBNAME(a,b); \
270 #define PYCALLBACK_DOUBLE_INTINT(PCLASS, CBNAME) \
271 double CBNAME(int a, int b) { \
273 wxPyBlock_t blocked = wxPyBeginBlockThreads(); \
275 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
277 ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("(ii)",a,b)); \
279 PyObject* str = PyObject_Str(ro); \
280 rval = PyFloat_AsDouble(str); \
281 Py_DECREF(ro); Py_DECREF(str); \
284 wxPyEndBlockThreads(blocked); \
286 rval = PCLASS::CBNAME(a, b); \
292 #define PYCALLBACK__(PCLASS, CBNAME) \
295 wxPyBlock_t blocked = wxPyBeginBlockThreads(); \
296 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \
297 wxPyCBH_callCallback(m_myInst, Py_BuildValue("()")); \
298 wxPyEndBlockThreads(blocked); \
305 #define PYCALLBACK_BOOL_SIZETSIZET(PCLASS, CBNAME) \
306 bool CBNAME(size_t a, size_t b) { \
309 wxPyBlock_t blocked = wxPyBeginBlockThreads(); \
310 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \
311 rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(ii)", a,b)); \
312 wxPyEndBlockThreads(blocked); \
314 rval = PCLASS::CBNAME(a,b); \
320 #define PYCALLBACK_BOOL_SIZET(PCLASS, CBNAME) \
321 bool CBNAME(size_t a) { \
324 wxPyBlock_t blocked = wxPyBeginBlockThreads(); \
325 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \
326 rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(i)", a)); \
327 wxPyEndBlockThreads(blocked); \
329 rval = PCLASS::CBNAME(a); \
334 #define PYCALLBACK_STRING_INT(PCLASS, CBNAME) \
335 wxString CBNAME(int a) { \
337 wxPyBlock_t blocked = wxPyBeginBlockThreads(); \
339 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
341 ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("(i)",a)); \
343 rval = Py2wxString(ro); \
347 wxPyEndBlockThreads(blocked); \
349 rval = PCLASS::CBNAME(a); \
354 #define PYCALLBACK__INTSTRING(PCLASS, CBNAME) \
355 void CBNAME(int a, const wxString& c) { \
357 wxPyBlock_t blocked = wxPyBeginBlockThreads(); \
358 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
359 PyObject* s = wx2PyString(c); \
360 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(iO)",a,s)); \
363 wxPyEndBlockThreads(blocked); \
365 PCLASS::CBNAME(a,c); \
371 #define PYCALLBACK_BOOL_(PCLASS, CBNAME) \
375 wxPyBlock_t blocked = wxPyBeginBlockThreads(); \
376 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \
377 rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("()")); \
378 wxPyEndBlockThreads(blocked); \
380 rval = PCLASS::CBNAME(); \
386 #define PYCALLBACK__SIZETINT(PCLASS, CBNAME) \
387 void CBNAME(size_t a, int b) { \
389 wxPyBlock_t blocked = wxPyBeginBlockThreads(); \
390 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \
391 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(ii)", a,b)); \
392 wxPyEndBlockThreads(blocked); \
394 PCLASS::CBNAME(a,b); \
400 #define PYCALLBACK__INTINTLONG(PCLASS, CBNAME) \
401 void CBNAME(int a, int b, long c) { \
403 wxPyBlock_t blocked = wxPyBeginBlockThreads(); \
404 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \
405 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(iii)", a,b,c)); \
406 wxPyEndBlockThreads(blocked); \
408 PCLASS::CBNAME(a,b,c); \
414 #define PYCALLBACK__INTINTDOUBLE(PCLASS, CBNAME) \
415 void CBNAME(int a, int b, double c) { \
417 wxPyBlock_t blocked = wxPyBeginBlockThreads(); \
418 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \
419 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(iif)", a,b,c)); \
420 wxPyEndBlockThreads(blocked); \
422 PCLASS::CBNAME(a,b,c); \
427 #define PYCALLBACK__INTINTBOOL(PCLASS, CBNAME) \
428 void CBNAME(int a, int b, bool c) { \
430 wxPyBlock_t blocked = wxPyBeginBlockThreads(); \
431 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \
432 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(iii)", a,b,c)); \
433 wxPyEndBlockThreads(blocked); \
435 PCLASS::CBNAME(a,b,c); \
442 //---------------------------------------------------------------------------
444 class wxGridCellCoords;
445 class wxGridCellAttr;
447 #define wxGRID_VALUE_STRING "string"
448 #define wxGRID_VALUE_BOOL "bool"
449 #define wxGRID_VALUE_NUMBER "long"
450 #define wxGRID_VALUE_FLOAT "double"
451 #define wxGRID_VALUE_CHOICE "choice"
452 #define wxGRID_VALUE_TEXT "string"
453 #define wxGRID_VALUE_LONG "long"
454 #define wxGRID_VALUE_CHOICEINT "choiceint"
455 #define wxGRID_VALUE_DATETIME "datetime"
459 const wxGridCellCoords wxGridNoCellCoords;
460 const wxRect wxGridNoCellRect;
465 #define wxGRID_DEFAULT_NUMBER_ROWS WXGRID_DEFAULT_NUMBER_ROWS
466 #define wxGRID_DEFAULT_NUMBER_COLS WXGRID_DEFAULT_NUMBER_COLS
467 #define wxGRID_DEFAULT_ROW_HEIGHT WXGRID_DEFAULT_ROW_HEIGHT
468 #define wxGRID_DEFAULT_COL_WIDTH WXGRID_DEFAULT_COL_WIDTH
469 #define wxGRID_DEFAULT_COL_LABEL_HEIGHT WXGRID_DEFAULT_COL_LABEL_HEIGHT
470 #define wxGRID_DEFAULT_ROW_LABEL_WIDTH WXGRID_DEFAULT_ROW_LABEL_WIDTH
471 #define wxGRID_LABEL_EDGE_ZONE WXGRID_LABEL_EDGE_ZONE
472 #define wxGRID_MIN_ROW_HEIGHT WXGRID_MIN_ROW_HEIGHT
473 #define wxGRID_MIN_COL_WIDTH WXGRID_MIN_COL_WIDTH
474 #define wxGRID_DEFAULT_SCROLLBAR_WIDTH WXGRID_DEFAULT_SCROLLBAR_WIDTH
478 wxGRID_DEFAULT_NUMBER_ROWS,
479 wxGRID_DEFAULT_NUMBER_COLS,
480 wxGRID_DEFAULT_ROW_HEIGHT,
481 wxGRID_DEFAULT_COL_WIDTH,
482 wxGRID_DEFAULT_COL_LABEL_HEIGHT,
483 wxGRID_DEFAULT_ROW_LABEL_WIDTH,
484 wxGRID_LABEL_EDGE_ZONE,
485 wxGRID_MIN_ROW_HEIGHT,
486 wxGRID_MIN_COL_WIDTH,
487 wxGRID_DEFAULT_SCROLLBAR_WIDTH
491 //---------------------------------------------------------------------------
493 // TODO: Use these to have SWIG automatically handle the IncRef/DecRef calls:
495 // %ref wxGridCellWorker "$this->IncRef();";
496 // %unref wxGridCellWorker "$this->DecRef();";
499 class wxGridCellWorker
503 void _setOORInfo(PyObject* _self) {
504 if (!self->GetClientObject())
505 self->SetClientObject(new wxPyOORClientData(_self));
508 // A dummy dtor to shut up SWIG. (The real one is protected and can
509 // only be called by DecRef)
510 ~wxGridCellWorker() {
514 void SetParameters(const wxString& params);
521 // wxGridCellRenderer is an ABC, and several derived classes are available.
522 // Classes implemented in Python should be derived from wxPyGridCellRenderer.
524 class wxGridCellRenderer : public wxGridCellWorker
526 virtual void Draw(wxGrid& grid,
527 wxGridCellAttr& attr,
532 virtual wxSize GetBestSize(wxGrid& grid,
533 wxGridCellAttr& attr,
536 virtual wxGridCellRenderer *Clone() const;
541 // The C++ version of wxPyGridCellRenderer
543 class wxPyGridCellRenderer : public wxGridCellRenderer
546 wxPyGridCellRenderer() : wxGridCellRenderer() {};
548 // Implement Python callback aware virtual methods
549 void Draw(wxGrid& grid, wxGridCellAttr& attr,
550 wxDC& dc, const wxRect& rect,
551 int row, int col, bool isSelected) {
552 wxPyBlock_t blocked = wxPyBeginBlockThreads();
553 if (wxPyCBH_findCallback(m_myInst, "Draw")) {
554 PyObject* go = wxPyMake_wxObject(&grid,false);
555 PyObject* dco = wxPyMake_wxObject(&dc,false);
556 PyObject* ao = wxPyMake_wxGridCellAttr(&attr,false);
557 PyObject* ro = wxPyConstructObject((void*)&rect, wxT("wxRect"), 0);
559 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(OOOOiii)", go, ao, dco, ro,
560 row, col, isSelected));
566 wxPyEndBlockThreads(blocked);
569 wxSize GetBestSize(wxGrid& grid, wxGridCellAttr& attr, wxDC& dc,
572 wxPyBlock_t blocked = wxPyBeginBlockThreads();
573 if (wxPyCBH_findCallback(m_myInst, "GetBestSize")) {
576 PyObject* go = wxPyMake_wxObject(&grid,false);
577 PyObject* dco = wxPyMake_wxObject(&dc,false);
578 PyObject* ao = wxPyMake_wxGridCellAttr(&attr,false);
580 ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("(OOOii)",
588 const char* errmsg = "GetBestSize should return a 2-tuple of integers or a wxSize object.";
589 if (wxPyConvertSwigPtr(ro, (void **)&ptr, wxT("wxSize"))) {
592 else if (PySequence_Check(ro) && PyObject_Length(ro) == 2) {
593 PyObject* o1 = PySequence_GetItem(ro, 0);
594 PyObject* o2 = PySequence_GetItem(ro, 1);
595 if (PyNumber_Check(o1) && PyNumber_Check(o2))
596 rval = wxSize(PyInt_AsLong(o1), PyInt_AsLong(o2));
598 PyErr_SetString(PyExc_TypeError, errmsg);
603 PyErr_SetString(PyExc_TypeError, errmsg);
608 wxPyEndBlockThreads(blocked);
613 wxGridCellRenderer *Clone() const {
614 wxGridCellRenderer* rval = NULL;
615 wxPyBlock_t blocked = wxPyBeginBlockThreads();
616 if (wxPyCBH_findCallback(m_myInst, "Clone")) {
618 wxGridCellRenderer* ptr;
619 ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("()"));
621 if (wxPyConvertSwigPtr(ro, (void **)&ptr, wxT("wxGridCellRenderer")))
626 wxPyEndBlockThreads(blocked);
630 DEC_PYCALLBACK__STRING(SetParameters);
635 IMP_PYCALLBACK__STRING( wxPyGridCellRenderer, wxGridCellRenderer, SetParameters);
640 // Let SWIG know about it so it can create the Python version
641 class wxPyGridCellRenderer : public wxGridCellRenderer {
643 %pythonAppend wxPyGridCellRenderer "self._setCallbackInfo(self, PyGridCellRenderer);self._setOORInfo(self)"
645 wxPyGridCellRenderer();
646 void _setCallbackInfo(PyObject* self, PyObject* _class);
648 void SetParameters(const wxString& params);
649 %MAKE_BASE_FUNC(PyGridCellRenderer, SetParameters);
652 //---------------------------------------------------------------------------
653 // Predefined Renderers
655 class wxGridCellStringRenderer : public wxGridCellRenderer
658 %pythonAppend wxGridCellStringRenderer "self._setOORInfo(self)"
659 wxGridCellStringRenderer();
663 class wxGridCellNumberRenderer : public wxGridCellStringRenderer
666 %pythonAppend wxGridCellNumberRenderer "self._setOORInfo(self)"
667 wxGridCellNumberRenderer();
671 class wxGridCellFloatRenderer : public wxGridCellStringRenderer
674 %pythonAppend wxGridCellFloatRenderer "self._setOORInfo(self)"
675 wxGridCellFloatRenderer(int width = -1, int precision = -1);
677 int GetWidth() const;
678 void SetWidth(int width);
679 int GetPrecision() const;
680 void SetPrecision(int precision);
684 class wxGridCellBoolRenderer : public wxGridCellRenderer
687 %pythonAppend wxGridCellBoolRenderer "self._setOORInfo(self)"
688 wxGridCellBoolRenderer();
692 class wxGridCellDateTimeRenderer : public wxGridCellStringRenderer
695 %pythonAppend wxGridCellDateTimeRenderer "self._setOORInfo(self)"
696 wxGridCellDateTimeRenderer(wxString outformat = wxPyDefaultDateTimeFormat,
697 wxString informat = wxPyDefaultDateTimeFormat);
701 class wxGridCellEnumRenderer : public wxGridCellStringRenderer
704 %pythonAppend wxGridCellEnumRenderer "self._setOORInfo(self)"
705 wxGridCellEnumRenderer( const wxString& choices = wxPyEmptyString );
709 class wxGridCellAutoWrapStringRenderer : public wxGridCellStringRenderer
712 %pythonAppend wxGridCellAutoWrapStringRenderer "self._setOORInfo(self)"
713 wxGridCellAutoWrapStringRenderer();
717 //---------------------------------------------------------------------------
718 // wxGridCellEditor is an ABC, and several derived classes are available.
719 // Classes implemented in Python should be derived from wxPyGridCellEditor.
721 class wxGridCellEditor : public wxGridCellWorker
725 wxControl* GetControl();
726 void SetControl(wxControl* control);
728 wxGridCellAttr* GetCellAttr();
729 void SetCellAttr(wxGridCellAttr* attr);
731 virtual void Create(wxWindow* parent,
733 wxEvtHandler* evtHandler);
734 virtual void BeginEdit(int row, int col, wxGrid* grid);
735 virtual bool EndEdit(int row, int col, wxGrid* grid);
736 virtual void Reset();
737 virtual wxGridCellEditor *Clone() const;
739 virtual void SetSize(const wxRect& rect);
740 virtual void Show(bool show, wxGridCellAttr *attr = NULL);
741 virtual void PaintBackground(const wxRect& rectCell, wxGridCellAttr *attr);
742 virtual bool IsAcceptedKey(wxKeyEvent& event);
743 virtual void StartingKey(wxKeyEvent& event);
744 virtual void StartingClick();
745 virtual void HandleReturn(wxKeyEvent& event);
747 %pythonAppend Destroy "args[0].thisown = 0"
748 virtual void Destroy();
753 // The C++ version of wxPyGridCellEditor
755 class wxPyGridCellEditor : public wxGridCellEditor
758 wxPyGridCellEditor() : wxGridCellEditor() {}
760 void Create(wxWindow* parent, wxWindowID id, wxEvtHandler* evtHandler) {
761 wxPyBlock_t blocked = wxPyBeginBlockThreads();
762 if (wxPyCBH_findCallback(m_myInst, "Create")) {
763 PyObject* po = wxPyMake_wxObject(parent,false);
764 PyObject* eo = wxPyMake_wxObject(evtHandler,false);
766 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(OiO)", po, id, eo));
770 wxPyEndBlockThreads(blocked);
774 void BeginEdit(int row, int col, wxGrid* grid) {
775 wxPyBlock_t blocked = wxPyBeginBlockThreads();
776 if (wxPyCBH_findCallback(m_myInst, "BeginEdit")) {
777 PyObject* go = wxPyMake_wxObject(grid,false);
778 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(iiO)", row, col, go));
781 wxPyEndBlockThreads(blocked);
785 bool EndEdit(int row, int col, wxGrid* grid) {
787 wxPyBlock_t blocked = wxPyBeginBlockThreads();
788 if (wxPyCBH_findCallback(m_myInst, "EndEdit")) {
789 PyObject* go = wxPyMake_wxObject(grid,false);
790 rv = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(iiO)", row, col, go));
793 wxPyEndBlockThreads(blocked);
798 wxGridCellEditor* Clone() const {
799 wxGridCellEditor* rval = NULL;
800 wxPyBlock_t blocked = wxPyBeginBlockThreads();
801 if (wxPyCBH_findCallback(m_myInst, "Clone")) {
803 wxGridCellEditor* ptr;
804 ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("()"));
806 if (wxPyConvertSwigPtr(ro, (void **)&ptr, wxT("wxGridCellEditor")))
811 wxPyEndBlockThreads(blocked);
816 void Show(bool show, wxGridCellAttr *attr) {
818 wxPyBlock_t blocked = wxPyBeginBlockThreads();
819 if ((found = wxPyCBH_findCallback(m_myInst, "Show"))) {
820 PyObject* ao = wxPyMake_wxGridCellAttr(attr,false);
821 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(iO)", show, ao));
824 wxPyEndBlockThreads(blocked);
826 wxGridCellEditor::Show(show, attr);
830 void PaintBackground(const wxRect& rectCell, wxGridCellAttr *attr) {
832 wxPyBlock_t blocked = wxPyBeginBlockThreads();
833 if ((found = wxPyCBH_findCallback(m_myInst, "PaintBackground)"))) {
834 PyObject* ao = wxPyMake_wxGridCellAttr(attr,false);
835 PyObject* ro = wxPyConstructObject((void*)&rectCell, wxT("wxRect"), 0);
837 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(OO)", ro, ao));
842 wxPyEndBlockThreads(blocked);
844 wxGridCellEditor::PaintBackground(rectCell, attr);
848 DEC_PYCALLBACK___pure(Reset);
849 DEC_PYCALLBACK__constany(SetSize, wxRect);
850 DEC_PYCALLBACK_bool_any(IsAcceptedKey, wxKeyEvent);
851 DEC_PYCALLBACK__any(StartingKey, wxKeyEvent);
852 DEC_PYCALLBACK__any(HandleReturn, wxKeyEvent);
853 DEC_PYCALLBACK__(StartingClick);
854 DEC_PYCALLBACK__(Destroy);
855 DEC_PYCALLBACK__STRING(SetParameters);
856 DEC_PYCALLBACK_STRING__constpure(GetValue);
862 IMP_PYCALLBACK__STRING( wxPyGridCellEditor, wxGridCellEditor, SetParameters);
863 IMP_PYCALLBACK___pure(wxPyGridCellEditor, wxGridCellEditor, Reset);
864 IMP_PYCALLBACK__constany(wxPyGridCellEditor, wxGridCellEditor, SetSize, wxRect);
865 IMP_PYCALLBACK_bool_any(wxPyGridCellEditor, wxGridCellEditor, IsAcceptedKey, wxKeyEvent);
866 IMP_PYCALLBACK__any(wxPyGridCellEditor, wxGridCellEditor, StartingKey, wxKeyEvent);
867 IMP_PYCALLBACK__any(wxPyGridCellEditor, wxGridCellEditor, HandleReturn, wxKeyEvent);
868 IMP_PYCALLBACK__(wxPyGridCellEditor, wxGridCellEditor, StartingClick);
869 IMP_PYCALLBACK__(wxPyGridCellEditor, wxGridCellEditor, Destroy);
870 IMP_PYCALLBACK_STRING__constpure(wxPyGridCellEditor, wxGridCellEditor, GetValue);
875 // Let SWIG know about it so it can create the Python version
876 class wxPyGridCellEditor : public wxGridCellEditor {
878 %pythonAppend wxPyGridCellEditor "self._setCallbackInfo(self, PyGridCellEditor);self._setOORInfo(self)"
880 wxPyGridCellEditor();
881 void _setCallbackInfo(PyObject* self, PyObject* _class);
883 void SetSize(const wxRect& rect);
884 void Show(bool show, wxGridCellAttr *attr = NULL);
885 void PaintBackground(const wxRect& rectCell, wxGridCellAttr *attr);
886 bool IsAcceptedKey(wxKeyEvent& event);
887 void StartingKey(wxKeyEvent& event);
888 void StartingClick();
889 void HandleReturn(wxKeyEvent& event);
891 void SetParameters(const wxString& params);
893 %MAKE_BASE_FUNC(PyGridCellEditor, SetSize);
894 %MAKE_BASE_FUNC(PyGridCellEditor, Show);
895 %MAKE_BASE_FUNC(PyGridCellEditor, PaintBackground);
896 %MAKE_BASE_FUNC(PyGridCellEditor, IsAcceptedKey);
897 %MAKE_BASE_FUNC(PyGridCellEditor, StartingKey);
898 %MAKE_BASE_FUNC(PyGridCellEditor, StartingClick);
899 %MAKE_BASE_FUNC(PyGridCellEditor, HandleReturn);
900 %MAKE_BASE_FUNC(PyGridCellEditor, Destroy);
901 %MAKE_BASE_FUNC(PyGridCellEditor, SetParameters);
904 //---------------------------------------------------------------------------
905 // Predefined Editors
907 class wxGridCellTextEditor : public wxGridCellEditor
910 %pythonAppend wxGridCellTextEditor "self._setOORInfo(self)"
911 wxGridCellTextEditor();
912 virtual wxString GetValue();
916 class wxGridCellNumberEditor : public wxGridCellTextEditor
919 %pythonAppend wxGridCellNumberEditor "self._setOORInfo(self)"
920 wxGridCellNumberEditor(int min = -1, int max = -1);
921 virtual wxString GetValue();
925 class wxGridCellFloatEditor : public wxGridCellTextEditor
928 %pythonAppend wxGridCellFloatEditor "self._setOORInfo(self)"
929 wxGridCellFloatEditor(int width = -1, int precision = -1);
930 virtual wxString GetValue();
934 class wxGridCellBoolEditor : public wxGridCellEditor
937 %pythonAppend wxGridCellBoolEditor "self._setOORInfo(self)"
938 wxGridCellBoolEditor();
939 virtual wxString GetValue();
942 class wxGridCellChoiceEditor : public wxGridCellEditor
945 %pythonAppend wxGridCellChoiceEditor "self._setOORInfo(self)"
946 wxGridCellChoiceEditor(int choices = 0,
947 const wxString* choices_array = NULL,
948 bool allowOthers = false);
949 virtual wxString GetValue();
953 class wxGridCellEnumEditor : public wxGridCellChoiceEditor
956 %pythonAppend wxGridCellEnumEditor "self._setOORInfo(self)"
957 wxGridCellEnumEditor( const wxString& choices = wxPyEmptyString );
958 virtual wxString GetValue();
962 class wxGridCellAutoWrapStringEditor : public wxGridCellTextEditor
965 %pythonAppend wxGridCellAutoWrapStringEditor "self._setOORInfo(self)"
966 wxGridCellAutoWrapStringEditor();
967 virtual wxString GetValue();
972 //---------------------------------------------------------------------------
989 void _setOORInfo(PyObject* _self) {
990 if (!self->GetClientObject())
991 self->SetClientObject(new wxPyOORClientData(_self));
995 %pythonAppend wxGridCellAttr "self._setOORInfo(self)"
997 wxGridCellAttr(wxGridCellAttr *attrDefault = NULL);
1000 // A dummy dtor to shut up SWIG. (The real one is protected and can
1001 // only be called by DecRef)
1006 wxGridCellAttr *Clone() const;
1007 void MergeWith(wxGridCellAttr *mergefrom);
1012 void SetTextColour(const wxColour& colText);
1013 void SetBackgroundColour(const wxColour& colBack);
1014 void SetFont(const wxFont& font);
1015 void SetAlignment(int hAlign, int vAlign);
1016 void SetSize(int num_rows, int num_cols);
1017 void SetOverflow( bool allow = true );
1018 void SetReadOnly(bool isReadOnly = true);
1020 void SetRenderer(wxGridCellRenderer *renderer);
1021 void SetEditor(wxGridCellEditor* editor);
1022 void SetKind(wxAttrKind kind);
1024 bool HasTextColour() const;
1025 bool HasBackgroundColour() const;
1026 bool HasFont() const;
1027 bool HasAlignment() const;
1028 bool HasRenderer() const;
1029 bool HasEditor() const;
1030 bool HasReadWriteMode() const;
1031 bool HasOverflowMode() const;
1033 wxColour GetTextColour() const;
1034 wxColour GetBackgroundColour() const;
1035 wxFont GetFont() const;
1038 void, GetAlignment(int *OUTPUT, int *OUTPUT) const,
1039 "GetAlignment() -> (hAlign, vAlign)");
1042 void, GetSize(int *OUTPUT, int *OUTPUT) const,
1043 "GetSize() -> (num_rows, num_cols)");
1045 bool GetOverflow() const;
1046 wxGridCellRenderer *GetRenderer(wxGrid* grid, int row, int col) const;
1047 wxGridCellEditor *GetEditor(wxGrid* grid, int row, int col) const;
1049 bool IsReadOnly() const;
1050 wxAttrKind GetKind();
1051 void SetDefAttr(wxGridCellAttr* defAttr);
1054 //---------------------------------------------------------------------------
1056 class wxGridCellAttrProvider
1059 %pythonAppend wxGridCellAttrProvider "self._setOORInfo(self)"
1060 wxGridCellAttrProvider();
1061 // ???? virtual ~wxGridCellAttrProvider();
1064 void _setOORInfo(PyObject* _self) {
1065 if (!self->GetClientObject())
1066 self->SetClientObject(new wxPyOORClientData(_self));
1070 wxGridCellAttr *GetAttr(int row, int col,
1071 wxGridCellAttr::wxAttrKind kind) const;
1072 void SetAttr(wxGridCellAttr *attr, int row, int col);
1073 void SetRowAttr(wxGridCellAttr *attr, int row);
1074 void SetColAttr(wxGridCellAttr *attr, int col);
1076 void UpdateAttrRows( size_t pos, int numRows );
1077 void UpdateAttrCols( size_t pos, int numCols );
1082 // A Python-aware version
1084 class wxPyGridCellAttrProvider : public wxGridCellAttrProvider
1087 wxPyGridCellAttrProvider() : wxGridCellAttrProvider() {};
1089 PYCALLBACK_GCA_INTINTKIND(wxGridCellAttrProvider, GetAttr);
1090 PYCALLBACK__GCAINTINT(wxGridCellAttrProvider, SetAttr);
1091 PYCALLBACK__GCAINT(wxGridCellAttrProvider, SetRowAttr);
1092 PYCALLBACK__GCAINT(wxGridCellAttrProvider, SetColAttr);
1099 // The python-aware version get's SWIGified
1100 class wxPyGridCellAttrProvider : public wxGridCellAttrProvider
1103 %pythonAppend wxPyGridCellAttrProvider "self._setCallbackInfo(self, PyGridCellAttrProvider)"
1104 wxPyGridCellAttrProvider();
1105 void _setCallbackInfo(PyObject* self, PyObject* _class);
1107 wxGridCellAttr *GetAttr(int row, int col,
1108 wxGridCellAttr::wxAttrKind kind);
1109 void SetAttr(wxGridCellAttr *attr, int row, int col);
1110 void SetRowAttr(wxGridCellAttr *attr, int row);
1111 void SetColAttr(wxGridCellAttr *attr, int col);
1113 %MAKE_BASE_FUNC(PyGridCellAttrProvider, GetAttr);
1114 %MAKE_BASE_FUNC(PyGridCellAttrProvider, SetAttr);
1115 %MAKE_BASE_FUNC(PyGridCellAttrProvider, SetRowAttr);
1116 %MAKE_BASE_FUNC(PyGridCellAttrProvider, SetColAttr);
1120 //---------------------------------------------------------------------------
1121 // Grid Table Base class and Python aware version
1124 class wxGridTableBase : public wxObject
1127 // wxGridTableBase(); This is an ABC
1131 void _setOORInfo(PyObject* _self) {
1132 if (!self->GetClientObject())
1133 self->SetClientObject(new wxPyOORClientData(_self));
1137 void SetAttrProvider(wxGridCellAttrProvider *attrProvider);
1138 wxGridCellAttrProvider *GetAttrProvider() const;
1139 void SetView( wxGrid *grid );
1140 wxGrid * GetView() const;
1144 virtual int GetNumberRows();
1145 virtual int GetNumberCols();
1146 virtual bool IsEmptyCell( int row, int col );
1147 virtual wxString GetValue( int row, int col );
1148 virtual void SetValue( int row, int col, const wxString& value );
1150 // virtuals overridable in wxPyGridTableBase
1151 virtual wxString GetTypeName( int row, int col );
1152 virtual bool CanGetValueAs( int row, int col, const wxString& typeName );
1153 virtual bool CanSetValueAs( int row, int col, const wxString& typeName );
1154 virtual long GetValueAsLong( int row, int col );
1155 virtual double GetValueAsDouble( int row, int col );
1156 virtual bool GetValueAsBool( int row, int col );
1157 virtual void SetValueAsLong( int row, int col, long value );
1158 virtual void SetValueAsDouble( int row, int col, double value );
1159 virtual void SetValueAsBool( int row, int col, bool value );
1161 //virtual void* GetValueAsCustom( int row, int col, const wxString& typeName );
1162 //virtual void SetValueAsCustom( int row, int col, const wxString& typeName, void* value );
1165 virtual void Clear();
1166 virtual bool InsertRows( size_t pos = 0, size_t numRows = 1 );
1167 virtual bool AppendRows( size_t numRows = 1 );
1168 virtual bool DeleteRows( size_t pos = 0, size_t numRows = 1 );
1169 virtual bool InsertCols( size_t pos = 0, size_t numCols = 1 );
1170 virtual bool AppendCols( size_t numCols = 1 );
1171 virtual bool DeleteCols( size_t pos = 0, size_t numCols = 1 );
1173 virtual wxString GetRowLabelValue( int row );
1174 virtual wxString GetColLabelValue( int col );
1175 virtual void SetRowLabelValue( int row, const wxString& value );
1176 virtual void SetColLabelValue( int col, const wxString& value );
1178 virtual bool CanHaveAttributes();
1180 virtual wxGridCellAttr *GetAttr( int row, int col,
1181 wxGridCellAttr::wxAttrKind kind);
1182 virtual void SetAttr(wxGridCellAttr* attr, int row, int col);
1183 virtual void SetRowAttr(wxGridCellAttr *attr, int row);
1184 virtual void SetColAttr(wxGridCellAttr *attr, int col);
1190 // Python-aware version
1192 class wxPyGridTableBase : public wxGridTableBase
1195 wxPyGridTableBase() : wxGridTableBase() {}
1197 PYCALLBACK_INT__pure(GetNumberRows);
1198 PYCALLBACK_INT__pure(GetNumberCols);
1199 PYCALLBACK_BOOL_INTINT_pure(IsEmptyCell);
1200 PYCALLBACK_STRING_INTINT(wxGridTableBase, GetTypeName);
1201 PYCALLBACK_BOOL_INTINTSTRING(wxGridTableBase, CanGetValueAs);
1202 PYCALLBACK_BOOL_INTINTSTRING(wxGridTableBase, CanSetValueAs);
1203 PYCALLBACK__(wxGridTableBase, Clear);
1204 PYCALLBACK_BOOL_SIZETSIZET(wxGridTableBase, InsertRows);
1205 PYCALLBACK_BOOL_SIZETSIZET(wxGridTableBase, DeleteRows);
1206 PYCALLBACK_BOOL_SIZETSIZET(wxGridTableBase, InsertCols);
1207 PYCALLBACK_BOOL_SIZETSIZET(wxGridTableBase, DeleteCols);
1208 PYCALLBACK_BOOL_SIZET(wxGridTableBase, AppendRows);
1209 PYCALLBACK_BOOL_SIZET(wxGridTableBase, AppendCols);
1210 PYCALLBACK_STRING_INT(wxGridTableBase, GetRowLabelValue);
1211 PYCALLBACK_STRING_INT(wxGridTableBase, GetColLabelValue);
1212 PYCALLBACK__INTSTRING(wxGridTableBase, SetRowLabelValue);
1213 PYCALLBACK__INTSTRING(wxGridTableBase, SetColLabelValue);
1214 PYCALLBACK_BOOL_(wxGridTableBase, CanHaveAttributes);
1215 PYCALLBACK_GCA_INTINTKIND(wxGridTableBase, GetAttr);
1216 PYCALLBACK__GCAINTINT(wxGridTableBase, SetAttr);
1217 PYCALLBACK__GCAINT(wxGridTableBase, SetRowAttr);
1218 PYCALLBACK__GCAINT(wxGridTableBase, SetColAttr);
1221 wxString GetValue(int row, int col) {
1222 wxPyBlock_t blocked = wxPyBeginBlockThreads();
1224 if (wxPyCBH_findCallback(m_myInst, "GetValue")) {
1226 ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("(ii)",row,col));
1228 if (!PyString_Check(ro) && !PyUnicode_Check(ro)) {
1230 ro = PyObject_Str(ro);
1233 rval = Py2wxString(ro);
1237 wxPyEndBlockThreads(blocked);
1241 void SetValue(int row, int col, const wxString& val) {
1242 wxPyBlock_t blocked = wxPyBeginBlockThreads();
1243 if (wxPyCBH_findCallback(m_myInst, "SetValue")) {
1244 PyObject* s = wx2PyString(val);
1245 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(iiO)",row,col,s));
1248 wxPyEndBlockThreads(blocked);
1252 // Map the Get/Set methods for the standard non-string types to
1253 // the GetValue and SetValue python methods.
1254 long GetValueAsLong( int row, int col ) {
1256 wxPyBlock_t blocked = wxPyBeginBlockThreads();
1257 if (wxPyCBH_findCallback(m_myInst, "GetValue")) {
1260 ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("(ii)", row, col));
1261 if (ro && PyNumber_Check(ro)) {
1262 num = PyNumber_Int(ro);
1264 rval = PyInt_AsLong(num);
1270 wxPyEndBlockThreads(blocked);
1274 double GetValueAsDouble( int row, int col ) {
1276 wxPyBlock_t blocked = wxPyBeginBlockThreads();
1277 if (wxPyCBH_findCallback(m_myInst, "GetValue")) {
1280 ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("(ii)", row, col));
1281 if (ro && PyNumber_Check(ro)) {
1282 num = PyNumber_Float(ro);
1284 rval = PyFloat_AsDouble(num);
1290 wxPyEndBlockThreads(blocked);
1294 bool GetValueAsBool( int row, int col ) {
1295 return (bool)GetValueAsLong(row, col);
1298 void SetValueAsLong( int row, int col, long value ) {
1299 wxPyBlock_t blocked = wxPyBeginBlockThreads();
1300 if (wxPyCBH_findCallback(m_myInst, "SetValue")) {
1301 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(iii)", row, col, value));
1303 wxPyEndBlockThreads(blocked);
1306 void SetValueAsDouble( int row, int col, double value ) {
1307 wxPyBlock_t blocked = wxPyBeginBlockThreads();
1308 if (wxPyCBH_findCallback(m_myInst, "SetValue")) {
1309 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(iid)", row, col, value));
1311 wxPyEndBlockThreads(blocked);
1314 void SetValueAsBool( int row, int col, bool value ) {
1315 SetValueAsLong( row, col, (long)value );
1324 // The python-aware version get's SWIGified
1325 class wxPyGridTableBase : public wxGridTableBase
1328 %pythonAppend wxPyGridTableBase "self._setCallbackInfo(self, PyGridTableBase);self._setOORInfo(self)"
1329 wxPyGridTableBase();
1330 void _setCallbackInfo(PyObject* self, PyObject* _class);
1332 %pythonAppend Destroy "args[0].thisown = 0"
1333 %extend { void Destroy() { delete self; } }
1335 wxString GetTypeName( int row, int col );
1336 bool CanGetValueAs( int row, int col, const wxString& typeName );
1337 bool CanSetValueAs( int row, int col, const wxString& typeName );
1339 bool InsertRows( size_t pos = 0, size_t numRows = 1 );
1340 bool AppendRows( size_t numRows = 1 );
1341 bool DeleteRows( size_t pos = 0, size_t numRows = 1 );
1342 bool InsertCols( size_t pos = 0, size_t numCols = 1 );
1343 bool AppendCols( size_t numCols = 1 );
1344 bool DeleteCols( size_t pos = 0, size_t numCols = 1 );
1345 wxString GetRowLabelValue( int row );
1346 wxString GetColLabelValue( int col );
1347 void SetRowLabelValue( int row, const wxString& value );
1348 void SetColLabelValue( int col, const wxString& value );
1349 bool CanHaveAttributes();
1350 wxGridCellAttr *GetAttr( int row, int col,
1351 wxGridCellAttr::wxAttrKind kind );
1352 void SetAttr(wxGridCellAttr* attr, int row, int col);
1353 void SetRowAttr(wxGridCellAttr *attr, int row);
1354 void SetColAttr(wxGridCellAttr *attr, int col);
1356 %MAKE_BASE_FUNC(PyGridTableBase, GetTypeName);
1357 %MAKE_BASE_FUNC(PyGridTableBase, CanGetValueAs);
1358 %MAKE_BASE_FUNC(PyGridTableBase, CanSetValueAs);
1359 %MAKE_BASE_FUNC(PyGridTableBase, Clear);
1360 %MAKE_BASE_FUNC(PyGridTableBase, InsertRows);
1361 %MAKE_BASE_FUNC(PyGridTableBase, AppendRows);
1362 %MAKE_BASE_FUNC(PyGridTableBase, DeleteRows);
1363 %MAKE_BASE_FUNC(PyGridTableBase, InsertCols);
1364 %MAKE_BASE_FUNC(PyGridTableBase, AppendCols);
1365 %MAKE_BASE_FUNC(PyGridTableBase, DeleteCols);
1366 %MAKE_BASE_FUNC(PyGridTableBase, GetRowLabelValue);
1367 %MAKE_BASE_FUNC(PyGridTableBase, GetColLabelValue);
1368 %MAKE_BASE_FUNC(PyGridTableBase, SetRowLabelValue);
1369 %MAKE_BASE_FUNC(PyGridTableBase, SetColLabelValue);
1370 %MAKE_BASE_FUNC(PyGridTableBase, CanHaveAttributes);
1371 %MAKE_BASE_FUNC(PyGridTableBase, GetAttr);
1372 %MAKE_BASE_FUNC(PyGridTableBase, SetAttr);
1373 %MAKE_BASE_FUNC(PyGridTableBase, SetRowAttr);
1374 %MAKE_BASE_FUNC(PyGridTableBase, SetColAttr);
1378 //---------------------------------------------------------------------------
1379 // Predefined Tables
1381 class wxGridStringTable : public wxGridTableBase
1384 %pythonAppend wxGridStringTable "self._setOORInfo(self)"
1385 wxGridStringTable( int numRows=0, int numCols=0 );
1388 //---------------------------------------------------------------------------
1389 // The Table can pass messages to the grid to tell it to update itself if
1390 // something has changed.
1392 enum wxGridTableRequest
1394 wxGRIDTABLE_REQUEST_VIEW_GET_VALUES = 2000,
1395 wxGRIDTABLE_REQUEST_VIEW_SEND_VALUES,
1396 wxGRIDTABLE_NOTIFY_ROWS_INSERTED,
1397 wxGRIDTABLE_NOTIFY_ROWS_APPENDED,
1398 wxGRIDTABLE_NOTIFY_ROWS_DELETED,
1399 wxGRIDTABLE_NOTIFY_COLS_INSERTED,
1400 wxGRIDTABLE_NOTIFY_COLS_APPENDED,
1401 wxGRIDTABLE_NOTIFY_COLS_DELETED
1405 class wxGridTableMessage
1408 wxGridTableMessage( wxGridTableBase *table, int id,
1411 ~wxGridTableMessage();
1413 void SetTableObject( wxGridTableBase *table );
1414 wxGridTableBase * GetTableObject() const;
1415 void SetId( int id );
1417 void SetCommandInt( int comInt1 );
1418 int GetCommandInt();
1419 void SetCommandInt2( int comInt2 );
1420 int GetCommandInt2();
1424 //---------------------------------------------------------------------------
1427 // Typemap to allow conversion of sequence objects to wxGridCellCoords...
1428 %typemap(in) wxGridCellCoords& (wxGridCellCoords temp) {
1430 if (! wxGridCellCoords_helper($input, &$1)) SWIG_fail;
1432 %typemap(typecheck, precedence=SWIG_TYPECHECK_POINTER) wxGridCellCoords& {
1433 $1 = wxGridCellCoords_typecheck($input);
1437 // ...and here is the associated helper.
1439 bool wxGridCellCoords_helper(PyObject* source, wxGridCellCoords** obj) {
1441 if (source == Py_None) {
1442 **obj = wxGridCellCoords(-1,-1);
1446 // If source is an object instance then it may already be the right type
1447 if (wxPySwigInstance_Check(source)) {
1448 wxGridCellCoords* ptr;
1449 if (! wxPyConvertSwigPtr(source, (void **)&ptr, wxT("wxGridCellCoords")))
1454 // otherwise a 2-tuple of integers is expected
1455 else if (PySequence_Check(source) && PyObject_Length(source) == 2) {
1456 PyObject* o1 = PySequence_GetItem(source, 0);
1457 PyObject* o2 = PySequence_GetItem(source, 1);
1458 if (!PyNumber_Check(o1) || !PyNumber_Check(o2)) {
1463 **obj = wxGridCellCoords(PyInt_AsLong(o1), PyInt_AsLong(o2));
1470 PyErr_SetString(PyExc_TypeError, "Expected a 2-tuple of integers or a wxGridCellCoords object.");
1475 bool wxGridCellCoords_typecheck(PyObject* source) {
1478 if (wxPySwigInstance_Check(source) &&
1479 wxPyConvertSwigPtr(source, (void **)&ptr, wxT("wxGridCellCoords")))
1483 if (PySequence_Check(source) && PySequence_Length(source) == 2)
1491 // Typemap to convert an array of cells coords to a list of tuples...
1492 %typemap(out) wxGridCellCoordsArray {
1493 $result = wxGridCellCoordsArray_helper($1);
1496 // %typemap(ret) wxGridCellCoordsArray {
1501 // ...and the helper function for the above typemap.
1503 PyObject* wxGridCellCoordsArray_helper(const wxGridCellCoordsArray& source)
1505 PyObject* list = PyList_New(0);
1507 for (idx = 0; idx < source.GetCount(); idx += 1) {
1508 wxGridCellCoords& coord = source.Item(idx);
1509 PyObject* tup = PyTuple_New(2);
1510 PyTuple_SET_ITEM(tup, 0, PyInt_FromLong(coord.GetRow()));
1511 PyTuple_SET_ITEM(tup, 1, PyInt_FromLong(coord.GetCol()));
1512 PyList_Append(list, tup);
1523 class wxGridCellCoords
1526 wxGridCellCoords( int r=-1, int c=-1 );
1527 ~wxGridCellCoords();
1530 void SetRow( int n );
1532 void SetCol( int n );
1533 void Set( int row, int col );
1537 DocStr(__eq__, "Test for equality of GridCellCoords objects.", "");
1538 bool __eq__(PyObject* other) {
1539 wxGridCellCoords temp, *obj = &temp;
1540 if ( other == Py_None ) return false;
1541 if ( ! wxGridCellCoords_helper(other, &obj) ) {
1545 return self->operator==(*obj);
1550 DocStr(__ne__, "Test for inequality of GridCellCoords objects.", "");
1551 bool __ne__(PyObject* other) {
1552 wxGridCellCoords temp, *obj = &temp;
1553 if ( other == Py_None ) return true;
1554 if ( ! wxGridCellCoords_helper(other, &obj)) {
1558 return self->operator!=(*obj);
1565 PyObject* tup = PyTuple_New(2);
1566 PyTuple_SET_ITEM(tup, 0, PyInt_FromLong(self->GetRow()));
1567 PyTuple_SET_ITEM(tup, 1, PyInt_FromLong(self->GetCol()));
1572 asTuple = wx._deprecated(Get, "asTuple is deprecated, use `Get` instead")
1573 def __str__(self): return str(self.Get())
1574 def __repr__(self): return 'wxGridCellCoords'+str(self.Get())
1575 def __len__(self): return len(self.Get())
1576 def __getitem__(self, index): return self.asTuple()[index]
1577 def __setitem__(self, index, val):
1578 if index == 0: self.SetRow(val)
1579 elif index == 1: self.SetCol(val)
1580 else: raise IndexError
1586 //---------------------------------------------------------------------------
1587 //---------------------------------------------------------------------------
1591 // Fool SWIG into treating this enum as an int
1592 typedef int WXGRIDSELECTIONMODES;
1594 // but let the C++ code know what it really is.
1596 typedef wxGrid::wxGridSelectionModes WXGRIDSELECTIONMODES;
1601 MustHaveApp(wxGrid);
1603 class wxGrid : public wxScrolledWindow
1606 %pythonAppend wxGrid "self._setOORInfo(self)"
1607 %pythonAppend wxGrid() ""
1609 %typemap(out) wxGrid*; // turn off this typemap
1611 wxGrid( wxWindow *parent,
1613 const wxPoint& pos = wxDefaultPosition,
1614 const wxSize& size = wxDefaultSize,
1615 long style = wxWANTS_CHARS,
1616 const wxString& name = wxPyPanelNameStr);
1618 %RenameCtor(PreGrid, wxGrid());
1621 // Turn it back on again
1622 %typemap(out) wxGrid* { $result = wxPyMake_wxObject($1, $owner); }
1625 bool Create( wxWindow *parent,
1627 const wxPoint& pos = wxDefaultPosition,
1628 const wxSize& size = wxDefaultSize,
1629 long style = wxWANTS_CHARS,
1630 const wxString& name = wxPyPanelNameStr );
1632 // Override the global renamer to leave these as they are, for backwards
1634 %rename(wxGridSelectCells) wxGridSelectCells;
1635 %rename(wxGridSelectRows) wxGridSelectRows;
1636 %rename(wxGridSelectColumns) wxGridSelectColumns;
1638 enum wxGridSelectionModes {
1644 SelectCells = wxGridSelectCells
1645 SelectRows = wxGridSelectRows
1646 SelectColumns = wxGridSelectColumns
1649 bool CreateGrid( int numRows, int numCols,
1650 WXGRIDSELECTIONMODES selmode = wxGrid::wxGridSelectCells );
1651 void SetSelectionMode(WXGRIDSELECTIONMODES selmode);
1652 WXGRIDSELECTIONMODES GetSelectionMode();
1655 // ------ grid dimensions
1657 int GetNumberRows();
1658 int GetNumberCols();
1661 bool ProcessTableMessage( wxGridTableMessage& );
1664 wxGridTableBase * GetTable() const;
1666 %disownarg(wxGridTableBase *);
1667 bool SetTable( wxGridTableBase *table, bool takeOwnership=false,
1668 WXGRIDSELECTIONMODES selmode =
1669 wxGrid::wxGridSelectCells );
1670 %cleardisown(wxGridTableBase *);
1673 bool InsertRows( int pos = 0, int numRows = 1, bool updateLabels=true );
1674 bool AppendRows( int numRows = 1, bool updateLabels=true );
1675 bool DeleteRows( int pos = 0, int numRows = 1, bool updateLabels=true );
1676 bool InsertCols( int pos = 0, int numCols = 1, bool updateLabels=true );
1677 bool AppendCols( int numCols = 1, bool updateLabels=true );
1678 bool DeleteCols( int pos = 0, int numCols = 1, bool updateLabels=true );
1681 // this function is called when the current cell highlight must be redrawn
1682 // and may be overridden by the user
1683 virtual void DrawCellHighlight( wxDC& dc, const wxGridCellAttr *attr );
1686 // ------ Cell text drawing functions
1688 void DrawTextRectangle( wxDC& dc, const wxString&, const wxRect&,
1689 int horizontalAlignment = wxLEFT,
1690 int verticalAlignment = wxTOP,
1691 int textOrientation = wxHORIZONTAL );
1693 // // Split a string containing newline chararcters into an array of
1694 // // strings and return the number of lines
1696 // void StringToLines( const wxString& value, wxArrayString& lines );
1699 void, GetTextBoxSize( wxDC& dc, wxArrayString& lines,
1700 long *OUTPUT, long *OUTPUT ),
1701 "GetTextBoxSize(DC dc, list lines) -> (width, height)");
1705 // Code that does a lot of grid modification can be enclosed
1706 // between BeginBatch() and EndBatch() calls to avoid screen
1711 int GetBatchCount();
1712 void ForceRefresh();
1715 // ------ edit control functions
1718 void EnableEditing( bool edit );
1720 void EnableCellEditControl( bool enable = true );
1721 void DisableCellEditControl();
1722 bool CanEnableCellControl() const;
1723 bool IsCellEditControlEnabled() const;
1724 bool IsCellEditControlShown() const;
1726 bool IsCurrentCellReadOnly() const;
1728 void ShowCellEditControl();
1729 void HideCellEditControl();
1730 void SaveEditControlValue();
1733 // ------ grid location functions
1734 // Note that all of these functions work with the logical coordinates of
1735 // grid cells and labels so you will need to convert from device
1736 // coordinates for mouse events etc.
1739 //void XYToCell( int x, int y, wxGridCellCoords& );
1741 wxGridCellCoords XYToCell(int x, int y) {
1742 wxGridCellCoords rv;
1743 self->XYToCell(x, y, rv);
1748 int YToRow( int y );
1749 int XToCol( int x );
1751 int YToEdgeOfRow( int y );
1752 int XToEdgeOfCol( int x );
1754 wxRect CellToRect( int row, int col );
1755 // TODO: ??? wxRect CellToRect( const wxGridCellCoords& coords );
1758 int GetGridCursorRow();
1759 int GetGridCursorCol();
1761 // check to see if a cell is either wholly visible (the default arg) or
1762 // at least partially visible in the grid window
1764 bool IsVisible( int row, int col, bool wholeCellVisible = true );
1765 // TODO: ??? bool IsVisible( const wxGridCellCoords& coords, bool wholeCellVisible = true );
1766 void MakeCellVisible( int row, int col );
1767 // TODO: ??? void MakeCellVisible( const wxGridCellCoords& coords );
1770 // ------ grid cursor movement functions
1772 void SetGridCursor( int row, int col );
1773 bool MoveCursorUp( bool expandSelection );
1774 bool MoveCursorDown( bool expandSelection );
1775 bool MoveCursorLeft( bool expandSelection );
1776 bool MoveCursorRight( bool expandSelection );
1777 bool MovePageDown();
1779 bool MoveCursorUpBlock( bool expandSelection );
1780 bool MoveCursorDownBlock( bool expandSelection );
1781 bool MoveCursorLeftBlock( bool expandSelection );
1782 bool MoveCursorRightBlock( bool expandSelection );
1785 // ------ label and gridline formatting
1787 int GetDefaultRowLabelSize();
1788 int GetRowLabelSize();
1789 int GetDefaultColLabelSize();
1790 int GetColLabelSize();
1791 wxColour GetLabelBackgroundColour();
1792 wxColour GetLabelTextColour();
1793 wxFont GetLabelFont();
1796 void, GetRowLabelAlignment( int *OUTPUT, int *OUTPUT ),
1797 "GetRowLabelAlignment() -> (horiz, vert)");
1800 void, GetColLabelAlignment( int *OUTPUT, int *OUTPUT ),
1801 "GetColLabelAlignment() -> (horiz, vert)");
1803 int GetColLabelTextOrientation();
1804 wxString GetRowLabelValue( int row );
1805 wxString GetColLabelValue( int col );
1806 wxColour GetGridLineColour();
1807 wxColour GetCellHighlightColour();
1808 int GetCellHighlightPenWidth();
1809 int GetCellHighlightROPenWidth();
1811 void SetRowLabelSize( int width );
1812 void SetColLabelSize( int height );
1813 void SetLabelBackgroundColour( const wxColour& );
1814 void SetLabelTextColour( const wxColour& );
1815 void SetLabelFont( const wxFont& );
1816 void SetRowLabelAlignment( int horiz, int vert );
1817 void SetColLabelAlignment( int horiz, int vert );
1818 void SetColLabelTextOrientation( int textOrientation );
1819 void SetRowLabelValue( int row, const wxString& );
1820 void SetColLabelValue( int col, const wxString& );
1821 void SetGridLineColour( const wxColour& );
1822 void SetCellHighlightColour( const wxColour& );
1823 void SetCellHighlightPenWidth(int width);
1824 void SetCellHighlightROPenWidth(int width);
1826 void EnableDragRowSize( bool enable = true );
1827 void DisableDragRowSize();
1828 bool CanDragRowSize();
1829 void EnableDragColSize( bool enable = true );
1830 void DisableDragColSize();
1831 bool CanDragColSize();
1832 void EnableDragGridSize(bool enable = true);
1833 void DisableDragGridSize();
1834 bool CanDragGridSize();
1836 void EnableDragCell( bool enable = true );
1837 void DisableDragCell();
1840 // this sets the specified attribute for all cells in this row/col
1841 void SetAttr(int row, int col, wxGridCellAttr *attr);
1842 void SetRowAttr(int row, wxGridCellAttr *attr);
1843 void SetColAttr(int col, wxGridCellAttr *attr);
1845 // returns the attribute we may modify in place: a new one if this cell
1846 // doesn't have any yet or the existing one if it does
1848 // DecRef() must be called on the returned pointer, as usual
1849 wxGridCellAttr *GetOrCreateCellAttr(int row, int col) const;
1852 // shortcuts for setting the column parameters
1854 // set the format for the data in the column: default is string
1855 void SetColFormatBool(int col);
1856 void SetColFormatNumber(int col);
1857 void SetColFormatFloat(int col, int width = -1, int precision = -1);
1858 void SetColFormatCustom(int col, const wxString& typeName);
1860 void EnableGridLines( bool enable = true );
1861 bool GridLinesEnabled();
1863 // ------ row and col formatting
1865 int GetDefaultRowSize();
1866 int GetRowSize( int row );
1867 int GetDefaultColSize();
1868 int GetColSize( int col );
1869 wxColour GetDefaultCellBackgroundColour();
1870 wxColour GetCellBackgroundColour( int row, int col );
1871 wxColour GetDefaultCellTextColour();
1872 wxColour GetCellTextColour( int row, int col );
1873 wxFont GetDefaultCellFont();
1874 wxFont GetCellFont( int row, int col );
1877 void, GetDefaultCellAlignment( int *OUTPUT, int *OUTPUT ),
1878 "GetDefaultCellAlignment() -> (horiz, vert)");
1881 void, GetCellAlignment( int row, int col, int *OUTPUT, int *OUTPUT ),
1882 "GetCellAlignment() -> (horiz, vert)");
1884 bool GetDefaultCellOverflow();
1885 bool GetCellOverflow( int row, int col );
1888 void, GetCellSize( int row, int col, int *OUTPUT, int *OUTPUT ),
1889 "GetCellSize(int row, int col) -> (num_rows, num_cols)");
1891 void SetDefaultRowSize( int height, bool resizeExistingRows = false );
1892 void SetRowSize( int row, int height );
1893 void SetDefaultColSize( int width, bool resizeExistingCols = false );
1895 void SetColSize( int col, int width );
1897 // automatically size the column or row to fit to its contents, if
1898 // setAsMin is True, this optimal width will also be set as minimal width
1900 void AutoSizeColumn( int col, bool setAsMin = true );
1901 void AutoSizeRow( int row, bool setAsMin = true );
1904 // auto size all columns (very ineffective for big grids!)
1905 void AutoSizeColumns( bool setAsMin = true );
1906 void AutoSizeRows( bool setAsMin = true );
1908 // auto size the grid, that is make the columns/rows of the "right" size
1909 // and also set the grid size to just fit its contents
1912 // autosize row height depending on label text
1913 void AutoSizeRowLabelSize( int row );
1915 // autosize column width depending on label text
1916 void AutoSizeColLabelSize( int col );
1919 // column won't be resized to be lesser width - this must be called during
1920 // the grid creation because it won't resize the column if it's already
1921 // narrower than the minimal width
1922 void SetColMinimalWidth( int col, int width );
1923 void SetRowMinimalHeight( int row, int width );
1925 void SetColMinimalAcceptableWidth( int width );
1926 void SetRowMinimalAcceptableHeight( int width );
1927 int GetColMinimalAcceptableWidth() const;
1928 int GetRowMinimalAcceptableHeight() const;
1930 void SetDefaultCellBackgroundColour( const wxColour& );
1931 void SetCellBackgroundColour( int row, int col, const wxColour& );
1932 void SetDefaultCellTextColour( const wxColour& );
1934 void SetCellTextColour( int row, int col, const wxColour& );
1935 void SetDefaultCellFont( const wxFont& );
1936 void SetCellFont( int row, int col, const wxFont& );
1937 void SetDefaultCellAlignment( int horiz, int vert );
1938 void SetCellAlignment( int row, int col, int horiz, int vert );
1939 void SetDefaultCellOverflow( bool allow );
1940 void SetCellOverflow( int row, int col, bool allow );
1941 void SetCellSize( int row, int col, int num_rows, int num_cols );
1943 // takes ownership of the pointer
1944 void SetDefaultRenderer(wxGridCellRenderer *renderer);
1945 void SetCellRenderer(int row, int col, wxGridCellRenderer *renderer);
1946 wxGridCellRenderer *GetDefaultRenderer() const;
1947 wxGridCellRenderer* GetCellRenderer(int row, int col);
1949 // takes ownership of the pointer
1950 void SetDefaultEditor(wxGridCellEditor *editor);
1951 void SetCellEditor(int row, int col, wxGridCellEditor *editor);
1952 wxGridCellEditor *GetDefaultEditor() const;
1953 wxGridCellEditor* GetCellEditor(int row, int col);
1957 // ------ cell value accessors
1959 wxString GetCellValue( int row, int col );
1960 // TODO: ??? wxString GetCellValue( const wxGridCellCoords& coords )
1962 void SetCellValue( int row, int col, const wxString& s );
1963 // TODO: ??? void SetCellValue( const wxGridCellCoords& coords, const wxString& s )
1965 // returns True if the cell can't be edited
1966 bool IsReadOnly(int row, int col) const;
1968 // make the cell editable/readonly
1969 void SetReadOnly(int row, int col, bool isReadOnly = true);
1971 // ------ selections of blocks of cells
1973 void SelectRow( int row, bool addToSelected = false );
1974 void SelectCol( int col, bool addToSelected = false );
1976 void SelectBlock( int topRow, int leftCol, int bottomRow, int rightCol,
1977 bool addToSelected = false );
1978 // TODO: ??? void SelectBlock( const wxGridCellCoords& topLeft,
1979 // TODO: ??? const wxGridCellCoords& bottomRight )
1983 void ClearSelection();
1984 bool IsInSelection( int row, int col );
1985 // TODO: ??? bool IsInSelection( const wxGridCellCoords& coords )
1987 const wxGridCellCoordsArray GetSelectedCells() const;
1988 const wxGridCellCoordsArray GetSelectionBlockTopLeft() const;
1989 const wxGridCellCoordsArray GetSelectionBlockBottomRight() const;
1990 const wxArrayInt GetSelectedRows() const;
1991 const wxArrayInt GetSelectedCols() const;
1993 void DeselectRow( int row );
1994 void DeselectCol( int col );
1995 void DeselectCell( int row, int col );
1998 // This function returns the rectangle that encloses the block of cells
1999 // limited by TopLeft and BottomRight cell in device coords and clipped
2000 // to the client size of the grid window.
2002 wxRect BlockToDeviceRect( const wxGridCellCoords & topLeft,
2003 const wxGridCellCoords & bottomRight );
2006 // Access or update the selection fore/back colours
2007 wxColour GetSelectionBackground() const;
2008 wxColour GetSelectionForeground() const;
2010 void SetSelectionBackground(const wxColour& c);
2011 void SetSelectionForeground(const wxColour& c);
2014 // Methods for a registry for mapping data types to Renderers/Editors
2015 void RegisterDataType(const wxString& typeName,
2016 wxGridCellRenderer* renderer,
2017 wxGridCellEditor* editor);
2018 wxGridCellEditor* GetDefaultEditorForCell(int row, int col) const;
2019 // TODO: ??? wxGridCellEditor* GetDefaultEditorForCell(const wxGridCellCoords& c) const
2020 wxGridCellRenderer* GetDefaultRendererForCell(int row, int col) const;
2021 wxGridCellEditor* GetDefaultEditorForType(const wxString& typeName) const;
2022 wxGridCellRenderer* GetDefaultRendererForType(const wxString& typeName) const;
2024 // grid may occupy more space than needed for its rows/columns, this
2025 // function allows to set how big this extra space is
2026 void SetMargins(int extraWidth, int extraHeight);
2029 // Accessors for component windows
2030 wxWindow* GetGridWindow();
2031 wxWindow* GetGridRowLabelWindow();
2032 wxWindow* GetGridColLabelWindow();
2033 wxWindow* GetGridCornerLabelWindow();
2035 // Allow adjustment of scroll increment. The default is (15, 15).
2036 void SetScrollLineX(int x);
2037 void SetScrollLineY(int y);
2038 int GetScrollLineX() const;
2039 int GetScrollLineY() const;
2041 int GetScrollX(int x) const;
2042 int GetScrollY(int y) const;
2044 static wxVisualAttributes
2045 GetClassDefaultAttributes(wxWindowVariant variant = wxWINDOW_VARIANT_NORMAL);
2049 //---------------------------------------------------------------------------
2050 //---------------------------------------------------------------------------
2051 // Grid events and stuff
2055 class wxGridEvent : public wxNotifyEvent
2058 wxGridEvent(int id, wxEventType type, wxGrid* obj,
2059 int row=-1, int col=-1, int x=-1, int y=-1, bool sel = true,
2060 bool control=false, bool shift=false, bool alt=false, bool meta=false);
2062 virtual int GetRow();
2063 virtual int GetCol();
2064 wxPoint GetPosition();
2074 class wxGridSizeEvent : public wxNotifyEvent
2077 wxGridSizeEvent(int id, wxEventType type, wxGrid* obj,
2078 int rowOrCol=-1, int x=-1, int y=-1,
2079 bool control=false, bool shift=false, bool alt=false, bool meta=false);
2082 wxPoint GetPosition();
2091 class wxGridRangeSelectEvent : public wxNotifyEvent
2094 wxGridRangeSelectEvent(int id, wxEventType type, wxGrid* obj,
2095 const wxGridCellCoords& topLeft,
2096 const wxGridCellCoords& bottomRight,
2098 bool control=false, bool shift=false,
2099 bool alt=false, bool meta=false);
2101 wxGridCellCoords GetTopLeftCoords();
2102 wxGridCellCoords GetBottomRightCoords();
2116 class wxGridEditorCreatedEvent : public wxCommandEvent {
2118 wxGridEditorCreatedEvent(int id, wxEventType type, wxObject* obj,
2119 int row, int col, wxControl* ctrl);
2123 wxControl* GetControl();
2124 void SetRow(int row);
2125 void SetCol(int col);
2126 void SetControl(wxControl* ctrl);
2131 %constant wxEventType wxEVT_GRID_CELL_LEFT_CLICK;
2132 %constant wxEventType wxEVT_GRID_CELL_RIGHT_CLICK;
2133 %constant wxEventType wxEVT_GRID_CELL_LEFT_DCLICK;
2134 %constant wxEventType wxEVT_GRID_CELL_RIGHT_DCLICK;
2135 %constant wxEventType wxEVT_GRID_LABEL_LEFT_CLICK;
2136 %constant wxEventType wxEVT_GRID_LABEL_RIGHT_CLICK;
2137 %constant wxEventType wxEVT_GRID_LABEL_LEFT_DCLICK;
2138 %constant wxEventType wxEVT_GRID_LABEL_RIGHT_DCLICK;
2139 %constant wxEventType wxEVT_GRID_ROW_SIZE;
2140 %constant wxEventType wxEVT_GRID_COL_SIZE;
2141 %constant wxEventType wxEVT_GRID_RANGE_SELECT;
2142 %constant wxEventType wxEVT_GRID_CELL_CHANGE;
2143 %constant wxEventType wxEVT_GRID_SELECT_CELL;
2144 %constant wxEventType wxEVT_GRID_EDITOR_SHOWN;
2145 %constant wxEventType wxEVT_GRID_EDITOR_HIDDEN;
2146 %constant wxEventType wxEVT_GRID_EDITOR_CREATED;
2147 %constant wxEventType wxEVT_GRID_CELL_BEGIN_DRAG;
2152 EVT_GRID_CELL_LEFT_CLICK = wx.PyEventBinder( wxEVT_GRID_CELL_LEFT_CLICK )
2153 EVT_GRID_CELL_RIGHT_CLICK = wx.PyEventBinder( wxEVT_GRID_CELL_RIGHT_CLICK )
2154 EVT_GRID_CELL_LEFT_DCLICK = wx.PyEventBinder( wxEVT_GRID_CELL_LEFT_DCLICK )
2155 EVT_GRID_CELL_RIGHT_DCLICK = wx.PyEventBinder( wxEVT_GRID_CELL_RIGHT_DCLICK )
2156 EVT_GRID_LABEL_LEFT_CLICK = wx.PyEventBinder( wxEVT_GRID_LABEL_LEFT_CLICK )
2157 EVT_GRID_LABEL_RIGHT_CLICK = wx.PyEventBinder( wxEVT_GRID_LABEL_RIGHT_CLICK )
2158 EVT_GRID_LABEL_LEFT_DCLICK = wx.PyEventBinder( wxEVT_GRID_LABEL_LEFT_DCLICK )
2159 EVT_GRID_LABEL_RIGHT_DCLICK = wx.PyEventBinder( wxEVT_GRID_LABEL_RIGHT_DCLICK )
2160 EVT_GRID_ROW_SIZE = wx.PyEventBinder( wxEVT_GRID_ROW_SIZE )
2161 EVT_GRID_COL_SIZE = wx.PyEventBinder( wxEVT_GRID_COL_SIZE )
2162 EVT_GRID_RANGE_SELECT = wx.PyEventBinder( wxEVT_GRID_RANGE_SELECT )
2163 EVT_GRID_CELL_CHANGE = wx.PyEventBinder( wxEVT_GRID_CELL_CHANGE )
2164 EVT_GRID_SELECT_CELL = wx.PyEventBinder( wxEVT_GRID_SELECT_CELL )
2165 EVT_GRID_EDITOR_SHOWN = wx.PyEventBinder( wxEVT_GRID_EDITOR_SHOWN )
2166 EVT_GRID_EDITOR_HIDDEN = wx.PyEventBinder( wxEVT_GRID_EDITOR_HIDDEN )
2167 EVT_GRID_EDITOR_CREATED = wx.PyEventBinder( wxEVT_GRID_EDITOR_CREATED )
2168 EVT_GRID_CELL_BEGIN_DRAG = wx.PyEventBinder( wxEVT_GRID_CELL_BEGIN_DRAG )
2171 %# The same as above but with the ability to specify an identifier
2172 EVT_GRID_CMD_CELL_LEFT_CLICK = wx.PyEventBinder( wxEVT_GRID_CELL_LEFT_CLICK, 1 )
2173 EVT_GRID_CMD_CELL_RIGHT_CLICK = wx.PyEventBinder( wxEVT_GRID_CELL_RIGHT_CLICK, 1 )
2174 EVT_GRID_CMD_CELL_LEFT_DCLICK = wx.PyEventBinder( wxEVT_GRID_CELL_LEFT_DCLICK, 1 )
2175 EVT_GRID_CMD_CELL_RIGHT_DCLICK = wx.PyEventBinder( wxEVT_GRID_CELL_RIGHT_DCLICK, 1 )
2176 EVT_GRID_CMD_LABEL_LEFT_CLICK = wx.PyEventBinder( wxEVT_GRID_LABEL_LEFT_CLICK, 1 )
2177 EVT_GRID_CMD_LABEL_RIGHT_CLICK = wx.PyEventBinder( wxEVT_GRID_LABEL_RIGHT_CLICK, 1 )
2178 EVT_GRID_CMD_LABEL_LEFT_DCLICK = wx.PyEventBinder( wxEVT_GRID_LABEL_LEFT_DCLICK, 1 )
2179 EVT_GRID_CMD_LABEL_RIGHT_DCLICK = wx.PyEventBinder( wxEVT_GRID_LABEL_RIGHT_DCLICK, 1 )
2180 EVT_GRID_CMD_ROW_SIZE = wx.PyEventBinder( wxEVT_GRID_ROW_SIZE, 1 )
2181 EVT_GRID_CMD_COL_SIZE = wx.PyEventBinder( wxEVT_GRID_COL_SIZE, 1 )
2182 EVT_GRID_CMD_RANGE_SELECT = wx.PyEventBinder( wxEVT_GRID_RANGE_SELECT, 1 )
2183 EVT_GRID_CMD_CELL_CHANGE = wx.PyEventBinder( wxEVT_GRID_CELL_CHANGE, 1 )
2184 EVT_GRID_CMD_SELECT_CELL = wx.PyEventBinder( wxEVT_GRID_SELECT_CELL, 1 )
2185 EVT_GRID_CMD_EDITOR_SHOWN = wx.PyEventBinder( wxEVT_GRID_EDITOR_SHOWN, 1 )
2186 EVT_GRID_CMD_EDITOR_HIDDEN = wx.PyEventBinder( wxEVT_GRID_EDITOR_HIDDEN, 1 )
2187 EVT_GRID_CMD_EDITOR_CREATED = wx.PyEventBinder( wxEVT_GRID_EDITOR_CREATED, 1 )
2188 EVT_GRID_CMD_CELL_BEGIN_DRAG = wx.PyEventBinder( wxEVT_GRID_CELL_BEGIN_DRAG, 1 )
2192 //---------------------------------------------------------------------------
2197 //---------------------------------------------------------------------------
2198 //---------------------------------------------------------------------------