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 //---------------------------------------------------------------------------
494 // wxGridCellRenderer is an ABC, and several derived classes are available.
495 // Classes implemented in Python should be derived from wxPyGridCellRenderer.
498 class wxGridCellRenderer
502 void _setOORInfo(PyObject* _self) {
503 if (!self->GetClientObject())
504 self->SetClientObject(new wxPyOORClientData(_self));
508 void SetParameters(const wxString& params);
512 virtual void Draw(wxGrid& grid,
513 wxGridCellAttr& attr,
518 virtual wxSize GetBestSize(wxGrid& grid,
519 wxGridCellAttr& attr,
522 virtual wxGridCellRenderer *Clone() const;
526 // The C++ version of wxPyGridCellRenderer
528 class wxPyGridCellRenderer : public wxGridCellRenderer
531 wxPyGridCellRenderer() : wxGridCellRenderer() {};
533 // Implement Python callback aware virtual methods
534 void Draw(wxGrid& grid, wxGridCellAttr& attr,
535 wxDC& dc, const wxRect& rect,
536 int row, int col, bool isSelected) {
537 wxPyBlock_t blocked = wxPyBeginBlockThreads();
538 if (wxPyCBH_findCallback(m_myInst, "Draw")) {
539 PyObject* go = wxPyMake_wxObject(&grid,false);
540 PyObject* dco = wxPyMake_wxObject(&dc,false);
541 PyObject* ao = wxPyMake_wxGridCellAttr(&attr,false);
542 PyObject* ro = wxPyConstructObject((void*)&rect, wxT("wxRect"), 0);
544 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(OOOOiii)", go, ao, dco, ro,
545 row, col, isSelected));
551 wxPyEndBlockThreads(blocked);
554 wxSize GetBestSize(wxGrid& grid, wxGridCellAttr& attr, wxDC& dc,
557 wxPyBlock_t blocked = wxPyBeginBlockThreads();
558 if (wxPyCBH_findCallback(m_myInst, "GetBestSize")) {
561 PyObject* go = wxPyMake_wxObject(&grid,false);
562 PyObject* dco = wxPyMake_wxObject(&dc,false);
563 PyObject* ao = wxPyMake_wxGridCellAttr(&attr,false);
565 ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("(OOOii)",
573 const char* errmsg = "GetBestSize should return a 2-tuple of integers or a wxSize object.";
574 if (wxPyConvertSwigPtr(ro, (void **)&ptr, wxT("wxSize"))) {
577 else if (PySequence_Check(ro) && PyObject_Length(ro) == 2) {
578 PyObject* o1 = PySequence_GetItem(ro, 0);
579 PyObject* o2 = PySequence_GetItem(ro, 1);
580 if (PyNumber_Check(o1) && PyNumber_Check(o2))
581 rval = wxSize(PyInt_AsLong(o1), PyInt_AsLong(o2));
583 PyErr_SetString(PyExc_TypeError, errmsg);
588 PyErr_SetString(PyExc_TypeError, errmsg);
593 wxPyEndBlockThreads(blocked);
598 wxGridCellRenderer *Clone() const {
599 wxGridCellRenderer* rval = NULL;
600 wxPyBlock_t blocked = wxPyBeginBlockThreads();
601 if (wxPyCBH_findCallback(m_myInst, "Clone")) {
603 wxGridCellRenderer* ptr;
604 ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("()"));
606 if (wxPyConvertSwigPtr(ro, (void **)&ptr, wxT("wxGridCellRenderer")))
611 wxPyEndBlockThreads(blocked);
615 DEC_PYCALLBACK__STRING(SetParameters);
620 IMP_PYCALLBACK__STRING( wxPyGridCellRenderer, wxGridCellRenderer, SetParameters);
625 // Let SWIG know about it so it can create the Python version
626 class wxPyGridCellRenderer : public wxGridCellRenderer {
628 %pythonAppend wxPyGridCellRenderer "self._setCallbackInfo(self, PyGridCellRenderer);self._setOORInfo(self)"
630 wxPyGridCellRenderer();
631 void _setCallbackInfo(PyObject* self, PyObject* _class);
633 void SetParameters(const wxString& params);
634 %MAKE_BASE_FUNC(PyGridCellRenderer, SetParameters);
637 //---------------------------------------------------------------------------
638 // Predefined Renderers
640 class wxGridCellStringRenderer : public wxGridCellRenderer
643 %pythonAppend wxGridCellStringRenderer "self._setOORInfo(self)"
644 wxGridCellStringRenderer();
648 class wxGridCellNumberRenderer : public wxGridCellStringRenderer
651 %pythonAppend wxGridCellNumberRenderer "self._setOORInfo(self)"
652 wxGridCellNumberRenderer();
656 class wxGridCellFloatRenderer : public wxGridCellStringRenderer
659 %pythonAppend wxGridCellFloatRenderer "self._setOORInfo(self)"
660 wxGridCellFloatRenderer(int width = -1, int precision = -1);
662 int GetWidth() const;
663 void SetWidth(int width);
664 int GetPrecision() const;
665 void SetPrecision(int precision);
669 class wxGridCellBoolRenderer : public wxGridCellRenderer
672 %pythonAppend wxGridCellBoolRenderer "self._setOORInfo(self)"
673 wxGridCellBoolRenderer();
677 class wxGridCellDateTimeRenderer : public wxGridCellStringRenderer
680 %pythonAppend wxGridCellDateTimeRenderer "self._setOORInfo(self)"
681 wxGridCellDateTimeRenderer(wxString outformat = wxPyDefaultDateTimeFormat,
682 wxString informat = wxPyDefaultDateTimeFormat);
686 class wxGridCellEnumRenderer : public wxGridCellStringRenderer
689 %pythonAppend wxGridCellEnumRenderer "self._setOORInfo(self)"
690 wxGridCellEnumRenderer( const wxString& choices = wxPyEmptyString );
694 class wxGridCellAutoWrapStringRenderer : public wxGridCellStringRenderer
697 %pythonAppend wxGridCellAutoWrapStringRenderer "self._setOORInfo(self)"
698 wxGridCellAutoWrapStringRenderer();
702 //---------------------------------------------------------------------------
703 // wxGridCellEditor is an ABC, and several derived classes are available.
704 // Classes implemented in Python should be derived from wxPyGridCellEditor.
706 class wxGridCellEditor
710 void _setOORInfo(PyObject* _self) {
711 if (!self->GetClientObject())
712 self->SetClientObject(new wxPyOORClientData(_self));
717 wxControl* GetControl();
718 void SetControl(wxControl* control);
720 wxGridCellAttr* GetCellAttr();
721 void SetCellAttr(wxGridCellAttr* attr);
723 void SetParameters(const wxString& params);
727 virtual void Create(wxWindow* parent,
729 wxEvtHandler* evtHandler);
730 virtual void BeginEdit(int row, int col, wxGrid* grid);
731 virtual bool EndEdit(int row, int col, wxGrid* grid);
732 virtual void Reset();
733 virtual wxGridCellEditor *Clone() const;
735 virtual void SetSize(const wxRect& rect);
736 virtual void Show(bool show, wxGridCellAttr *attr = NULL);
737 virtual void PaintBackground(const wxRect& rectCell, wxGridCellAttr *attr);
738 virtual bool IsAcceptedKey(wxKeyEvent& event);
739 virtual void StartingKey(wxKeyEvent& event);
740 virtual void StartingClick();
741 virtual void HandleReturn(wxKeyEvent& event);
743 %pythonAppend Destroy "args[0].thisown = 0"
744 virtual void Destroy();
749 // The C++ version of wxPyGridCellEditor
751 class wxPyGridCellEditor : public wxGridCellEditor
754 wxPyGridCellEditor() : wxGridCellEditor() {}
756 void Create(wxWindow* parent, wxWindowID id, wxEvtHandler* evtHandler) {
757 wxPyBlock_t blocked = wxPyBeginBlockThreads();
758 if (wxPyCBH_findCallback(m_myInst, "Create")) {
759 PyObject* po = wxPyMake_wxObject(parent,false);
760 PyObject* eo = wxPyMake_wxObject(evtHandler,false);
762 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(OiO)", po, id, eo));
766 wxPyEndBlockThreads(blocked);
770 void BeginEdit(int row, int col, wxGrid* grid) {
771 wxPyBlock_t blocked = wxPyBeginBlockThreads();
772 if (wxPyCBH_findCallback(m_myInst, "BeginEdit")) {
773 PyObject* go = wxPyMake_wxObject(grid,false);
774 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(iiO)", row, col, go));
777 wxPyEndBlockThreads(blocked);
781 bool EndEdit(int row, int col, wxGrid* grid) {
783 wxPyBlock_t blocked = wxPyBeginBlockThreads();
784 if (wxPyCBH_findCallback(m_myInst, "EndEdit")) {
785 PyObject* go = wxPyMake_wxObject(grid,false);
786 rv = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(iiO)", row, col, go));
789 wxPyEndBlockThreads(blocked);
794 wxGridCellEditor* Clone() const {
795 wxGridCellEditor* rval = NULL;
796 wxPyBlock_t blocked = wxPyBeginBlockThreads();
797 if (wxPyCBH_findCallback(m_myInst, "Clone")) {
799 wxGridCellEditor* ptr;
800 ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("()"));
802 if (wxPyConvertSwigPtr(ro, (void **)&ptr, wxT("wxGridCellEditor")))
807 wxPyEndBlockThreads(blocked);
812 void Show(bool show, wxGridCellAttr *attr) {
814 wxPyBlock_t blocked = wxPyBeginBlockThreads();
815 if ((found = wxPyCBH_findCallback(m_myInst, "Show"))) {
816 PyObject* ao = wxPyMake_wxGridCellAttr(attr,false);
817 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(iO)", show, ao));
820 wxPyEndBlockThreads(blocked);
822 wxGridCellEditor::Show(show, attr);
826 void PaintBackground(const wxRect& rectCell, wxGridCellAttr *attr) {
828 wxPyBlock_t blocked = wxPyBeginBlockThreads();
829 if ((found = wxPyCBH_findCallback(m_myInst, "PaintBackground)"))) {
830 PyObject* ao = wxPyMake_wxGridCellAttr(attr,false);
831 PyObject* ro = wxPyConstructObject((void*)&rectCell, wxT("wxRect"), 0);
833 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(OO)", ro, ao));
838 wxPyEndBlockThreads(blocked);
840 wxGridCellEditor::PaintBackground(rectCell, attr);
844 DEC_PYCALLBACK___pure(Reset);
845 DEC_PYCALLBACK__constany(SetSize, wxRect);
846 DEC_PYCALLBACK_bool_any(IsAcceptedKey, wxKeyEvent);
847 DEC_PYCALLBACK__any(StartingKey, wxKeyEvent);
848 DEC_PYCALLBACK__any(HandleReturn, wxKeyEvent);
849 DEC_PYCALLBACK__(StartingClick);
850 DEC_PYCALLBACK__(Destroy);
851 DEC_PYCALLBACK__STRING(SetParameters);
852 DEC_PYCALLBACK_STRING__constpure(GetValue);
858 IMP_PYCALLBACK__STRING( wxPyGridCellEditor, wxGridCellEditor, SetParameters);
859 IMP_PYCALLBACK___pure(wxPyGridCellEditor, wxGridCellEditor, Reset);
860 IMP_PYCALLBACK__constany(wxPyGridCellEditor, wxGridCellEditor, SetSize, wxRect);
861 IMP_PYCALLBACK_bool_any(wxPyGridCellEditor, wxGridCellEditor, IsAcceptedKey, wxKeyEvent);
862 IMP_PYCALLBACK__any(wxPyGridCellEditor, wxGridCellEditor, StartingKey, wxKeyEvent);
863 IMP_PYCALLBACK__any(wxPyGridCellEditor, wxGridCellEditor, HandleReturn, wxKeyEvent);
864 IMP_PYCALLBACK__(wxPyGridCellEditor, wxGridCellEditor, StartingClick);
865 IMP_PYCALLBACK__(wxPyGridCellEditor, wxGridCellEditor, Destroy);
866 IMP_PYCALLBACK_STRING__constpure(wxPyGridCellEditor, wxGridCellEditor, GetValue);
871 // Let SWIG know about it so it can create the Python version
872 class wxPyGridCellEditor : public wxGridCellEditor {
874 %pythonAppend wxPyGridCellEditor "self._setCallbackInfo(self, PyGridCellEditor);self._setOORInfo(self)"
876 wxPyGridCellEditor();
877 void _setCallbackInfo(PyObject* self, PyObject* _class);
879 void SetSize(const wxRect& rect);
880 void Show(bool show, wxGridCellAttr *attr = NULL);
881 void PaintBackground(const wxRect& rectCell, wxGridCellAttr *attr);
882 bool IsAcceptedKey(wxKeyEvent& event);
883 void StartingKey(wxKeyEvent& event);
884 void StartingClick();
885 void HandleReturn(wxKeyEvent& event);
887 void SetParameters(const wxString& params);
889 %MAKE_BASE_FUNC(PyGridCellEditor, SetSize);
890 %MAKE_BASE_FUNC(PyGridCellEditor, Show);
891 %MAKE_BASE_FUNC(PyGridCellEditor, PaintBackground);
892 %MAKE_BASE_FUNC(PyGridCellEditor, IsAcceptedKey);
893 %MAKE_BASE_FUNC(PyGridCellEditor, StartingKey);
894 %MAKE_BASE_FUNC(PyGridCellEditor, StartingClick);
895 %MAKE_BASE_FUNC(PyGridCellEditor, HandleReturn);
896 %MAKE_BASE_FUNC(PyGridCellEditor, Destroy);
897 %MAKE_BASE_FUNC(PyGridCellEditor, SetParameters);
900 //---------------------------------------------------------------------------
901 // Predefined Editors
903 class wxGridCellTextEditor : public wxGridCellEditor
906 %pythonAppend wxGridCellTextEditor "self._setOORInfo(self)"
907 wxGridCellTextEditor();
908 virtual wxString GetValue();
912 class wxGridCellNumberEditor : public wxGridCellTextEditor
915 %pythonAppend wxGridCellNumberEditor "self._setOORInfo(self)"
916 wxGridCellNumberEditor(int min = -1, int max = -1);
917 virtual wxString GetValue();
921 class wxGridCellFloatEditor : public wxGridCellTextEditor
924 %pythonAppend wxGridCellFloatEditor "self._setOORInfo(self)"
925 wxGridCellFloatEditor(int width = -1, int precision = -1);
926 virtual wxString GetValue();
930 class wxGridCellBoolEditor : public wxGridCellEditor
933 %pythonAppend wxGridCellBoolEditor "self._setOORInfo(self)"
934 wxGridCellBoolEditor();
935 virtual wxString GetValue();
938 class wxGridCellChoiceEditor : public wxGridCellEditor
941 %pythonAppend wxGridCellChoiceEditor "self._setOORInfo(self)"
942 wxGridCellChoiceEditor(int choices = 0,
943 const wxString* choices_array = NULL,
944 bool allowOthers = false);
945 virtual wxString GetValue();
949 class wxGridCellEnumEditor : public wxGridCellChoiceEditor
952 %pythonAppend wxGridCellEnumEditor "self._setOORInfo(self)"
953 wxGridCellEnumEditor( const wxString& choices = wxPyEmptyString );
954 virtual wxString GetValue();
958 class wxGridCellAutoWrapStringEditor : public wxGridCellTextEditor
961 %pythonAppend wxGridCellAutoWrapStringEditor "self._setOORInfo(self)"
962 wxGridCellAutoWrapStringEditor();
963 virtual wxString GetValue();
968 //---------------------------------------------------------------------------
985 void _setOORInfo(PyObject* _self) {
986 if (!self->GetClientObject())
987 self->SetClientObject(new wxPyOORClientData(_self));
991 %pythonAppend wxGridCellAttr "self._setOORInfo(self)"
993 wxGridCellAttr(wxGridCellAttr *attrDefault = NULL);
995 wxGridCellAttr *Clone() const;
996 void MergeWith(wxGridCellAttr *mergefrom);
999 void SetTextColour(const wxColour& colText);
1000 void SetBackgroundColour(const wxColour& colBack);
1001 void SetFont(const wxFont& font);
1002 void SetAlignment(int hAlign, int vAlign);
1003 void SetSize(int num_rows, int num_cols);
1004 void SetOverflow( bool allow = true );
1005 void SetReadOnly(bool isReadOnly = true);
1007 void SetRenderer(wxGridCellRenderer *renderer);
1008 void SetEditor(wxGridCellEditor* editor);
1009 void SetKind(wxAttrKind kind);
1011 bool HasTextColour() const;
1012 bool HasBackgroundColour() const;
1013 bool HasFont() const;
1014 bool HasAlignment() const;
1015 bool HasRenderer() const;
1016 bool HasEditor() const;
1017 bool HasReadWriteMode() const;
1018 bool HasOverflowMode() const;
1020 wxColour GetTextColour() const;
1021 wxColour GetBackgroundColour() const;
1022 wxFont GetFont() const;
1025 void, GetAlignment(int *OUTPUT, int *OUTPUT) const,
1026 "GetAlignment() -> (hAlign, vAlign)");
1029 void, GetSize(int *OUTPUT, int *OUTPUT) const,
1030 "GetSize() -> (num_rows, num_cols)");
1032 bool GetOverflow() const;
1033 wxGridCellRenderer *GetRenderer(wxGrid* grid, int row, int col) const;
1034 wxGridCellEditor *GetEditor(wxGrid* grid, int row, int col) const;
1036 bool IsReadOnly() const;
1037 wxAttrKind GetKind();
1038 void SetDefAttr(wxGridCellAttr* defAttr);
1041 //---------------------------------------------------------------------------
1043 class wxGridCellAttrProvider
1046 %pythonAppend wxGridCellAttrProvider "self._setOORInfo(self)"
1047 wxGridCellAttrProvider();
1048 // ???? virtual ~wxGridCellAttrProvider();
1051 void _setOORInfo(PyObject* _self) {
1052 if (!self->GetClientObject())
1053 self->SetClientObject(new wxPyOORClientData(_self));
1057 wxGridCellAttr *GetAttr(int row, int col,
1058 wxGridCellAttr::wxAttrKind kind) const;
1059 void SetAttr(wxGridCellAttr *attr, int row, int col);
1060 void SetRowAttr(wxGridCellAttr *attr, int row);
1061 void SetColAttr(wxGridCellAttr *attr, int col);
1063 void UpdateAttrRows( size_t pos, int numRows );
1064 void UpdateAttrCols( size_t pos, int numCols );
1069 // A Python-aware version
1071 class wxPyGridCellAttrProvider : public wxGridCellAttrProvider
1074 wxPyGridCellAttrProvider() : wxGridCellAttrProvider() {};
1076 PYCALLBACK_GCA_INTINTKIND(wxGridCellAttrProvider, GetAttr);
1077 PYCALLBACK__GCAINTINT(wxGridCellAttrProvider, SetAttr);
1078 PYCALLBACK__GCAINT(wxGridCellAttrProvider, SetRowAttr);
1079 PYCALLBACK__GCAINT(wxGridCellAttrProvider, SetColAttr);
1086 // The python-aware version get's SWIGified
1087 class wxPyGridCellAttrProvider : public wxGridCellAttrProvider
1090 %pythonAppend wxPyGridCellAttrProvider "self._setCallbackInfo(self, PyGridCellAttrProvider)"
1091 wxPyGridCellAttrProvider();
1092 void _setCallbackInfo(PyObject* self, PyObject* _class);
1094 wxGridCellAttr *GetAttr(int row, int col,
1095 wxGridCellAttr::wxAttrKind kind);
1096 void SetAttr(wxGridCellAttr *attr, int row, int col);
1097 void SetRowAttr(wxGridCellAttr *attr, int row);
1098 void SetColAttr(wxGridCellAttr *attr, int col);
1100 %MAKE_BASE_FUNC(PyGridCellAttrProvider, GetAttr);
1101 %MAKE_BASE_FUNC(PyGridCellAttrProvider, SetAttr);
1102 %MAKE_BASE_FUNC(PyGridCellAttrProvider, SetRowAttr);
1103 %MAKE_BASE_FUNC(PyGridCellAttrProvider, SetColAttr);
1107 //---------------------------------------------------------------------------
1108 // Grid Table Base class and Python aware version
1111 class wxGridTableBase : public wxObject
1114 // wxGridTableBase(); This is an ABC
1115 //~wxGridTableBase();
1118 void _setOORInfo(PyObject* _self) {
1119 if (!self->GetClientObject())
1120 self->SetClientObject(new wxPyOORClientData(_self));
1124 void SetAttrProvider(wxGridCellAttrProvider *attrProvider);
1125 wxGridCellAttrProvider *GetAttrProvider() const;
1126 void SetView( wxGrid *grid );
1127 wxGrid * GetView() const;
1131 virtual int GetNumberRows();
1132 virtual int GetNumberCols();
1133 virtual bool IsEmptyCell( int row, int col );
1134 virtual wxString GetValue( int row, int col );
1135 virtual void SetValue( int row, int col, const wxString& value );
1137 // virtuals overridable in wxPyGridTableBase
1138 virtual wxString GetTypeName( int row, int col );
1139 virtual bool CanGetValueAs( int row, int col, const wxString& typeName );
1140 virtual bool CanSetValueAs( int row, int col, const wxString& typeName );
1141 virtual long GetValueAsLong( int row, int col );
1142 virtual double GetValueAsDouble( int row, int col );
1143 virtual bool GetValueAsBool( int row, int col );
1144 virtual void SetValueAsLong( int row, int col, long value );
1145 virtual void SetValueAsDouble( int row, int col, double value );
1146 virtual void SetValueAsBool( int row, int col, bool value );
1148 //virtual void* GetValueAsCustom( int row, int col, const wxString& typeName );
1149 //virtual void SetValueAsCustom( int row, int col, const wxString& typeName, void* value );
1152 virtual void Clear();
1153 virtual bool InsertRows( size_t pos = 0, size_t numRows = 1 );
1154 virtual bool AppendRows( size_t numRows = 1 );
1155 virtual bool DeleteRows( size_t pos = 0, size_t numRows = 1 );
1156 virtual bool InsertCols( size_t pos = 0, size_t numCols = 1 );
1157 virtual bool AppendCols( size_t numCols = 1 );
1158 virtual bool DeleteCols( size_t pos = 0, size_t numCols = 1 );
1160 virtual wxString GetRowLabelValue( int row );
1161 virtual wxString GetColLabelValue( int col );
1162 virtual void SetRowLabelValue( int row, const wxString& value );
1163 virtual void SetColLabelValue( int col, const wxString& value );
1165 virtual bool CanHaveAttributes();
1167 virtual wxGridCellAttr *GetAttr( int row, int col,
1168 wxGridCellAttr::wxAttrKind kind);
1169 virtual void SetAttr(wxGridCellAttr* attr, int row, int col);
1170 virtual void SetRowAttr(wxGridCellAttr *attr, int row);
1171 virtual void SetColAttr(wxGridCellAttr *attr, int col);
1177 // Python-aware version
1179 class wxPyGridTableBase : public wxGridTableBase
1182 wxPyGridTableBase() : wxGridTableBase() {}
1184 PYCALLBACK_INT__pure(GetNumberRows);
1185 PYCALLBACK_INT__pure(GetNumberCols);
1186 PYCALLBACK_BOOL_INTINT_pure(IsEmptyCell);
1187 PYCALLBACK_STRING_INTINT(wxGridTableBase, GetTypeName);
1188 PYCALLBACK_BOOL_INTINTSTRING(wxGridTableBase, CanGetValueAs);
1189 PYCALLBACK_BOOL_INTINTSTRING(wxGridTableBase, CanSetValueAs);
1190 PYCALLBACK__(wxGridTableBase, Clear);
1191 PYCALLBACK_BOOL_SIZETSIZET(wxGridTableBase, InsertRows);
1192 PYCALLBACK_BOOL_SIZETSIZET(wxGridTableBase, DeleteRows);
1193 PYCALLBACK_BOOL_SIZETSIZET(wxGridTableBase, InsertCols);
1194 PYCALLBACK_BOOL_SIZETSIZET(wxGridTableBase, DeleteCols);
1195 PYCALLBACK_BOOL_SIZET(wxGridTableBase, AppendRows);
1196 PYCALLBACK_BOOL_SIZET(wxGridTableBase, AppendCols);
1197 PYCALLBACK_STRING_INT(wxGridTableBase, GetRowLabelValue);
1198 PYCALLBACK_STRING_INT(wxGridTableBase, GetColLabelValue);
1199 PYCALLBACK__INTSTRING(wxGridTableBase, SetRowLabelValue);
1200 PYCALLBACK__INTSTRING(wxGridTableBase, SetColLabelValue);
1201 PYCALLBACK_BOOL_(wxGridTableBase, CanHaveAttributes);
1202 PYCALLBACK_GCA_INTINTKIND(wxGridTableBase, GetAttr);
1203 PYCALLBACK__GCAINTINT(wxGridTableBase, SetAttr);
1204 PYCALLBACK__GCAINT(wxGridTableBase, SetRowAttr);
1205 PYCALLBACK__GCAINT(wxGridTableBase, SetColAttr);
1208 wxString GetValue(int row, int col) {
1209 wxPyBlock_t blocked = wxPyBeginBlockThreads();
1211 if (wxPyCBH_findCallback(m_myInst, "GetValue")) {
1213 ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("(ii)",row,col));
1215 if (!PyString_Check(ro) && !PyUnicode_Check(ro)) {
1217 ro = PyObject_Str(ro);
1220 rval = Py2wxString(ro);
1224 wxPyEndBlockThreads(blocked);
1228 void SetValue(int row, int col, const wxString& val) {
1229 wxPyBlock_t blocked = wxPyBeginBlockThreads();
1230 if (wxPyCBH_findCallback(m_myInst, "SetValue")) {
1231 PyObject* s = wx2PyString(val);
1232 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(iiO)",row,col,s));
1235 wxPyEndBlockThreads(blocked);
1239 // Map the Get/Set methods for the standard non-string types to
1240 // the GetValue and SetValue python methods.
1241 long GetValueAsLong( int row, int col ) {
1243 wxPyBlock_t blocked = wxPyBeginBlockThreads();
1244 if (wxPyCBH_findCallback(m_myInst, "GetValue")) {
1247 ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("(ii)", row, col));
1248 if (ro && PyNumber_Check(ro)) {
1249 num = PyNumber_Int(ro);
1251 rval = PyInt_AsLong(num);
1257 wxPyEndBlockThreads(blocked);
1261 double GetValueAsDouble( int row, int col ) {
1263 wxPyBlock_t blocked = wxPyBeginBlockThreads();
1264 if (wxPyCBH_findCallback(m_myInst, "GetValue")) {
1267 ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("(ii)", row, col));
1268 if (ro && PyNumber_Check(ro)) {
1269 num = PyNumber_Float(ro);
1271 rval = PyFloat_AsDouble(num);
1277 wxPyEndBlockThreads(blocked);
1281 bool GetValueAsBool( int row, int col ) {
1282 return (bool)GetValueAsLong(row, col);
1285 void SetValueAsLong( int row, int col, long value ) {
1286 wxPyBlock_t blocked = wxPyBeginBlockThreads();
1287 if (wxPyCBH_findCallback(m_myInst, "SetValue")) {
1288 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(iii)", row, col, value));
1290 wxPyEndBlockThreads(blocked);
1293 void SetValueAsDouble( int row, int col, double value ) {
1294 wxPyBlock_t blocked = wxPyBeginBlockThreads();
1295 if (wxPyCBH_findCallback(m_myInst, "SetValue")) {
1296 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(iid)", row, col, value));
1298 wxPyEndBlockThreads(blocked);
1301 void SetValueAsBool( int row, int col, bool value ) {
1302 SetValueAsLong( row, col, (long)value );
1311 // The python-aware version get's SWIGified
1312 class wxPyGridTableBase : public wxGridTableBase
1315 %pythonAppend wxPyGridTableBase "self._setCallbackInfo(self, PyGridTableBase);self._setOORInfo(self)"
1316 wxPyGridTableBase();
1317 void _setCallbackInfo(PyObject* self, PyObject* _class);
1319 %pythonAppend Destroy "args[0].thisown = 0"
1320 %extend { void Destroy() { delete self; } }
1322 wxString GetTypeName( int row, int col );
1323 bool CanGetValueAs( int row, int col, const wxString& typeName );
1324 bool CanSetValueAs( int row, int col, const wxString& typeName );
1326 bool InsertRows( size_t pos = 0, size_t numRows = 1 );
1327 bool AppendRows( size_t numRows = 1 );
1328 bool DeleteRows( size_t pos = 0, size_t numRows = 1 );
1329 bool InsertCols( size_t pos = 0, size_t numCols = 1 );
1330 bool AppendCols( size_t numCols = 1 );
1331 bool DeleteCols( size_t pos = 0, size_t numCols = 1 );
1332 wxString GetRowLabelValue( int row );
1333 wxString GetColLabelValue( int col );
1334 void SetRowLabelValue( int row, const wxString& value );
1335 void SetColLabelValue( int col, const wxString& value );
1336 bool CanHaveAttributes();
1337 wxGridCellAttr *GetAttr( int row, int col,
1338 wxGridCellAttr::wxAttrKind kind );
1339 void SetAttr(wxGridCellAttr* attr, int row, int col);
1340 void SetRowAttr(wxGridCellAttr *attr, int row);
1341 void SetColAttr(wxGridCellAttr *attr, int col);
1343 %MAKE_BASE_FUNC(PyGridTableBase, GetTypeName);
1344 %MAKE_BASE_FUNC(PyGridTableBase, CanGetValueAs);
1345 %MAKE_BASE_FUNC(PyGridTableBase, CanSetValueAs);
1346 %MAKE_BASE_FUNC(PyGridTableBase, Clear);
1347 %MAKE_BASE_FUNC(PyGridTableBase, InsertRows);
1348 %MAKE_BASE_FUNC(PyGridTableBase, AppendRows);
1349 %MAKE_BASE_FUNC(PyGridTableBase, DeleteRows);
1350 %MAKE_BASE_FUNC(PyGridTableBase, InsertCols);
1351 %MAKE_BASE_FUNC(PyGridTableBase, AppendCols);
1352 %MAKE_BASE_FUNC(PyGridTableBase, DeleteCols);
1353 %MAKE_BASE_FUNC(PyGridTableBase, GetRowLabelValue);
1354 %MAKE_BASE_FUNC(PyGridTableBase, GetColLabelValue);
1355 %MAKE_BASE_FUNC(PyGridTableBase, SetRowLabelValue);
1356 %MAKE_BASE_FUNC(PyGridTableBase, SetColLabelValue);
1357 %MAKE_BASE_FUNC(PyGridTableBase, CanHaveAttributes);
1358 %MAKE_BASE_FUNC(PyGridTableBase, GetAttr);
1359 %MAKE_BASE_FUNC(PyGridTableBase, SetAttr);
1360 %MAKE_BASE_FUNC(PyGridTableBase, SetRowAttr);
1361 %MAKE_BASE_FUNC(PyGridTableBase, SetColAttr);
1365 //---------------------------------------------------------------------------
1366 // Predefined Tables
1368 class wxGridStringTable : public wxGridTableBase
1371 %pythonAppend wxGridStringTable "self._setOORInfo(self)"
1372 wxGridStringTable( int numRows=0, int numCols=0 );
1375 //---------------------------------------------------------------------------
1376 // The Table can pass messages to the grid to tell it to update itself if
1377 // something has changed.
1379 enum wxGridTableRequest
1381 wxGRIDTABLE_REQUEST_VIEW_GET_VALUES = 2000,
1382 wxGRIDTABLE_REQUEST_VIEW_SEND_VALUES,
1383 wxGRIDTABLE_NOTIFY_ROWS_INSERTED,
1384 wxGRIDTABLE_NOTIFY_ROWS_APPENDED,
1385 wxGRIDTABLE_NOTIFY_ROWS_DELETED,
1386 wxGRIDTABLE_NOTIFY_COLS_INSERTED,
1387 wxGRIDTABLE_NOTIFY_COLS_APPENDED,
1388 wxGRIDTABLE_NOTIFY_COLS_DELETED
1392 class wxGridTableMessage
1395 wxGridTableMessage( wxGridTableBase *table, int id,
1398 ~wxGridTableMessage();
1400 void SetTableObject( wxGridTableBase *table );
1401 wxGridTableBase * GetTableObject() const;
1402 void SetId( int id );
1404 void SetCommandInt( int comInt1 );
1405 int GetCommandInt();
1406 void SetCommandInt2( int comInt2 );
1407 int GetCommandInt2();
1411 //---------------------------------------------------------------------------
1414 // Typemap to allow conversion of sequence objects to wxGridCellCoords...
1415 %typemap(in) wxGridCellCoords& (wxGridCellCoords temp) {
1417 if (! wxGridCellCoords_helper($input, &$1)) SWIG_fail;
1419 %typemap(typecheck, precedence=SWIG_TYPECHECK_POINTER) wxGridCellCoords& {
1420 $1 = wxGridCellCoords_typecheck($input);
1424 // ...and here is the associated helper.
1426 bool wxGridCellCoords_helper(PyObject* source, wxGridCellCoords** obj) {
1428 if (source == Py_None) {
1429 **obj = wxGridCellCoords(-1,-1);
1433 // If source is an object instance then it may already be the right type
1434 if (wxPySwigInstance_Check(source)) {
1435 wxGridCellCoords* ptr;
1436 if (! wxPyConvertSwigPtr(source, (void **)&ptr, wxT("wxGridCellCoords")))
1441 // otherwise a 2-tuple of integers is expected
1442 else if (PySequence_Check(source) && PyObject_Length(source) == 2) {
1443 PyObject* o1 = PySequence_GetItem(source, 0);
1444 PyObject* o2 = PySequence_GetItem(source, 1);
1445 if (!PyNumber_Check(o1) || !PyNumber_Check(o2)) {
1450 **obj = wxGridCellCoords(PyInt_AsLong(o1), PyInt_AsLong(o2));
1457 PyErr_SetString(PyExc_TypeError, "Expected a 2-tuple of integers or a wxGridCellCoords object.");
1462 bool wxGridCellCoords_typecheck(PyObject* source) {
1465 if (wxPySwigInstance_Check(source) &&
1466 wxPyConvertSwigPtr(source, (void **)&ptr, wxT("wxGridCellCoords")))
1470 if (PySequence_Check(source) && PySequence_Length(source) == 2)
1478 // Typemap to convert an array of cells coords to a list of tuples...
1479 %typemap(out) wxGridCellCoordsArray {
1480 $result = wxGridCellCoordsArray_helper($1);
1483 // %typemap(ret) wxGridCellCoordsArray {
1488 // ...and the helper function for the above typemap.
1490 PyObject* wxGridCellCoordsArray_helper(const wxGridCellCoordsArray& source)
1492 PyObject* list = PyList_New(0);
1494 for (idx = 0; idx < source.GetCount(); idx += 1) {
1495 wxGridCellCoords& coord = source.Item(idx);
1496 PyObject* tup = PyTuple_New(2);
1497 PyTuple_SET_ITEM(tup, 0, PyInt_FromLong(coord.GetRow()));
1498 PyTuple_SET_ITEM(tup, 1, PyInt_FromLong(coord.GetCol()));
1499 PyList_Append(list, tup);
1510 class wxGridCellCoords
1513 wxGridCellCoords( int r=-1, int c=-1 );
1514 ~wxGridCellCoords();
1517 void SetRow( int n );
1519 void SetCol( int n );
1520 void Set( int row, int col );
1522 bool operator==( const wxGridCellCoords& other ) const;
1523 bool operator!=( const wxGridCellCoords& other ) const;
1527 PyObject* tup = PyTuple_New(2);
1528 PyTuple_SET_ITEM(tup, 0, PyInt_FromLong(self->GetRow()));
1529 PyTuple_SET_ITEM(tup, 1, PyInt_FromLong(self->GetCol()));
1534 asTuple = wx._deprecated(Get, "asTuple is deprecated, use `Get` instead")
1535 def __str__(self): return str(self.Get())
1536 def __repr__(self): return 'wxGridCellCoords'+str(self.Get())
1537 def __len__(self): return len(self.Get())
1538 def __getitem__(self, index): return self.asTuple()[index]
1539 def __setitem__(self, index, val):
1540 if index == 0: self.SetRow(val)
1541 elif index == 1: self.SetCol(val)
1542 else: raise IndexError
1548 //---------------------------------------------------------------------------
1549 //---------------------------------------------------------------------------
1553 // Fool SWIG into treating this enum as an int
1554 typedef int WXGRIDSELECTIONMODES;
1556 // but let the C++ code know what it really is.
1558 typedef wxGrid::wxGridSelectionModes WXGRIDSELECTIONMODES;
1563 MustHaveApp(wxGrid);
1565 class wxGrid : public wxScrolledWindow
1568 %pythonAppend wxGrid "self._setOORInfo(self)"
1569 %pythonAppend wxGrid() ""
1571 %typemap(out) wxGrid*; // turn off this typemap
1573 wxGrid( wxWindow *parent,
1575 const wxPoint& pos = wxDefaultPosition,
1576 const wxSize& size = wxDefaultSize,
1577 long style = wxWANTS_CHARS,
1578 const wxString& name = wxPyPanelNameStr);
1580 %RenameCtor(PreGrid, wxGrid());
1583 // Turn it back on again
1584 %typemap(out) wxGrid* { $result = wxPyMake_wxObject($1, $owner); }
1587 bool Create( wxWindow *parent,
1589 const wxPoint& pos = wxDefaultPosition,
1590 const wxSize& size = wxDefaultSize,
1591 long style = wxWANTS_CHARS,
1592 const wxString& name = wxPyPanelNameStr );
1595 enum wxGridSelectionModes {
1601 SelectCells = wxGridSelectCells
1602 SelectRows = wxGridSelectRows
1603 SelectColumns = wxGridSelectColumns
1606 bool CreateGrid( int numRows, int numCols,
1607 WXGRIDSELECTIONMODES selmode = wxGrid::wxGridSelectCells );
1608 void SetSelectionMode(WXGRIDSELECTIONMODES selmode);
1609 WXGRIDSELECTIONMODES GetSelectionMode();
1612 // ------ grid dimensions
1614 int GetNumberRows();
1615 int GetNumberCols();
1618 bool ProcessTableMessage( wxGridTableMessage& );
1621 wxGridTableBase * GetTable() const;
1622 bool SetTable( wxGridTableBase *table, bool takeOwnership=false,
1623 WXGRIDSELECTIONMODES selmode =
1624 wxGrid::wxGridSelectCells );
1627 bool InsertRows( int pos = 0, int numRows = 1, bool updateLabels=true );
1628 bool AppendRows( int numRows = 1, bool updateLabels=true );
1629 bool DeleteRows( int pos = 0, int numRows = 1, bool updateLabels=true );
1630 bool InsertCols( int pos = 0, int numCols = 1, bool updateLabels=true );
1631 bool AppendCols( int numCols = 1, bool updateLabels=true );
1632 bool DeleteCols( int pos = 0, int numCols = 1, bool updateLabels=true );
1635 // this function is called when the current cell highlight must be redrawn
1636 // and may be overridden by the user
1637 virtual void DrawCellHighlight( wxDC& dc, const wxGridCellAttr *attr );
1640 // ------ Cell text drawing functions
1642 void DrawTextRectangle( wxDC& dc, const wxString&, const wxRect&,
1643 int horizontalAlignment = wxLEFT,
1644 int verticalAlignment = wxTOP,
1645 int textOrientation = wxHORIZONTAL );
1647 // // Split a string containing newline chararcters into an array of
1648 // // strings and return the number of lines
1650 // void StringToLines( const wxString& value, wxArrayString& lines );
1653 void, GetTextBoxSize( wxDC& dc, wxArrayString& lines,
1654 long *OUTPUT, long *OUTPUT ),
1655 "GetTextBoxSize(DC dc, list lines) -> (width, height)");
1659 // Code that does a lot of grid modification can be enclosed
1660 // between BeginBatch() and EndBatch() calls to avoid screen
1665 int GetBatchCount();
1666 void ForceRefresh();
1669 // ------ edit control functions
1672 void EnableEditing( bool edit );
1674 void EnableCellEditControl( bool enable = true );
1675 void DisableCellEditControl();
1676 bool CanEnableCellControl() const;
1677 bool IsCellEditControlEnabled() const;
1678 bool IsCellEditControlShown() const;
1680 bool IsCurrentCellReadOnly() const;
1682 void ShowCellEditControl();
1683 void HideCellEditControl();
1684 void SaveEditControlValue();
1687 // ------ grid location functions
1688 // Note that all of these functions work with the logical coordinates of
1689 // grid cells and labels so you will need to convert from device
1690 // coordinates for mouse events etc.
1693 //void XYToCell( int x, int y, wxGridCellCoords& );
1695 wxGridCellCoords XYToCell(int x, int y) {
1696 wxGridCellCoords rv;
1697 self->XYToCell(x, y, rv);
1702 int YToRow( int y );
1703 int XToCol( int x );
1705 int YToEdgeOfRow( int y );
1706 int XToEdgeOfCol( int x );
1708 wxRect CellToRect( int row, int col );
1709 // TODO: ??? wxRect CellToRect( const wxGridCellCoords& coords );
1712 int GetGridCursorRow();
1713 int GetGridCursorCol();
1715 // check to see if a cell is either wholly visible (the default arg) or
1716 // at least partially visible in the grid window
1718 bool IsVisible( int row, int col, bool wholeCellVisible = true );
1719 // TODO: ??? bool IsVisible( const wxGridCellCoords& coords, bool wholeCellVisible = true );
1720 void MakeCellVisible( int row, int col );
1721 // TODO: ??? void MakeCellVisible( const wxGridCellCoords& coords );
1724 // ------ grid cursor movement functions
1726 void SetGridCursor( int row, int col );
1727 bool MoveCursorUp( bool expandSelection );
1728 bool MoveCursorDown( bool expandSelection );
1729 bool MoveCursorLeft( bool expandSelection );
1730 bool MoveCursorRight( bool expandSelection );
1731 bool MovePageDown();
1733 bool MoveCursorUpBlock( bool expandSelection );
1734 bool MoveCursorDownBlock( bool expandSelection );
1735 bool MoveCursorLeftBlock( bool expandSelection );
1736 bool MoveCursorRightBlock( bool expandSelection );
1739 // ------ label and gridline formatting
1741 int GetDefaultRowLabelSize();
1742 int GetRowLabelSize();
1743 int GetDefaultColLabelSize();
1744 int GetColLabelSize();
1745 wxColour GetLabelBackgroundColour();
1746 wxColour GetLabelTextColour();
1747 wxFont GetLabelFont();
1750 void, GetRowLabelAlignment( int *OUTPUT, int *OUTPUT ),
1751 "GetRowLabelAlignment() -> (horiz, vert)");
1754 void, GetColLabelAlignment( int *OUTPUT, int *OUTPUT ),
1755 "GetColLabelAlignment() -> (horiz, vert)");
1757 int GetColLabelTextOrientation();
1758 wxString GetRowLabelValue( int row );
1759 wxString GetColLabelValue( int col );
1760 wxColour GetGridLineColour();
1761 wxColour GetCellHighlightColour();
1762 int GetCellHighlightPenWidth();
1763 int GetCellHighlightROPenWidth();
1765 void SetRowLabelSize( int width );
1766 void SetColLabelSize( int height );
1767 void SetLabelBackgroundColour( const wxColour& );
1768 void SetLabelTextColour( const wxColour& );
1769 void SetLabelFont( const wxFont& );
1770 void SetRowLabelAlignment( int horiz, int vert );
1771 void SetColLabelAlignment( int horiz, int vert );
1772 void SetColLabelTextOrientation( int textOrientation );
1773 void SetRowLabelValue( int row, const wxString& );
1774 void SetColLabelValue( int col, const wxString& );
1775 void SetGridLineColour( const wxColour& );
1776 void SetCellHighlightColour( const wxColour& );
1777 void SetCellHighlightPenWidth(int width);
1778 void SetCellHighlightROPenWidth(int width);
1780 void EnableDragRowSize( bool enable = true );
1781 void DisableDragRowSize();
1782 bool CanDragRowSize();
1783 void EnableDragColSize( bool enable = true );
1784 void DisableDragColSize();
1785 bool CanDragColSize();
1786 void EnableDragGridSize(bool enable = true);
1787 void DisableDragGridSize();
1788 bool CanDragGridSize();
1790 void EnableDragCell( bool enable = true );
1791 void DisableDragCell();
1794 // this sets the specified attribute for all cells in this row/col
1795 void SetAttr(int row, int col, wxGridCellAttr *attr);
1796 void SetRowAttr(int row, wxGridCellAttr *attr);
1797 void SetColAttr(int col, wxGridCellAttr *attr);
1799 // returns the attribute we may modify in place: a new one if this cell
1800 // doesn't have any yet or the existing one if it does
1802 // DecRef() must be called on the returned pointer, as usual
1803 wxGridCellAttr *GetOrCreateCellAttr(int row, int col) const;
1806 // shortcuts for setting the column parameters
1808 // set the format for the data in the column: default is string
1809 void SetColFormatBool(int col);
1810 void SetColFormatNumber(int col);
1811 void SetColFormatFloat(int col, int width = -1, int precision = -1);
1812 void SetColFormatCustom(int col, const wxString& typeName);
1814 void EnableGridLines( bool enable = true );
1815 bool GridLinesEnabled();
1817 // ------ row and col formatting
1819 int GetDefaultRowSize();
1820 int GetRowSize( int row );
1821 int GetDefaultColSize();
1822 int GetColSize( int col );
1823 wxColour GetDefaultCellBackgroundColour();
1824 wxColour GetCellBackgroundColour( int row, int col );
1825 wxColour GetDefaultCellTextColour();
1826 wxColour GetCellTextColour( int row, int col );
1827 wxFont GetDefaultCellFont();
1828 wxFont GetCellFont( int row, int col );
1831 void, GetDefaultCellAlignment( int *OUTPUT, int *OUTPUT ),
1832 "GetDefaultCellAlignment() -> (horiz, vert)");
1835 void, GetCellAlignment( int row, int col, int *OUTPUT, int *OUTPUT ),
1836 "GetCellAlignment() -> (horiz, vert)");
1838 bool GetDefaultCellOverflow();
1839 bool GetCellOverflow( int row, int col );
1842 void, GetCellSize( int row, int col, int *OUTPUT, int *OUTPUT ),
1843 "GetCellSize(int row, int col) -> (num_rows, num_cols)");
1845 void SetDefaultRowSize( int height, bool resizeExistingRows = false );
1846 void SetRowSize( int row, int height );
1847 void SetDefaultColSize( int width, bool resizeExistingCols = false );
1849 void SetColSize( int col, int width );
1851 // automatically size the column or row to fit to its contents, if
1852 // setAsMin is True, this optimal width will also be set as minimal width
1854 void AutoSizeColumn( int col, bool setAsMin = true );
1855 void AutoSizeRow( int row, bool setAsMin = true );
1858 // auto size all columns (very ineffective for big grids!)
1859 void AutoSizeColumns( bool setAsMin = true );
1860 void AutoSizeRows( bool setAsMin = true );
1862 // auto size the grid, that is make the columns/rows of the "right" size
1863 // and also set the grid size to just fit its contents
1866 // autosize row height depending on label text
1867 void AutoSizeRowLabelSize( int row );
1869 // autosize column width depending on label text
1870 void AutoSizeColLabelSize( int col );
1873 // column won't be resized to be lesser width - this must be called during
1874 // the grid creation because it won't resize the column if it's already
1875 // narrower than the minimal width
1876 void SetColMinimalWidth( int col, int width );
1877 void SetRowMinimalHeight( int row, int width );
1879 void SetColMinimalAcceptableWidth( int width );
1880 void SetRowMinimalAcceptableHeight( int width );
1881 int GetColMinimalAcceptableWidth() const;
1882 int GetRowMinimalAcceptableHeight() const;
1884 void SetDefaultCellBackgroundColour( const wxColour& );
1885 void SetCellBackgroundColour( int row, int col, const wxColour& );
1886 void SetDefaultCellTextColour( const wxColour& );
1888 void SetCellTextColour( int row, int col, const wxColour& );
1889 void SetDefaultCellFont( const wxFont& );
1890 void SetCellFont( int row, int col, const wxFont& );
1891 void SetDefaultCellAlignment( int horiz, int vert );
1892 void SetCellAlignment( int row, int col, int horiz, int vert );
1893 void SetDefaultCellOverflow( bool allow );
1894 void SetCellOverflow( int row, int col, bool allow );
1895 void SetCellSize( int row, int col, int num_rows, int num_cols );
1897 // takes ownership of the pointer
1898 void SetDefaultRenderer(wxGridCellRenderer *renderer);
1899 void SetCellRenderer(int row, int col, wxGridCellRenderer *renderer);
1900 wxGridCellRenderer *GetDefaultRenderer() const;
1901 wxGridCellRenderer* GetCellRenderer(int row, int col);
1903 // takes ownership of the pointer
1904 void SetDefaultEditor(wxGridCellEditor *editor);
1905 void SetCellEditor(int row, int col, wxGridCellEditor *editor);
1906 wxGridCellEditor *GetDefaultEditor() const;
1907 wxGridCellEditor* GetCellEditor(int row, int col);
1911 // ------ cell value accessors
1913 wxString GetCellValue( int row, int col );
1914 // TODO: ??? wxString GetCellValue( const wxGridCellCoords& coords )
1916 void SetCellValue( int row, int col, const wxString& s );
1917 // TODO: ??? void SetCellValue( const wxGridCellCoords& coords, const wxString& s )
1919 // returns True if the cell can't be edited
1920 bool IsReadOnly(int row, int col) const;
1922 // make the cell editable/readonly
1923 void SetReadOnly(int row, int col, bool isReadOnly = true);
1925 // ------ selections of blocks of cells
1927 void SelectRow( int row, bool addToSelected = false );
1928 void SelectCol( int col, bool addToSelected = false );
1930 void SelectBlock( int topRow, int leftCol, int bottomRow, int rightCol,
1931 bool addToSelected = false );
1932 // TODO: ??? void SelectBlock( const wxGridCellCoords& topLeft,
1933 // TODO: ??? const wxGridCellCoords& bottomRight )
1937 void ClearSelection();
1938 bool IsInSelection( int row, int col );
1939 // TODO: ??? bool IsInSelection( const wxGridCellCoords& coords )
1941 const wxGridCellCoordsArray GetSelectedCells() const;
1942 const wxGridCellCoordsArray GetSelectionBlockTopLeft() const;
1943 const wxGridCellCoordsArray GetSelectionBlockBottomRight() const;
1944 const wxArrayInt GetSelectedRows() const;
1945 const wxArrayInt GetSelectedCols() const;
1947 void DeselectRow( int row );
1948 void DeselectCol( int col );
1949 void DeselectCell( int row, int col );
1952 // This function returns the rectangle that encloses the block of cells
1953 // limited by TopLeft and BottomRight cell in device coords and clipped
1954 // to the client size of the grid window.
1956 wxRect BlockToDeviceRect( const wxGridCellCoords & topLeft,
1957 const wxGridCellCoords & bottomRight );
1960 // Access or update the selection fore/back colours
1961 wxColour GetSelectionBackground() const;
1962 wxColour GetSelectionForeground() const;
1964 void SetSelectionBackground(const wxColour& c);
1965 void SetSelectionForeground(const wxColour& c);
1968 // Methods for a registry for mapping data types to Renderers/Editors
1969 void RegisterDataType(const wxString& typeName,
1970 wxGridCellRenderer* renderer,
1971 wxGridCellEditor* editor);
1972 wxGridCellEditor* GetDefaultEditorForCell(int row, int col) const;
1973 // TODO: ??? wxGridCellEditor* GetDefaultEditorForCell(const wxGridCellCoords& c) const
1974 wxGridCellRenderer* GetDefaultRendererForCell(int row, int col) const;
1975 wxGridCellEditor* GetDefaultEditorForType(const wxString& typeName) const;
1976 wxGridCellRenderer* GetDefaultRendererForType(const wxString& typeName) const;
1978 // grid may occupy more space than needed for its rows/columns, this
1979 // function allows to set how big this extra space is
1980 void SetMargins(int extraWidth, int extraHeight);
1983 // Accessors for component windows
1984 wxWindow* GetGridWindow();
1985 wxWindow* GetGridRowLabelWindow();
1986 wxWindow* GetGridColLabelWindow();
1987 wxWindow* GetGridCornerLabelWindow();
1989 // Allow adjustment of scroll increment. The default is (15, 15).
1990 void SetScrollLineX(int x);
1991 void SetScrollLineY(int y);
1992 int GetScrollLineX() const;
1993 int GetScrollLineY() const;
1995 int GetScrollX(int x) const;
1996 int GetScrollY(int y) const;
1998 static wxVisualAttributes
1999 GetClassDefaultAttributes(wxWindowVariant variant = wxWINDOW_VARIANT_NORMAL);
2003 //---------------------------------------------------------------------------
2004 //---------------------------------------------------------------------------
2005 // Grid events and stuff
2009 class wxGridEvent : public wxNotifyEvent
2012 wxGridEvent(int id, wxEventType type, wxGrid* obj,
2013 int row=-1, int col=-1, int x=-1, int y=-1, bool sel = true,
2014 bool control=false, bool shift=false, bool alt=false, bool meta=false);
2016 virtual int GetRow();
2017 virtual int GetCol();
2018 wxPoint GetPosition();
2028 class wxGridSizeEvent : public wxNotifyEvent
2031 wxGridSizeEvent(int id, wxEventType type, wxGrid* obj,
2032 int rowOrCol=-1, int x=-1, int y=-1,
2033 bool control=false, bool shift=false, bool alt=false, bool meta=false);
2036 wxPoint GetPosition();
2045 class wxGridRangeSelectEvent : public wxNotifyEvent
2048 wxGridRangeSelectEvent(int id, wxEventType type, wxGrid* obj,
2049 const wxGridCellCoords& topLeft,
2050 const wxGridCellCoords& bottomRight,
2052 bool control=false, bool shift=false,
2053 bool alt=false, bool meta=false);
2055 wxGridCellCoords GetTopLeftCoords();
2056 wxGridCellCoords GetBottomRightCoords();
2069 class wxGridEditorCreatedEvent : public wxCommandEvent {
2071 wxGridEditorCreatedEvent(int id, wxEventType type, wxObject* obj,
2072 int row, int col, wxControl* ctrl);
2076 wxControl* GetControl();
2077 void SetRow(int row);
2078 void SetCol(int col);
2079 void SetControl(wxControl* ctrl);
2084 %constant wxEventType wxEVT_GRID_CELL_LEFT_CLICK;
2085 %constant wxEventType wxEVT_GRID_CELL_RIGHT_CLICK;
2086 %constant wxEventType wxEVT_GRID_CELL_LEFT_DCLICK;
2087 %constant wxEventType wxEVT_GRID_CELL_RIGHT_DCLICK;
2088 %constant wxEventType wxEVT_GRID_LABEL_LEFT_CLICK;
2089 %constant wxEventType wxEVT_GRID_LABEL_RIGHT_CLICK;
2090 %constant wxEventType wxEVT_GRID_LABEL_LEFT_DCLICK;
2091 %constant wxEventType wxEVT_GRID_LABEL_RIGHT_DCLICK;
2092 %constant wxEventType wxEVT_GRID_ROW_SIZE;
2093 %constant wxEventType wxEVT_GRID_COL_SIZE;
2094 %constant wxEventType wxEVT_GRID_RANGE_SELECT;
2095 %constant wxEventType wxEVT_GRID_CELL_CHANGE;
2096 %constant wxEventType wxEVT_GRID_SELECT_CELL;
2097 %constant wxEventType wxEVT_GRID_EDITOR_SHOWN;
2098 %constant wxEventType wxEVT_GRID_EDITOR_HIDDEN;
2099 %constant wxEventType wxEVT_GRID_EDITOR_CREATED;
2100 %constant wxEventType wxEVT_GRID_CELL_BEGIN_DRAG;
2105 EVT_GRID_CELL_LEFT_CLICK = wx.PyEventBinder( wxEVT_GRID_CELL_LEFT_CLICK )
2106 EVT_GRID_CELL_RIGHT_CLICK = wx.PyEventBinder( wxEVT_GRID_CELL_RIGHT_CLICK )
2107 EVT_GRID_CELL_LEFT_DCLICK = wx.PyEventBinder( wxEVT_GRID_CELL_LEFT_DCLICK )
2108 EVT_GRID_CELL_RIGHT_DCLICK = wx.PyEventBinder( wxEVT_GRID_CELL_RIGHT_DCLICK )
2109 EVT_GRID_LABEL_LEFT_CLICK = wx.PyEventBinder( wxEVT_GRID_LABEL_LEFT_CLICK )
2110 EVT_GRID_LABEL_RIGHT_CLICK = wx.PyEventBinder( wxEVT_GRID_LABEL_RIGHT_CLICK )
2111 EVT_GRID_LABEL_LEFT_DCLICK = wx.PyEventBinder( wxEVT_GRID_LABEL_LEFT_DCLICK )
2112 EVT_GRID_LABEL_RIGHT_DCLICK = wx.PyEventBinder( wxEVT_GRID_LABEL_RIGHT_DCLICK )
2113 EVT_GRID_ROW_SIZE = wx.PyEventBinder( wxEVT_GRID_ROW_SIZE )
2114 EVT_GRID_COL_SIZE = wx.PyEventBinder( wxEVT_GRID_COL_SIZE )
2115 EVT_GRID_RANGE_SELECT = wx.PyEventBinder( wxEVT_GRID_RANGE_SELECT )
2116 EVT_GRID_CELL_CHANGE = wx.PyEventBinder( wxEVT_GRID_CELL_CHANGE )
2117 EVT_GRID_SELECT_CELL = wx.PyEventBinder( wxEVT_GRID_SELECT_CELL )
2118 EVT_GRID_EDITOR_SHOWN = wx.PyEventBinder( wxEVT_GRID_EDITOR_SHOWN )
2119 EVT_GRID_EDITOR_HIDDEN = wx.PyEventBinder( wxEVT_GRID_EDITOR_HIDDEN )
2120 EVT_GRID_EDITOR_CREATED = wx.PyEventBinder( wxEVT_GRID_EDITOR_CREATED )
2121 EVT_GRID_CELL_BEGIN_DRAG = wx.PyEventBinder( wxEVT_GRID_CELL_BEGIN_DRAG )
2124 %# The same as above but with the ability to specify an identifier
2125 EVT_GRID_CMD_CELL_LEFT_CLICK = wx.PyEventBinder( wxEVT_GRID_CELL_LEFT_CLICK, 1 )
2126 EVT_GRID_CMD_CELL_RIGHT_CLICK = wx.PyEventBinder( wxEVT_GRID_CELL_RIGHT_CLICK, 1 )
2127 EVT_GRID_CMD_CELL_LEFT_DCLICK = wx.PyEventBinder( wxEVT_GRID_CELL_LEFT_DCLICK, 1 )
2128 EVT_GRID_CMD_CELL_RIGHT_DCLICK = wx.PyEventBinder( wxEVT_GRID_CELL_RIGHT_DCLICK, 1 )
2129 EVT_GRID_CMD_LABEL_LEFT_CLICK = wx.PyEventBinder( wxEVT_GRID_LABEL_LEFT_CLICK, 1 )
2130 EVT_GRID_CMD_LABEL_RIGHT_CLICK = wx.PyEventBinder( wxEVT_GRID_LABEL_RIGHT_CLICK, 1 )
2131 EVT_GRID_CMD_LABEL_LEFT_DCLICK = wx.PyEventBinder( wxEVT_GRID_LABEL_LEFT_DCLICK, 1 )
2132 EVT_GRID_CMD_LABEL_RIGHT_DCLICK = wx.PyEventBinder( wxEVT_GRID_LABEL_RIGHT_DCLICK, 1 )
2133 EVT_GRID_CMD_ROW_SIZE = wx.PyEventBinder( wxEVT_GRID_ROW_SIZE, 1 )
2134 EVT_GRID_CMD_COL_SIZE = wx.PyEventBinder( wxEVT_GRID_COL_SIZE, 1 )
2135 EVT_GRID_CMD_RANGE_SELECT = wx.PyEventBinder( wxEVT_GRID_RANGE_SELECT, 1 )
2136 EVT_GRID_CMD_CELL_CHANGE = wx.PyEventBinder( wxEVT_GRID_CELL_CHANGE, 1 )
2137 EVT_GRID_CMD_SELECT_CELL = wx.PyEventBinder( wxEVT_GRID_SELECT_CELL, 1 )
2138 EVT_GRID_CMD_EDITOR_SHOWN = wx.PyEventBinder( wxEVT_GRID_EDITOR_SHOWN, 1 )
2139 EVT_GRID_CMD_EDITOR_HIDDEN = wx.PyEventBinder( wxEVT_GRID_EDITOR_HIDDEN, 1 )
2140 EVT_GRID_CMD_EDITOR_CREATED = wx.PyEventBinder( wxEVT_GRID_EDITOR_CREATED, 1 )
2141 EVT_GRID_CMD_CELL_BEGIN_DRAG = wx.PyEventBinder( wxEVT_GRID_CELL_BEGIN_DRAG, 1 )
2145 //---------------------------------------------------------------------------
2150 //---------------------------------------------------------------------------
2151 //---------------------------------------------------------------------------