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(GridNameStr);
 
  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"
 
 458 // magic constant which tells (to some functions) to automatically calculate
 
 459 // the appropriate size
 
 460 enum { wxGRID_AUTOSIZE };
 
 463 // many wxGrid methods work either with columns or rows, this enum is used for
 
 464 // the parameter indicating which one should it be
 
 473 const wxGridCellCoords wxGridNoCellCoords;
 
 474 const wxRect           wxGridNoCellRect;
 
 479 #define wxGRID_DEFAULT_NUMBER_ROWS        WXGRID_DEFAULT_NUMBER_ROWS
 
 480 #define wxGRID_DEFAULT_NUMBER_COLS        WXGRID_DEFAULT_NUMBER_COLS
 
 481 #define wxGRID_DEFAULT_ROW_HEIGHT         WXGRID_DEFAULT_ROW_HEIGHT
 
 482 #define wxGRID_DEFAULT_COL_WIDTH          WXGRID_DEFAULT_COL_WIDTH
 
 483 #define wxGRID_DEFAULT_COL_LABEL_HEIGHT   WXGRID_DEFAULT_COL_LABEL_HEIGHT
 
 484 #define wxGRID_DEFAULT_ROW_LABEL_WIDTH    WXGRID_DEFAULT_ROW_LABEL_WIDTH
 
 485 #define wxGRID_LABEL_EDGE_ZONE            WXGRID_LABEL_EDGE_ZONE
 
 486 #define wxGRID_MIN_ROW_HEIGHT             WXGRID_MIN_ROW_HEIGHT
 
 487 #define wxGRID_MIN_COL_WIDTH              WXGRID_MIN_COL_WIDTH
 
 488 #define wxGRID_DEFAULT_SCROLLBAR_WIDTH    WXGRID_DEFAULT_SCROLLBAR_WIDTH
 
 492     wxGRID_DEFAULT_NUMBER_ROWS,
 
 493     wxGRID_DEFAULT_NUMBER_COLS,
 
 494     wxGRID_DEFAULT_ROW_HEIGHT,
 
 495     wxGRID_DEFAULT_COL_WIDTH,
 
 496     wxGRID_DEFAULT_COL_LABEL_HEIGHT,
 
 497     wxGRID_DEFAULT_ROW_LABEL_WIDTH,
 
 498     wxGRID_LABEL_EDGE_ZONE,
 
 499     wxGRID_MIN_ROW_HEIGHT,
 
 500     wxGRID_MIN_COL_WIDTH,
 
 501     wxGRID_DEFAULT_SCROLLBAR_WIDTH
 
 505 //---------------------------------------------------------------------------
 
 507 // TODO: Use these to have SWIG automatically handle the IncRef/DecRef calls:
 
 509 //        %ref   wxGridCellWorker "$this->IncRef();";
 
 510 //        %unref wxGridCellWorker "$this->DecRef();";
 
 513 class  wxGridCellWorker
 
 517         void _setOORInfo(PyObject* _self) {
 
 518             if (!self->GetClientObject())
 
 519                 self->SetClientObject(new wxPyOORClientData(_self));
 
 522         // A dummy dtor to shut up SWIG.  (The real one is protected and can
 
 523         // only be called by DecRef)
 
 524         ~wxGridCellWorker() {
 
 528     void SetParameters(const wxString& params);
 
 535 // wxGridCellRenderer is an ABC, and several derived classes are available.
 
 536 // Classes implemented in Python should be derived from wxPyGridCellRenderer.
 
 538 class wxGridCellRenderer : public wxGridCellWorker
 
 541     virtual void Draw(wxGrid& grid,
 
 542                       wxGridCellAttr& attr,
 
 548     virtual wxSize GetBestSize(wxGrid& grid,
 
 549                                wxGridCellAttr& attr,
 
 553     virtual wxGridCellRenderer *Clone() const;
 
 558 // The C++ version of wxPyGridCellRenderer
 
 560 class wxPyGridCellRenderer : public wxGridCellRenderer
 
 563     wxPyGridCellRenderer() : wxGridCellRenderer() {};
 
 565     // Implement Python callback aware virtual methods
 
 566     void Draw(wxGrid& grid, wxGridCellAttr& attr,
 
 567               wxDC& dc, const wxRect& rect,
 
 568               int row, int col, bool isSelected) {
 
 569         wxPyBlock_t blocked = wxPyBeginBlockThreads();
 
 570         if (wxPyCBH_findCallback(m_myInst, "Draw")) {
 
 571             PyObject* go = wxPyMake_wxObject(&grid,false);
 
 572             PyObject* dco = wxPyMake_wxObject(&dc,false);
 
 573             PyObject* ao = wxPyMake_wxGridCellAttr(&attr,false);
 
 574             PyObject* ro = wxPyConstructObject((void*)&rect, wxT("wxRect"), 0);
 
 576             wxPyCBH_callCallback(m_myInst, Py_BuildValue("(OOOOiii)", go, ao, dco, ro,
 
 577                                                          row, col, isSelected));
 
 583         wxPyEndBlockThreads(blocked);
 
 586     wxSize GetBestSize(wxGrid& grid, wxGridCellAttr& attr, wxDC& dc,
 
 589         wxPyBlock_t blocked = wxPyBeginBlockThreads();
 
 590         if (wxPyCBH_findCallback(m_myInst, "GetBestSize")) {
 
 593             PyObject* go = wxPyMake_wxObject(&grid,false);
 
 594             PyObject* dco = wxPyMake_wxObject(&dc,false);
 
 595             PyObject* ao = wxPyMake_wxGridCellAttr(&attr,false);
 
 597             ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("(OOOii)",
 
 605                 const char* errmsg = "GetBestSize should return a 2-tuple of integers or a wxSize object.";
 
 606                 if (wxPyConvertSwigPtr(ro, (void **)&ptr, wxT("wxSize"))) {
 
 609                 else if (PySequence_Check(ro) && PyObject_Length(ro) == 2) {
 
 610                     PyErr_Clear();  // Clear the exception left over from wxPyConvertSwigPtr
 
 611                     PyObject* o1 = PySequence_GetItem(ro, 0);
 
 612                     PyObject* o2 = PySequence_GetItem(ro, 1);
 
 613                     if (PyNumber_Check(o1) && PyNumber_Check(o2))
 
 614                         rval = wxSize(PyInt_AsLong(o1), PyInt_AsLong(o2));
 
 616                         PyErr_SetString(PyExc_TypeError, errmsg);
 
 621                     PyErr_SetString(PyExc_TypeError, errmsg);
 
 626         wxPyEndBlockThreads(blocked);
 
 631     wxGridCellRenderer *Clone() const {
 
 632         wxGridCellRenderer* rval = NULL;
 
 633         wxPyBlock_t blocked = wxPyBeginBlockThreads();
 
 634         if (wxPyCBH_findCallback(m_myInst, "Clone")) {
 
 636             wxGridCellRenderer* ptr;
 
 637             ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("()"));
 
 639                 if (wxPyConvertSwigPtr(ro, (void **)&ptr, wxT("wxGridCellRenderer")))
 
 644         wxPyEndBlockThreads(blocked);
 
 648     DEC_PYCALLBACK__STRING(SetParameters);
 
 653 IMP_PYCALLBACK__STRING( wxPyGridCellRenderer, wxGridCellRenderer, SetParameters);
 
 658 // Let SWIG know about it so it can create the Python version
 
 659 class wxPyGridCellRenderer : public wxGridCellRenderer {
 
 661     %pythonAppend wxPyGridCellRenderer  "self._setOORInfo(self);"  setCallbackInfo(PyGridCellRenderer);
 
 663     wxPyGridCellRenderer();
 
 664     void _setCallbackInfo(PyObject* self, PyObject* _class);
 
 666     void SetParameters(const wxString& params);
 
 667     %MAKE_BASE_FUNC(PyGridCellRenderer, SetParameters);
 
 670 //---------------------------------------------------------------------------
 
 671 //  Predefined Renderers
 
 673 class wxGridCellStringRenderer : public wxGridCellRenderer
 
 676     %pythonAppend wxGridCellStringRenderer "self._setOORInfo(self)"
 
 677     wxGridCellStringRenderer();
 
 681 class  wxGridCellNumberRenderer : public wxGridCellStringRenderer
 
 684     %pythonAppend wxGridCellNumberRenderer "self._setOORInfo(self)"
 
 685     wxGridCellNumberRenderer();
 
 689 class  wxGridCellFloatRenderer : public wxGridCellStringRenderer
 
 692     %pythonAppend wxGridCellFloatRenderer "self._setOORInfo(self)"
 
 693     wxGridCellFloatRenderer(int width = -1, int precision = -1);
 
 695     int GetWidth() const;
 
 696     void SetWidth(int width);
 
 697     int GetPrecision() const;
 
 698     void SetPrecision(int precision);
 
 700     %property(Precision, GetPrecision, SetPrecision, doc="See `GetPrecision` and `SetPrecision`");
 
 701     %property(Width, GetWidth, SetWidth, doc="See `GetWidth` and `SetWidth`");
 
 705 class  wxGridCellBoolRenderer : public wxGridCellRenderer
 
 708     %pythonAppend wxGridCellBoolRenderer "self._setOORInfo(self)"
 
 709     wxGridCellBoolRenderer();
 
 713 class wxGridCellDateTimeRenderer : public wxGridCellStringRenderer
 
 716     %pythonAppend wxGridCellDateTimeRenderer "self._setOORInfo(self)"
 
 717     wxGridCellDateTimeRenderer(wxString outformat = wxPyDefaultDateTimeFormat,
 
 718                                wxString informat =  wxPyDefaultDateTimeFormat);
 
 722 class wxGridCellEnumRenderer : public wxGridCellStringRenderer
 
 725     %pythonAppend wxGridCellEnumRenderer "self._setOORInfo(self)"
 
 726     wxGridCellEnumRenderer( const wxString& choices = wxPyEmptyString );
 
 730 class wxGridCellAutoWrapStringRenderer : public wxGridCellStringRenderer
 
 733     %pythonAppend wxGridCellAutoWrapStringRenderer "self._setOORInfo(self)"
 
 734     wxGridCellAutoWrapStringRenderer();
 
 738 //---------------------------------------------------------------------------
 
 739 // wxGridCellEditor is an ABC, and several derived classes are available.
 
 740 // Classes implemented in Python should be derived from wxPyGridCellEditor.
 
 742 class wxGridCellEditor : public wxGridCellWorker
 
 746     wxControl* GetControl();
 
 747     void SetControl(wxControl* control);
 
 749     wxGridCellAttr* GetCellAttr();
 
 750     void SetCellAttr(wxGridCellAttr* attr);
 
 752     virtual void Create(wxWindow* parent,
 
 754                         wxEvtHandler* evtHandler);
 
 755     virtual void BeginEdit(int row, int col, wxGrid* grid);
 
 756     virtual bool EndEdit(int row, int col, wxGrid* grid);
 
 757     virtual void Reset();
 
 758     virtual wxGridCellEditor *Clone() const;
 
 760     virtual void SetSize(const wxRect& rect);
 
 761     virtual void Show(bool show, wxGridCellAttr *attr = NULL);
 
 762     virtual void PaintBackground(const wxRect& rectCell, wxGridCellAttr *attr);
 
 763     virtual bool IsAcceptedKey(wxKeyEvent& event);
 
 764     virtual void StartingKey(wxKeyEvent& event);
 
 765     virtual void StartingClick();
 
 766     virtual void HandleReturn(wxKeyEvent& event);
 
 768     %pythonPrepend Destroy "args[0].this.own(False)"
 
 769     virtual void Destroy();
 
 771     %property(CellAttr, GetCellAttr, SetCellAttr, doc="See `GetCellAttr` and `SetCellAttr`");
 
 772     %property(Control, GetControl, SetControl, doc="See `GetControl` and `SetControl`");
 
 776 // The C++ version of wxPyGridCellEditor
 
 778 class wxPyGridCellEditor : public wxGridCellEditor
 
 781     wxPyGridCellEditor() : wxGridCellEditor() {}
 
 783     void Create(wxWindow* parent, wxWindowID id, wxEvtHandler* evtHandler) {
 
 784         wxPyBlock_t blocked = wxPyBeginBlockThreads();
 
 785         if (wxPyCBH_findCallback(m_myInst, "Create")) {
 
 786             PyObject* po = wxPyMake_wxObject(parent,false);
 
 787             PyObject* eo = wxPyMake_wxObject(evtHandler,false);
 
 789             wxPyCBH_callCallback(m_myInst, Py_BuildValue("(OiO)", po, id, eo));
 
 793         wxPyEndBlockThreads(blocked);
 
 797     void BeginEdit(int row, int col, wxGrid* grid) {
 
 798         wxPyBlock_t blocked = wxPyBeginBlockThreads();
 
 799         if (wxPyCBH_findCallback(m_myInst, "BeginEdit")) {
 
 800             PyObject* go = wxPyMake_wxObject(grid,false);
 
 801             wxPyCBH_callCallback(m_myInst, Py_BuildValue("(iiO)", row, col, go));
 
 804         wxPyEndBlockThreads(blocked);
 
 808     bool EndEdit(int row, int col, wxGrid* grid) {
 
 810         wxPyBlock_t blocked = wxPyBeginBlockThreads();
 
 811         if (wxPyCBH_findCallback(m_myInst, "EndEdit")) {
 
 812             PyObject* go = wxPyMake_wxObject(grid,false);
 
 813             rv = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(iiO)", row, col, go));
 
 816         wxPyEndBlockThreads(blocked);
 
 821     wxGridCellEditor* Clone() const {
 
 822         wxGridCellEditor* rval = NULL;
 
 823         wxPyBlock_t blocked = wxPyBeginBlockThreads();
 
 824         if (wxPyCBH_findCallback(m_myInst, "Clone")) {
 
 826             wxGridCellEditor* ptr;
 
 827             ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("()"));
 
 829                 if (wxPyConvertSwigPtr(ro, (void **)&ptr, wxT("wxGridCellEditor")))
 
 834         wxPyEndBlockThreads(blocked);
 
 839     void Show(bool show, wxGridCellAttr *attr) {
 
 841         wxPyBlock_t blocked = wxPyBeginBlockThreads();
 
 842         if ((found = wxPyCBH_findCallback(m_myInst, "Show"))) {
 
 843             PyObject* ao = wxPyMake_wxGridCellAttr(attr,false);
 
 844             wxPyCBH_callCallback(m_myInst, Py_BuildValue("(iO)", show, ao));
 
 847         wxPyEndBlockThreads(blocked);
 
 849             wxGridCellEditor::Show(show, attr);
 
 853     void PaintBackground(const wxRect& rectCell, wxGridCellAttr *attr) {
 
 855         wxPyBlock_t blocked = wxPyBeginBlockThreads();
 
 856         if ((found = wxPyCBH_findCallback(m_myInst, "PaintBackground"))) {
 
 857             PyObject* ao = wxPyMake_wxGridCellAttr(attr,false);
 
 858             PyObject* ro = wxPyConstructObject((void*)&rectCell, wxT("wxRect"), 0);
 
 860             wxPyCBH_callCallback(m_myInst, Py_BuildValue("(OO)", ro, ao));
 
 865         wxPyEndBlockThreads(blocked);
 
 867             wxGridCellEditor::PaintBackground(rectCell, attr);
 
 871     DEC_PYCALLBACK___pure(Reset);
 
 872     DEC_PYCALLBACK__constany(SetSize, wxRect);
 
 873     DEC_PYCALLBACK_bool_any(IsAcceptedKey, wxKeyEvent);
 
 874     DEC_PYCALLBACK__any(StartingKey, wxKeyEvent);
 
 875     DEC_PYCALLBACK__any(HandleReturn, wxKeyEvent);
 
 876     DEC_PYCALLBACK__(StartingClick);
 
 877     DEC_PYCALLBACK__(Destroy);
 
 878     DEC_PYCALLBACK__STRING(SetParameters);
 
 879     DEC_PYCALLBACK_STRING__constpure(GetValue);
 
 885 IMP_PYCALLBACK__STRING( wxPyGridCellEditor, wxGridCellEditor, SetParameters);
 
 886 IMP_PYCALLBACK___pure(wxPyGridCellEditor, wxGridCellEditor, Reset);
 
 887 IMP_PYCALLBACK__constany(wxPyGridCellEditor, wxGridCellEditor, SetSize, wxRect);
 
 888 IMP_PYCALLBACK_bool_any(wxPyGridCellEditor, wxGridCellEditor, IsAcceptedKey, wxKeyEvent);
 
 889 IMP_PYCALLBACK__any(wxPyGridCellEditor, wxGridCellEditor, StartingKey, wxKeyEvent);
 
 890 IMP_PYCALLBACK__any(wxPyGridCellEditor, wxGridCellEditor, HandleReturn, wxKeyEvent);
 
 891 IMP_PYCALLBACK__(wxPyGridCellEditor, wxGridCellEditor, StartingClick);
 
 892 IMP_PYCALLBACK__(wxPyGridCellEditor, wxGridCellEditor, Destroy);
 
 893 IMP_PYCALLBACK_STRING__constpure(wxPyGridCellEditor, wxGridCellEditor, GetValue);
 
 898 // Let SWIG know about it so it can create the Python version
 
 899 class wxPyGridCellEditor : public wxGridCellEditor {
 
 901     %pythonAppend wxPyGridCellEditor  "self._setOORInfo(self);" setCallbackInfo(PyGridCellEditor)
 
 903     wxPyGridCellEditor();
 
 904     void _setCallbackInfo(PyObject* self, PyObject* _class);
 
 906     void SetSize(const wxRect& rect);
 
 907     void Show(bool show, wxGridCellAttr *attr = NULL);
 
 908     void PaintBackground(const wxRect& rectCell, wxGridCellAttr *attr);
 
 909     bool IsAcceptedKey(wxKeyEvent& event);
 
 910     void StartingKey(wxKeyEvent& event);
 
 911     void StartingClick();
 
 912     void HandleReturn(wxKeyEvent& event);
 
 914     void SetParameters(const wxString& params);
 
 916     %MAKE_BASE_FUNC(PyGridCellEditor, SetSize);
 
 917     %MAKE_BASE_FUNC(PyGridCellEditor, Show);
 
 918     %MAKE_BASE_FUNC(PyGridCellEditor, PaintBackground);
 
 919     %MAKE_BASE_FUNC(PyGridCellEditor, IsAcceptedKey);
 
 920     %MAKE_BASE_FUNC(PyGridCellEditor, StartingKey);
 
 921     %MAKE_BASE_FUNC(PyGridCellEditor, StartingClick);
 
 922     %MAKE_BASE_FUNC(PyGridCellEditor, HandleReturn);
 
 923     %MAKE_BASE_FUNC(PyGridCellEditor, Destroy);
 
 924     %MAKE_BASE_FUNC(PyGridCellEditor, SetParameters);
 
 927 //---------------------------------------------------------------------------
 
 928 //  Predefined Editors
 
 930 class wxGridCellTextEditor : public wxGridCellEditor
 
 933     %pythonAppend wxGridCellTextEditor  "self._setOORInfo(self)"
 
 934     wxGridCellTextEditor();
 
 935     virtual wxString GetValue();
 
 937     %property(Value, GetValue, doc="See `GetValue`");
 
 941 class wxGridCellNumberEditor : public wxGridCellTextEditor
 
 944     %pythonAppend wxGridCellNumberEditor  "self._setOORInfo(self)"
 
 945     wxGridCellNumberEditor(int min = -1, int max = -1);
 
 949 class wxGridCellFloatEditor : public wxGridCellTextEditor
 
 952     %pythonAppend wxGridCellFloatEditor  "self._setOORInfo(self)"
 
 953     wxGridCellFloatEditor(int width = -1, int precision = -1);
 
 957 MAKE_CONST_WXSTRING2(OneString, _T("1"));
 
 958 class wxGridCellBoolEditor : public wxGridCellEditor
 
 961     %pythonAppend wxGridCellBoolEditor  "self._setOORInfo(self)"
 
 962     wxGridCellBoolEditor();
 
 964     // set the string values returned by GetValue() for the true and false
 
 965     // states, respectively
 
 966     static void UseStringValues(const wxString& valueTrue = wxPyOneString,
 
 967                                 const wxString& valueFalse = wxPyEmptyString);
 
 969     // return true if the given string is equal to the string representation of
 
 970     // true value which we currently use
 
 971     static bool IsTrueValue(const wxString& value);
 
 975 class wxGridCellChoiceEditor : public wxGridCellEditor
 
 978     %pythonAppend wxGridCellChoiceEditor  "self._setOORInfo(self)"
 
 979     wxGridCellChoiceEditor(int choices = 0,
 
 980                            const wxString* choices_array = NULL,
 
 981                            bool allowOthers = false);
 
 985 class wxGridCellEnumEditor : public wxGridCellChoiceEditor
 
 988     %pythonAppend wxGridCellEnumEditor  "self._setOORInfo(self)"
 
 989     wxGridCellEnumEditor( const wxString& choices = wxPyEmptyString );
 
 993 class wxGridCellAutoWrapStringEditor : public wxGridCellTextEditor
 
 996     %pythonAppend wxGridCellAutoWrapStringEditor  "self._setOORInfo(self)"
 
 997     wxGridCellAutoWrapStringEditor();
 
1002 //---------------------------------------------------------------------------
 
1005 class wxGridCellAttr
 
1019         void _setOORInfo(PyObject* _self) {
 
1020             if (!self->GetClientObject())
 
1021                 self->SetClientObject(new wxPyOORClientData(_self));
 
1025     %pythonAppend wxGridCellAttr  "self._setOORInfo(self)"
 
1027     wxGridCellAttr(wxGridCellAttr *attrDefault = NULL);
 
1030         // A dummy dtor to shut up SWIG.  (The real one is protected and can
 
1031         // only be called by DecRef)
 
1036     wxGridCellAttr *Clone() const;
 
1037     void MergeWith(wxGridCellAttr *mergefrom);
 
1042     void SetTextColour(const wxColour& colText);
 
1043     void SetBackgroundColour(const wxColour& colBack);
 
1044     void SetFont(const wxFont& font);
 
1045     void SetAlignment(int hAlign, int vAlign);
 
1046     void SetSize(int num_rows, int num_cols);
 
1047     void SetOverflow( bool allow = true );
 
1048     void SetReadOnly(bool isReadOnly = true);
 
1050     void SetRenderer(wxGridCellRenderer *renderer);
 
1051     void SetEditor(wxGridCellEditor* editor);
 
1052     void SetKind(wxAttrKind kind);
 
1054     bool HasTextColour() const;
 
1055     bool HasBackgroundColour() const;
 
1056     bool HasFont() const;
 
1057     bool HasAlignment() const;
 
1058     bool HasRenderer() const;
 
1059     bool HasEditor() const;
 
1060     bool HasReadWriteMode() const;
 
1061     bool HasOverflowMode() const;
 
1063     wxColour GetTextColour() const;
 
1064     wxColour GetBackgroundColour() const;
 
1065     wxFont GetFont() const;
 
1068         void, GetAlignment(int *OUTPUT, int *OUTPUT) const,
 
1069         "GetAlignment() -> (hAlign, vAlign)");
 
1072         void, GetSize(int *OUTPUT, int *OUTPUT) const,
 
1073         "GetSize() -> (num_rows, num_cols)");
 
1075     bool GetOverflow() const;
 
1076     wxGridCellRenderer *GetRenderer(wxGrid* grid, int row, int col) const;
 
1077     wxGridCellEditor *GetEditor(wxGrid* grid, int row, int col) const;
 
1079     bool IsReadOnly() const;
 
1080     wxAttrKind GetKind();
 
1081     void SetDefAttr(wxGridCellAttr* defAttr);
 
1083     %property(Alignment, GetAlignment, SetAlignment, doc="See `GetAlignment` and `SetAlignment`");
 
1084     %property(BackgroundColour, GetBackgroundColour, SetBackgroundColour, doc="See `GetBackgroundColour` and `SetBackgroundColour`");
 
1085     %property(Font, GetFont, SetFont, doc="See `GetFont` and `SetFont`");
 
1086     %property(Kind, GetKind, SetKind, doc="See `GetKind` and `SetKind`");
 
1087     %property(Overflow, GetOverflow, SetOverflow, doc="See `GetOverflow` and `SetOverflow`");
 
1088     %property(Size, GetSize, SetSize, doc="See `GetSize` and `SetSize`");
 
1089     %property(TextColour, GetTextColour, SetTextColour, doc="See `GetTextColour` and `SetTextColour`");
 
1092 //---------------------------------------------------------------------------
 
1094 class wxGridCellAttrProvider
 
1097     %pythonAppend wxGridCellAttrProvider "self._setOORInfo(self)"
 
1098     wxGridCellAttrProvider();
 
1099     // ???? virtual ~wxGridCellAttrProvider();
 
1102         void _setOORInfo(PyObject* _self) {
 
1103             if (!self->GetClientObject())
 
1104                 self->SetClientObject(new wxPyOORClientData(_self));
 
1108     wxGridCellAttr *GetAttr(int row, int col,
 
1109                             wxGridCellAttr::wxAttrKind  kind) const;
 
1110     void SetAttr(wxGridCellAttr *attr, int row, int col);
 
1111     void SetRowAttr(wxGridCellAttr *attr, int row);
 
1112     void SetColAttr(wxGridCellAttr *attr, int col);
 
1114     void UpdateAttrRows( size_t pos, int numRows );
 
1115     void UpdateAttrCols( size_t pos, int numCols );
 
1120 // A Python-aware version
 
1122 class wxPyGridCellAttrProvider : public wxGridCellAttrProvider
 
1125     wxPyGridCellAttrProvider() : wxGridCellAttrProvider() {};
 
1127     PYCALLBACK_GCA_INTINTKIND(wxGridCellAttrProvider, GetAttr);
 
1128     PYCALLBACK__GCAINTINT(wxGridCellAttrProvider, SetAttr);
 
1129     PYCALLBACK__GCAINT(wxGridCellAttrProvider, SetRowAttr);
 
1130     PYCALLBACK__GCAINT(wxGridCellAttrProvider, SetColAttr);
 
1137 // The python-aware version get's SWIGified
 
1138 class wxPyGridCellAttrProvider : public wxGridCellAttrProvider
 
1141     %pythonAppend wxPyGridCellAttrProvider  setCallbackInfo(PyGridCellAttrProvider)
 
1142     wxPyGridCellAttrProvider();
 
1143     void _setCallbackInfo(PyObject* self, PyObject* _class);
 
1145     wxGridCellAttr *GetAttr(int row, int col,
 
1146                             wxGridCellAttr::wxAttrKind kind);
 
1147     void SetAttr(wxGridCellAttr *attr, int row, int col);
 
1148     void SetRowAttr(wxGridCellAttr *attr, int row);
 
1149     void SetColAttr(wxGridCellAttr *attr, int col);
 
1151     %MAKE_BASE_FUNC(PyGridCellAttrProvider, GetAttr);
 
1152     %MAKE_BASE_FUNC(PyGridCellAttrProvider, SetAttr);
 
1153     %MAKE_BASE_FUNC(PyGridCellAttrProvider, SetRowAttr);
 
1154     %MAKE_BASE_FUNC(PyGridCellAttrProvider, SetColAttr);
 
1158 //---------------------------------------------------------------------------
 
1159 // Grid Table Base class and Python aware version
 
1162 class wxGridTableBase : public wxObject
 
1165     // wxGridTableBase();   This is an ABC
 
1169         void _setOORInfo(PyObject* _self) {
 
1170             if (!self->GetClientObject())
 
1171                 self->SetClientObject(new wxPyOORClientData(_self));
 
1175     void SetAttrProvider(wxGridCellAttrProvider *attrProvider);
 
1176     wxGridCellAttrProvider *GetAttrProvider() const;
 
1177     void SetView( wxGrid *grid );
 
1178     wxGrid * GetView() const;
 
1182     virtual int GetNumberRows();
 
1183     virtual int GetNumberCols();
 
1184     virtual bool IsEmptyCell( int row, int col );
 
1185     virtual wxString GetValue( int row, int col );
 
1186     virtual void SetValue( int row, int col, const wxString& value );
 
1188     // virtuals overridable in wxPyGridTableBase
 
1189     virtual wxString GetTypeName( int row, int col );
 
1190     virtual bool CanGetValueAs( int row, int col, const wxString& typeName );
 
1191     virtual bool CanSetValueAs( int row, int col, const wxString& typeName );
 
1192     virtual long GetValueAsLong( int row, int col );
 
1193     virtual double GetValueAsDouble( int row, int col );
 
1194     virtual bool GetValueAsBool( int row, int col );
 
1195     virtual void SetValueAsLong( int row, int col, long value );
 
1196     virtual void SetValueAsDouble( int row, int col, double value );
 
1197     virtual void SetValueAsBool( int row, int col, bool value );
 
1199     //virtual void* GetValueAsCustom( int row, int col, const wxString& typeName );
 
1200     //virtual void  SetValueAsCustom( int row, int col, const wxString& typeName, void* value );
 
1203     virtual void Clear();
 
1204     virtual bool InsertRows( size_t pos = 0, size_t numRows = 1 );
 
1205     virtual bool AppendRows( size_t numRows = 1 );
 
1206     virtual bool DeleteRows( size_t pos = 0, size_t numRows = 1 );
 
1207     virtual bool InsertCols( size_t pos = 0, size_t numCols = 1 );
 
1208     virtual bool AppendCols( size_t numCols = 1 );
 
1209     virtual bool DeleteCols( size_t pos = 0, size_t numCols = 1 );
 
1211     virtual wxString GetRowLabelValue( int row );
 
1212     virtual wxString GetColLabelValue( int col );
 
1213     virtual void SetRowLabelValue( int row, const wxString& value );
 
1214     virtual void SetColLabelValue( int col, const wxString& value );
 
1216     virtual bool CanHaveAttributes();
 
1218     virtual wxGridCellAttr *GetAttr( int row, int col,
 
1219                                      wxGridCellAttr::wxAttrKind  kind);
 
1220     virtual void SetAttr(wxGridCellAttr* attr, int row, int col);
 
1221     virtual void SetRowAttr(wxGridCellAttr *attr, int row);
 
1222     virtual void SetColAttr(wxGridCellAttr *attr, int col);
 
1224     %property(AttrProvider, GetAttrProvider, SetAttrProvider, doc="See `GetAttrProvider` and `SetAttrProvider`");
 
1225     %property(NumberCols, GetNumberCols, doc="See `GetNumberCols`");
 
1226     %property(NumberRows, GetNumberRows, doc="See `GetNumberRows`");
 
1227     %property(View, GetView, SetView, doc="See `GetView` and `SetView`");
 
1232 // Python-aware version
 
1234 class wxPyGridTableBase : public wxGridTableBase
 
1237     wxPyGridTableBase() : wxGridTableBase() {}
 
1239     PYCALLBACK_INT__pure(GetNumberRows);
 
1240     PYCALLBACK_INT__pure(GetNumberCols);
 
1241     PYCALLBACK_BOOL_INTINT_pure(IsEmptyCell);
 
1242     PYCALLBACK_STRING_INTINT(wxGridTableBase, GetTypeName);
 
1243     PYCALLBACK_BOOL_INTINTSTRING(wxGridTableBase, CanGetValueAs);
 
1244     PYCALLBACK_BOOL_INTINTSTRING(wxGridTableBase, CanSetValueAs);
 
1245     PYCALLBACK__(wxGridTableBase, Clear);
 
1246     PYCALLBACK_BOOL_SIZETSIZET(wxGridTableBase, InsertRows);
 
1247     PYCALLBACK_BOOL_SIZETSIZET(wxGridTableBase, DeleteRows);
 
1248     PYCALLBACK_BOOL_SIZETSIZET(wxGridTableBase, InsertCols);
 
1249     PYCALLBACK_BOOL_SIZETSIZET(wxGridTableBase, DeleteCols);
 
1250     PYCALLBACK_BOOL_SIZET(wxGridTableBase, AppendRows);
 
1251     PYCALLBACK_BOOL_SIZET(wxGridTableBase, AppendCols);
 
1252     PYCALLBACK_STRING_INT(wxGridTableBase, GetRowLabelValue);
 
1253     PYCALLBACK_STRING_INT(wxGridTableBase, GetColLabelValue);
 
1254     PYCALLBACK__INTSTRING(wxGridTableBase, SetRowLabelValue);
 
1255     PYCALLBACK__INTSTRING(wxGridTableBase, SetColLabelValue);
 
1256     PYCALLBACK_BOOL_(wxGridTableBase, CanHaveAttributes);
 
1257     PYCALLBACK_GCA_INTINTKIND(wxGridTableBase, GetAttr);
 
1258     PYCALLBACK__GCAINTINT(wxGridTableBase, SetAttr);
 
1259     PYCALLBACK__GCAINT(wxGridTableBase, SetRowAttr);
 
1260     PYCALLBACK__GCAINT(wxGridTableBase, SetColAttr);
 
1263     wxString GetValue(int row, int col) {
 
1264         wxPyBlock_t blocked = wxPyBeginBlockThreads();
 
1266         if (wxPyCBH_findCallback(m_myInst, "GetValue")) {
 
1268             ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("(ii)",row,col));
 
1270                 if (!PyString_Check(ro) && !PyUnicode_Check(ro)) {
 
1272                     ro = PyObject_Str(ro);
 
1275                 rval = Py2wxString(ro);
 
1279         wxPyEndBlockThreads(blocked);
 
1283     void SetValue(int row, int col, const wxString& val) {
 
1284         wxPyBlock_t blocked = wxPyBeginBlockThreads();
 
1285         if (wxPyCBH_findCallback(m_myInst, "SetValue")) {
 
1286             PyObject* s = wx2PyString(val);
 
1287             wxPyCBH_callCallback(m_myInst, Py_BuildValue("(iiO)",row,col,s));
 
1290         wxPyEndBlockThreads(blocked);
 
1294     // Map the Get/Set methods for the standard non-string types to
 
1295     // the GetValue and SetValue python methods.
 
1296     long GetValueAsLong( int row, int col ) {
 
1298         wxPyBlock_t blocked = wxPyBeginBlockThreads();
 
1299         if (wxPyCBH_findCallback(m_myInst, "GetValue")) {
 
1302             ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("(ii)", row, col));
 
1303             if (ro && PyNumber_Check(ro)) {
 
1304                 num = PyNumber_Int(ro);
 
1306                     rval = PyInt_AsLong(num);
 
1312         wxPyEndBlockThreads(blocked);
 
1316     double GetValueAsDouble( int row, int col ) {
 
1318         wxPyBlock_t blocked = wxPyBeginBlockThreads();
 
1319         if (wxPyCBH_findCallback(m_myInst, "GetValue")) {
 
1322             ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("(ii)", row, col));
 
1323             if (ro && PyNumber_Check(ro)) {
 
1324                 num = PyNumber_Float(ro);
 
1326                     rval = PyFloat_AsDouble(num);
 
1332         wxPyEndBlockThreads(blocked);
 
1336     bool GetValueAsBool( int row, int col ) {
 
1337         return (bool)GetValueAsLong(row, col);
 
1340     void SetValueAsLong( int row, int col, long value ) {
 
1341         wxPyBlock_t blocked = wxPyBeginBlockThreads();
 
1342         if (wxPyCBH_findCallback(m_myInst, "SetValue")) {
 
1343             wxPyCBH_callCallback(m_myInst, Py_BuildValue("(iii)", row, col, value));
 
1345         wxPyEndBlockThreads(blocked);
 
1348     void SetValueAsDouble( int row, int col, double value ) {
 
1349         wxPyBlock_t blocked = wxPyBeginBlockThreads();
 
1350         if (wxPyCBH_findCallback(m_myInst, "SetValue")) {
 
1351             wxPyCBH_callCallback(m_myInst, Py_BuildValue("(iid)", row, col, value));
 
1353         wxPyEndBlockThreads(blocked);
 
1356     void SetValueAsBool( int row, int col, bool value ) {
 
1357         SetValueAsLong( row, col, (long)value );
 
1366 // The python-aware version get's SWIGified
 
1367 class wxPyGridTableBase : public wxGridTableBase
 
1370     %pythonAppend wxPyGridTableBase  "self._setOORInfo(self);"  setCallbackInfo(PyGridTableBase)
 
1371     wxPyGridTableBase();
 
1372     void _setCallbackInfo(PyObject* self, PyObject* _class);
 
1374     %pythonPrepend Destroy "args[0].this.own(False)"
 
1375     %extend { void Destroy() { delete self; } }
 
1377     wxString GetTypeName( int row, int col );
 
1378     bool CanGetValueAs( int row, int col, const wxString& typeName );
 
1379     bool CanSetValueAs( int row, int col, const wxString& typeName );
 
1381     bool InsertRows( size_t pos = 0, size_t numRows = 1 );
 
1382     bool AppendRows( size_t numRows = 1 );
 
1383     bool DeleteRows( size_t pos = 0, size_t numRows = 1 );
 
1384     bool InsertCols( size_t pos = 0, size_t numCols = 1 );
 
1385     bool AppendCols( size_t numCols = 1 );
 
1386     bool DeleteCols( size_t pos = 0, size_t numCols = 1 );
 
1387     wxString GetRowLabelValue( int row );
 
1388     wxString GetColLabelValue( int col );
 
1389     void SetRowLabelValue( int row, const wxString& value );
 
1390     void SetColLabelValue( int col, const wxString& value );
 
1391     bool CanHaveAttributes();
 
1392     wxGridCellAttr *GetAttr( int row, int col,
 
1393                                   wxGridCellAttr::wxAttrKind kind );
 
1394     void SetAttr(wxGridCellAttr* attr, int row, int col);
 
1395     void SetRowAttr(wxGridCellAttr *attr, int row);
 
1396     void SetColAttr(wxGridCellAttr *attr, int col);
 
1398     %MAKE_BASE_FUNC(PyGridTableBase, GetTypeName);
 
1399     %MAKE_BASE_FUNC(PyGridTableBase, CanGetValueAs);
 
1400     %MAKE_BASE_FUNC(PyGridTableBase, CanSetValueAs);
 
1401     %MAKE_BASE_FUNC(PyGridTableBase, Clear);
 
1402     %MAKE_BASE_FUNC(PyGridTableBase, InsertRows);
 
1403     %MAKE_BASE_FUNC(PyGridTableBase, AppendRows);
 
1404     %MAKE_BASE_FUNC(PyGridTableBase, DeleteRows);
 
1405     %MAKE_BASE_FUNC(PyGridTableBase, InsertCols);
 
1406     %MAKE_BASE_FUNC(PyGridTableBase, AppendCols);
 
1407     %MAKE_BASE_FUNC(PyGridTableBase, DeleteCols);
 
1408     %MAKE_BASE_FUNC(PyGridTableBase, GetRowLabelValue);
 
1409     %MAKE_BASE_FUNC(PyGridTableBase, GetColLabelValue);
 
1410     %MAKE_BASE_FUNC(PyGridTableBase, SetRowLabelValue);
 
1411     %MAKE_BASE_FUNC(PyGridTableBase, SetColLabelValue);
 
1412     %MAKE_BASE_FUNC(PyGridTableBase, CanHaveAttributes);
 
1413     %MAKE_BASE_FUNC(PyGridTableBase, GetAttr);
 
1414     %MAKE_BASE_FUNC(PyGridTableBase, SetAttr);
 
1415     %MAKE_BASE_FUNC(PyGridTableBase, SetRowAttr);
 
1416     %MAKE_BASE_FUNC(PyGridTableBase, SetColAttr);
 
1420 //---------------------------------------------------------------------------
 
1421 // Predefined Tables
 
1423 class  wxGridStringTable : public wxGridTableBase
 
1426     %pythonAppend wxGridStringTable "self._setOORInfo(self)"
 
1427     wxGridStringTable( int numRows=0, int numCols=0 );
 
1430 //---------------------------------------------------------------------------
 
1431 // The Table can pass messages to the grid to tell it to update itself if
 
1432 // something has changed.
 
1434 enum wxGridTableRequest
 
1436     wxGRIDTABLE_REQUEST_VIEW_GET_VALUES = 2000,
 
1437     wxGRIDTABLE_REQUEST_VIEW_SEND_VALUES,
 
1438     wxGRIDTABLE_NOTIFY_ROWS_INSERTED,
 
1439     wxGRIDTABLE_NOTIFY_ROWS_APPENDED,
 
1440     wxGRIDTABLE_NOTIFY_ROWS_DELETED,
 
1441     wxGRIDTABLE_NOTIFY_COLS_INSERTED,
 
1442     wxGRIDTABLE_NOTIFY_COLS_APPENDED,
 
1443     wxGRIDTABLE_NOTIFY_COLS_DELETED
 
1447 class wxGridTableMessage
 
1450     wxGridTableMessage( wxGridTableBase *table, int id,
 
1453     ~wxGridTableMessage();
 
1455     void SetTableObject( wxGridTableBase *table );
 
1456     wxGridTableBase * GetTableObject() const;
 
1457     void SetId( int id );
 
1459     void SetCommandInt( int comInt1 );
 
1460     int  GetCommandInt();
 
1461     void SetCommandInt2( int comInt2 );
 
1462     int  GetCommandInt2();
 
1464     %property(CommandInt, GetCommandInt, SetCommandInt, doc="See `GetCommandInt` and `SetCommandInt`");
 
1465     %property(CommandInt2, GetCommandInt2, SetCommandInt2, doc="See `GetCommandInt2` and `SetCommandInt2`");
 
1466     %property(Id, GetId, SetId, doc="See `GetId` and `SetId`");
 
1467     %property(TableObject, GetTableObject, SetTableObject, doc="See `GetTableObject` and `SetTableObject`");
 
1471 //---------------------------------------------------------------------------
 
1474 // Typemap to allow conversion of sequence objects to wxGridCellCoords...
 
1475 %typemap(in) wxGridCellCoords& (wxGridCellCoords temp) {
 
1477     if (! wxGridCellCoords_helper($input, &$1)) SWIG_fail;
 
1479 %typemap(typecheck, precedence=SWIG_TYPECHECK_POINTER) wxGridCellCoords& {
 
1480     $1 = wxGridCellCoords_typecheck($input);
 
1484 // ...and here is the associated helper.
 
1486 bool wxGridCellCoords_helper(PyObject* source, wxGridCellCoords** obj) {
 
1488     if (source == Py_None) {
 
1489         **obj = wxGridCellCoords(-1,-1);
 
1493     // If source is an object instance then it may already be the right type
 
1494     if (wxPySwigInstance_Check(source)) {
 
1495         wxGridCellCoords* ptr;
 
1496         if (! wxPyConvertSwigPtr(source, (void **)&ptr, wxT("wxGridCellCoords")))
 
1501     // otherwise a 2-tuple of integers is expected
 
1502     else if (PySequence_Check(source) && PyObject_Length(source) == 2) {
 
1503         PyObject* o1 = PySequence_GetItem(source, 0);
 
1504         PyObject* o2 = PySequence_GetItem(source, 1);
 
1505         if (!PyNumber_Check(o1) || !PyNumber_Check(o2)) {
 
1510         **obj = wxGridCellCoords(PyInt_AsLong(o1), PyInt_AsLong(o2));
 
1517     PyErr_SetString(PyExc_TypeError, "Expected a 2-tuple of integers or a wxGridCellCoords object.");
 
1522 bool wxGridCellCoords_typecheck(PyObject* source) {
 
1525     if (wxPySwigInstance_Check(source) &&
 
1526         wxPyConvertSwigPtr(source, (void **)&ptr, wxT("wxGridCellCoords")))
 
1530     if (PySequence_Check(source) && PySequence_Length(source) == 2)
 
1538 // Typemap to convert an array of cells coords to a list of tuples...
 
1539 %typemap(out) wxGridCellCoordsArray {
 
1540     $result = wxGridCellCoordsArray_helper($1);
 
1543 // %typemap(ret) wxGridCellCoordsArray {
 
1548 // ...and the helper function for the above typemap.
 
1550 PyObject* wxGridCellCoordsArray_helper(const wxGridCellCoordsArray& source)
 
1552     PyObject* list = PyList_New(0);
 
1554     for (idx = 0; idx < source.GetCount(); idx += 1) {
 
1555         wxGridCellCoords& coord = source.Item(idx);
 
1556         PyObject* tup = PyTuple_New(2);
 
1557         PyTuple_SET_ITEM(tup, 0, PyInt_FromLong(coord.GetRow()));
 
1558         PyTuple_SET_ITEM(tup, 1, PyInt_FromLong(coord.GetCol()));
 
1559         PyList_Append(list, tup);
 
1570 class wxGridCellCoords
 
1573     wxGridCellCoords( int r=-1, int c=-1 );
 
1574     ~wxGridCellCoords();
 
1577     void SetRow( int n );
 
1579     void SetCol( int n );
 
1580     void Set( int row, int col );
 
1584         DocStr(__eq__, "Test for equality of GridCellCoords objects.", "");
 
1585         bool __eq__(PyObject* other) {
 
1586             wxGridCellCoords  temp, *obj = &temp;
 
1587             if ( other == Py_None ) return false;
 
1588             if ( ! wxGridCellCoords_helper(other, &obj) ) {
 
1592             return self->operator==(*obj);
 
1597         DocStr(__ne__, "Test for inequality of GridCellCoords objects.", "");
 
1598         bool __ne__(PyObject* other) {
 
1599             wxGridCellCoords  temp, *obj = &temp;
 
1600             if ( other == Py_None ) return true;
 
1601             if ( ! wxGridCellCoords_helper(other, &obj)) {
 
1605             return self->operator!=(*obj);
 
1612             PyObject* tup = PyTuple_New(2);
 
1613             PyTuple_SET_ITEM(tup, 0, PyInt_FromLong(self->GetRow()));
 
1614             PyTuple_SET_ITEM(tup, 1, PyInt_FromLong(self->GetCol()));
 
1619     asTuple = wx._deprecated(Get, "asTuple is deprecated, use `Get` instead")
 
1620     def __str__(self):                   return str(self.Get())
 
1621     def __repr__(self):                  return 'wxGridCellCoords'+str(self.Get())
 
1622     def __len__(self):                   return len(self.Get())
 
1623     def __getitem__(self, index):        return self.Get()[index]
 
1624     def __setitem__(self, index, val):
 
1625         if index == 0: self.SetRow(val)
 
1626         elif index == 1: self.SetCol(val)
 
1627         else: raise IndexError
 
1630     %property(Col, GetCol, SetCol, doc="See `GetCol` and `SetCol`");
 
1631     %property(Row, GetRow, SetRow, doc="See `GetRow` and `SetRow`");
 
1635 //---------------------------------------------------------------------------
 
1636 //---------------------------------------------------------------------------
 
1640 // Fool SWIG into treating this enum as an int
 
1641 typedef int WXGRIDSELECTIONMODES;
 
1643 // but let the C++ code know what it really is.
 
1645 typedef wxGrid::wxGridSelectionModes WXGRIDSELECTIONMODES;
 
1650 MustHaveApp(wxGrid);
 
1652 class wxGrid : public wxScrolledWindow
 
1655     %pythonAppend wxGrid "self._setOORInfo(self)"
 
1656     %pythonAppend wxGrid() ""
 
1658     %typemap(out) wxGrid*;    // turn off this typemap
 
1660     wxGrid( wxWindow *parent,
 
1662             const wxPoint& pos = wxDefaultPosition,
 
1663             const wxSize& size = wxDefaultSize,
 
1664             long style = wxWANTS_CHARS,
 
1665             const wxString& name = wxPyGridNameStr);
 
1667     %RenameCtor(PreGrid,  wxGrid());
 
1670     // Turn it back on again
 
1671     %typemap(out) wxGrid* { $result = wxPyMake_wxObject($1, $owner); }
 
1674     bool Create( wxWindow *parent,
 
1676                  const wxPoint& pos = wxDefaultPosition,
 
1677                  const wxSize& size = wxDefaultSize,
 
1678                  long style = wxWANTS_CHARS,
 
1679                  const wxString& name = wxPyGridNameStr );
 
1681     // Override the global renamer to leave these as they are, for backwards
 
1683     %rename(wxGridSelectCells)   wxGridSelectCells;
 
1684     %rename(wxGridSelectRows)    wxGridSelectRows;
 
1685     %rename(wxGridSelectColumns) wxGridSelectColumns;
 
1687     enum wxGridSelectionModes {
 
1693         SelectCells =   wxGridSelectCells
 
1694         SelectRows =    wxGridSelectRows
 
1695         SelectColumns = wxGridSelectColumns
 
1698     bool CreateGrid( int numRows, int numCols,
 
1699                      WXGRIDSELECTIONMODES selmode = wxGrid::wxGridSelectCells );
 
1700     void SetSelectionMode(WXGRIDSELECTIONMODES selmode);
 
1701     WXGRIDSELECTIONMODES GetSelectionMode();
 
1704     // ------ grid dimensions
 
1706     int      GetNumberRows();
 
1707     int      GetNumberCols();
 
1710     bool ProcessTableMessage( wxGridTableMessage& );
 
1713     wxGridTableBase * GetTable() const;
 
1715     %disownarg(wxGridTableBase *);
 
1716     bool SetTable( wxGridTableBase *table, bool takeOwnership=false,
 
1717                    WXGRIDSELECTIONMODES selmode =
 
1718                    wxGrid::wxGridSelectCells );
 
1719     %cleardisown(wxGridTableBase *);
 
1722     bool InsertRows( int pos = 0, int numRows = 1, bool updateLabels=true );
 
1723     bool AppendRows( int numRows = 1, bool updateLabels=true );
 
1724     bool DeleteRows( int pos = 0, int numRows = 1, bool updateLabels=true );
 
1725     bool InsertCols( int pos = 0, int numCols = 1, bool updateLabels=true );
 
1726     bool AppendCols( int numCols = 1, bool updateLabels=true );
 
1727     bool DeleteCols( int pos = 0, int numCols = 1, bool updateLabels=true );
 
1730     // this function is called when the current cell highlight must be redrawn
 
1731     // and may be overridden by the user
 
1732     virtual void DrawCellHighlight( wxDC& dc, const wxGridCellAttr *attr );
 
1735     // ------ Cell text drawing functions
 
1737     void DrawTextRectangle( wxDC& dc, const wxString&, const wxRect&,
 
1738                             int horizontalAlignment = wxLEFT,
 
1739                             int verticalAlignment = wxTOP,
 
1740                             int textOrientation = wxHORIZONTAL );
 
1742 //      // Split a string containing newline chararcters into an array of
 
1743 //      // strings and return the number of lines
 
1745 //      void StringToLines( const wxString& value, wxArrayString& lines );
 
1748         void, GetTextBoxSize( wxDC& dc, wxArrayString& lines,
 
1749                               long *OUTPUT, long *OUTPUT ),
 
1750         "GetTextBoxSize(DC dc, list lines) -> (width, height)");
 
1754     // Code that does a lot of grid modification can be enclosed
 
1755     // between BeginBatch() and EndBatch() calls to avoid screen
 
1760     int      GetBatchCount();
 
1761     void     ForceRefresh();
 
1764     // ------ edit control functions
 
1767     void EnableEditing( bool edit );
 
1769     void EnableCellEditControl( bool enable = true );
 
1770     void DisableCellEditControl();
 
1771     bool CanEnableCellControl() const;
 
1772     bool IsCellEditControlEnabled() const;
 
1773     bool IsCellEditControlShown() const;
 
1775     bool IsCurrentCellReadOnly() const;
 
1777     void ShowCellEditControl();
 
1778     void HideCellEditControl();
 
1779     void SaveEditControlValue();
 
1782     // ------ grid location functions
 
1783     //  Note that all of these functions work with the logical coordinates of
 
1784     //  grid cells and labels so you will need to convert from device
 
1785     //  coordinates for mouse events etc.
 
1788     //void XYToCell( int x, int y, wxGridCellCoords& );
 
1790         wxGridCellCoords XYToCell(int x, int y) {
 
1791             wxGridCellCoords rv;
 
1792             self->XYToCell(x, y, rv);
 
1797     int  YToRow( int y );
 
1798     int  XToCol( int x, bool clipToMinMax = false );
 
1800     int  YToEdgeOfRow( int y );
 
1801     int  XToEdgeOfCol( int x );
 
1803     wxRect CellToRect( int row, int col );
 
1804     // TODO: ??? wxRect CellToRect( const wxGridCellCoords& coords );
 
1807     int  GetGridCursorRow();
 
1808     int  GetGridCursorCol();
 
1810     // check to see if a cell is either wholly visible (the default arg) or
 
1811     // at least partially visible in the grid window
 
1813     bool IsVisible( int row, int col, bool wholeCellVisible = true );
 
1814     // TODO: ??? bool IsVisible( const wxGridCellCoords& coords, bool wholeCellVisible = true );
 
1815     void MakeCellVisible( int row, int col );
 
1816     // TODO: ??? void MakeCellVisible( const wxGridCellCoords& coords );
 
1819     // ------ grid cursor movement functions
 
1821     void SetGridCursor( int row, int col );
 
1822     bool MoveCursorUp( bool expandSelection );
 
1823     bool MoveCursorDown( bool expandSelection );
 
1824     bool MoveCursorLeft( bool expandSelection );
 
1825     bool MoveCursorRight( bool expandSelection );
 
1826     bool MovePageDown();
 
1828     bool MoveCursorUpBlock( bool expandSelection );
 
1829     bool MoveCursorDownBlock( bool expandSelection );
 
1830     bool MoveCursorLeftBlock( bool expandSelection );
 
1831     bool MoveCursorRightBlock( bool expandSelection );
 
1834     // ------ label and gridline formatting
 
1836     int      GetDefaultRowLabelSize();
 
1837     int      GetRowLabelSize();
 
1838     int      GetDefaultColLabelSize();
 
1839     int      GetColLabelSize();
 
1840     wxColour GetLabelBackgroundColour();
 
1841     wxColour GetLabelTextColour();
 
1842     wxFont   GetLabelFont();
 
1845         void, GetRowLabelAlignment( int *OUTPUT, int *OUTPUT ),
 
1846         "GetRowLabelAlignment() -> (horiz, vert)");
 
1849         void, GetColLabelAlignment( int *OUTPUT, int *OUTPUT ),
 
1850         "GetColLabelAlignment() -> (horiz, vert)");
 
1852     int      GetColLabelTextOrientation();
 
1853     wxString GetRowLabelValue( int row );
 
1854     wxString GetColLabelValue( int col );
 
1855     wxColour GetGridLineColour();
 
1857     virtual wxPen GetDefaultGridLinePen();
 
1858     virtual wxPen GetRowGridLinePen(int row);
 
1859     virtual wxPen GetColGridLinePen(int col);
 
1862     wxColour GetCellHighlightColour();
 
1863     int      GetCellHighlightPenWidth();
 
1864     int      GetCellHighlightROPenWidth();
 
1866     void     SetRowLabelSize( int width );
 
1867     void     SetColLabelSize( int height );
 
1868     void     SetLabelBackgroundColour( const wxColour& );
 
1869     void     SetLabelTextColour( const wxColour& );
 
1870     void     SetLabelFont( const wxFont& );
 
1871     void     SetRowLabelAlignment( int horiz, int vert );
 
1872     void     SetColLabelAlignment( int horiz, int vert );
 
1873     void     SetColLabelTextOrientation( int textOrientation );
 
1874     void     SetRowLabelValue( int row, const wxString& );
 
1875     void     SetColLabelValue( int col, const wxString& );
 
1876     void     SetGridLineColour( const wxColour& );
 
1877     void     SetCellHighlightColour( const wxColour& );
 
1878     void     SetCellHighlightPenWidth(int width);
 
1879     void     SetCellHighlightROPenWidth(int width);
 
1881     void     EnableDragRowSize( bool enable = true );
 
1882     void     DisableDragRowSize();
 
1883     bool     CanDragRowSize();
 
1884     void     EnableDragColSize( bool enable = true );
 
1885     void     DisableDragColSize();
 
1886     bool     CanDragColSize();
 
1887     void     EnableDragColMove( bool enable = true );
 
1888     void     DisableDragColMove() { EnableDragColMove( false ); }
 
1889     bool     CanDragColMove() { return m_canDragColMove; }
 
1890     void     EnableDragGridSize(bool enable = true);
 
1891     void     DisableDragGridSize();
 
1892     bool     CanDragGridSize();
 
1894     void     EnableDragCell( bool enable = true );
 
1895     void     DisableDragCell();
 
1898     // this sets the specified attribute for all cells in this row/col
 
1899     void     SetAttr(int row, int col, wxGridCellAttr *attr);
 
1900     void     SetRowAttr(int row, wxGridCellAttr *attr);
 
1901     void     SetColAttr(int col, wxGridCellAttr *attr);
 
1903     // returns the attribute we may modify in place: a new one if this cell
 
1904     // doesn't have any yet or the existing one if it does
 
1906     // DecRef() must be called on the returned pointer, as usual
 
1907     wxGridCellAttr *GetOrCreateCellAttr(int row, int col) const;
 
1910     // shortcuts for setting the column parameters
 
1912     // set the format for the data in the column: default is string
 
1913     void     SetColFormatBool(int col);
 
1914     void     SetColFormatNumber(int col);
 
1915     void     SetColFormatFloat(int col, int width = -1, int precision = -1);
 
1916     void     SetColFormatCustom(int col, const wxString& typeName);
 
1918     void     EnableGridLines( bool enable = true );
 
1919     bool     GridLinesEnabled();
 
1921     // ------ row and col formatting
 
1923     int      GetDefaultRowSize();
 
1924     int      GetRowSize( int row );
 
1925     int      GetDefaultColSize();
 
1926     int      GetColSize( int col );
 
1927     wxColour GetDefaultCellBackgroundColour();
 
1928     wxColour GetCellBackgroundColour( int row, int col );
 
1929     wxColour GetDefaultCellTextColour();
 
1930     wxColour GetCellTextColour( int row, int col );
 
1931     wxFont   GetDefaultCellFont();
 
1932     wxFont   GetCellFont( int row, int col );
 
1935         void, GetDefaultCellAlignment( int *OUTPUT, int *OUTPUT ),
 
1936         "GetDefaultCellAlignment() -> (horiz, vert)");
 
1939         void, GetCellAlignment( int row, int col, int *OUTPUT, int *OUTPUT ),
 
1940         "GetCellAlignment(int row, int col) -> (horiz, vert)");
 
1942     bool     GetDefaultCellOverflow();
 
1943     bool     GetCellOverflow( int row, int col );
 
1946         void, GetCellSize( int row, int col, int *OUTPUT, int *OUTPUT ),
 
1947         "GetCellSize(int row, int col) -> (num_rows, num_cols)");
 
1949     void     SetDefaultRowSize( int height, bool resizeExistingRows = false );
 
1950     void     SetRowSize( int row, int height );
 
1951     void     SetDefaultColSize( int width, bool resizeExistingCols = false );
 
1953     void     SetColSize( int col, int width );
 
1955     int GetColAt( int colPos ) const;
 
1956     void SetColPos( int colID, int newPos );
 
1957     int GetColPos( int colID ) const;
 
1959     // automatically size the column or row to fit to its contents, if
 
1960     // setAsMin is True, this optimal width will also be set as minimal width
 
1962     void     AutoSizeColumn( int col, bool setAsMin = true );
 
1963     void     AutoSizeRow( int row, bool setAsMin = true );
 
1966     // auto size all columns (very ineffective for big grids!)
 
1967     void     AutoSizeColumns( bool setAsMin = true );
 
1968     void     AutoSizeRows( bool setAsMin = true );
 
1970     // auto size the grid, that is make the columns/rows of the "right" size
 
1971     // and also set the grid size to just fit its contents
 
1974     // autosize row height depending on label text
 
1975     void     AutoSizeRowLabelSize( int row );
 
1977     // autosize column width depending on label text
 
1978     void     AutoSizeColLabelSize( int col );
 
1981     // column won't be resized to be lesser width - this must be called during
 
1982     // the grid creation because it won't resize the column if it's already
 
1983     // narrower than the minimal width
 
1984     void     SetColMinimalWidth( int col, int width );
 
1985     void     SetRowMinimalHeight( int row, int width );
 
1987     void     SetColMinimalAcceptableWidth( int width );
 
1988     void     SetRowMinimalAcceptableHeight( int width );
 
1989     int      GetColMinimalAcceptableWidth() const;
 
1990     int      GetRowMinimalAcceptableHeight() const;
 
1992     void     SetDefaultCellBackgroundColour( const wxColour& );
 
1993     void     SetCellBackgroundColour( int row, int col, const wxColour& );
 
1994     void     SetDefaultCellTextColour( const wxColour& );
 
1996     void     SetCellTextColour( int row, int col, const wxColour& );
 
1997     void     SetDefaultCellFont( const wxFont& );
 
1998     void     SetCellFont( int row, int col, const wxFont& );
 
1999     void     SetDefaultCellAlignment( int horiz, int vert );
 
2000     void     SetCellAlignment( int row, int col, int horiz, int vert );
 
2001     void     SetDefaultCellOverflow( bool allow );
 
2002     void     SetCellOverflow( int row, int col, bool allow );
 
2003     void     SetCellSize( int row, int col, int num_rows, int num_cols );
 
2005     // takes ownership of the pointer
 
2006     void SetDefaultRenderer(wxGridCellRenderer *renderer);
 
2007     void SetCellRenderer(int row, int col, wxGridCellRenderer *renderer);
 
2008     wxGridCellRenderer *GetDefaultRenderer() const;
 
2009     wxGridCellRenderer* GetCellRenderer(int row, int col);
 
2011     // takes ownership of the pointer
 
2012     void SetDefaultEditor(wxGridCellEditor *editor);
 
2013     void SetCellEditor(int row, int col, wxGridCellEditor *editor);
 
2014     wxGridCellEditor *GetDefaultEditor() const;
 
2015     wxGridCellEditor* GetCellEditor(int row, int col);
 
2019     // ------ cell value accessors
 
2021     wxString GetCellValue( int row, int col );
 
2022     // TODO: ??? wxString GetCellValue( const wxGridCellCoords& coords )
 
2024     void SetCellValue( int row, int col, const wxString& s );
 
2025     // TODO: ??? void SetCellValue( const wxGridCellCoords& coords, const wxString& s )
 
2027     // returns True if the cell can't be edited
 
2028     bool IsReadOnly(int row, int col) const;
 
2030     // make the cell editable/readonly
 
2031     void SetReadOnly(int row, int col, bool isReadOnly = true);
 
2033     // ------ selections of blocks of cells
 
2035     void SelectRow( int row, bool addToSelected = false );
 
2036     void SelectCol( int col, bool addToSelected = false );
 
2038     void SelectBlock( int topRow, int leftCol, int bottomRow, int rightCol,
 
2039                       bool addToSelected = false );
 
2040     // TODO: ??? void SelectBlock( const wxGridCellCoords& topLeft,
 
2041     // TODO: ???                   const wxGridCellCoords& bottomRight )
 
2045     void ClearSelection();
 
2046     bool IsInSelection( int row, int col );
 
2047     // TODO: ??? bool IsInSelection( const wxGridCellCoords& coords )
 
2049     const wxGridCellCoordsArray GetSelectedCells() const;
 
2050     const wxGridCellCoordsArray GetSelectionBlockTopLeft() const;
 
2051     const wxGridCellCoordsArray GetSelectionBlockBottomRight() const;
 
2052     const wxArrayInt GetSelectedRows() const;
 
2053     const wxArrayInt GetSelectedCols() const;
 
2055     void DeselectRow( int row );
 
2056     void DeselectCol( int col );
 
2057     void DeselectCell( int row, int col );
 
2060     // This function returns the rectangle that encloses the block of cells
 
2061     // limited by TopLeft and BottomRight cell in device coords and clipped
 
2062     //  to the client size of the grid window.
 
2064     wxRect BlockToDeviceRect( const wxGridCellCoords & topLeft,
 
2065                               const wxGridCellCoords & bottomRight );
 
2068     // Access or update the selection fore/back colours
 
2069     wxColour GetSelectionBackground() const;
 
2070     wxColour GetSelectionForeground() const;
 
2072     void SetSelectionBackground(const wxColour& c);
 
2073     void SetSelectionForeground(const wxColour& c);
 
2076     // Methods for a registry for mapping data types to Renderers/Editors
 
2077     void RegisterDataType(const wxString& typeName,
 
2078                           wxGridCellRenderer* renderer,
 
2079                           wxGridCellEditor* editor);
 
2080     wxGridCellEditor* GetDefaultEditorForCell(int row, int col) const;
 
2081     // TODO: ??? wxGridCellEditor* GetDefaultEditorForCell(const wxGridCellCoords& c) const
 
2082     wxGridCellRenderer* GetDefaultRendererForCell(int row, int col) const;
 
2083     wxGridCellEditor* GetDefaultEditorForType(const wxString& typeName) const;
 
2084     wxGridCellRenderer* GetDefaultRendererForType(const wxString& typeName) const;
 
2086     // grid may occupy more space than needed for its rows/columns, this
 
2087     // function allows to set how big this extra space is
 
2088     void SetMargins(int extraWidth, int extraHeight);
 
2091     // Accessors for component windows
 
2092     wxWindow* GetGridWindow();
 
2093     wxWindow* GetGridRowLabelWindow();
 
2094     wxWindow* GetGridColLabelWindow();
 
2095     wxWindow* GetGridCornerLabelWindow();
 
2097     // Allow adjustment of scroll increment. The default is (15, 15).
 
2098     void SetScrollLineX(int x);
 
2099     void SetScrollLineY(int y);
 
2100     int GetScrollLineX() const;
 
2101     int GetScrollLineY() const;
 
2103     int GetScrollX(int x) const;
 
2104     int GetScrollY(int y) const;
 
2106     static wxVisualAttributes
 
2107     GetClassDefaultAttributes(wxWindowVariant variant = wxWINDOW_VARIANT_NORMAL);
 
2109     %property(BatchCount, GetBatchCount, doc="See `GetBatchCount`");
 
2110     %property(CellHighlightColour, GetCellHighlightColour, SetCellHighlightColour, doc="See `GetCellHighlightColour` and `SetCellHighlightColour`");
 
2111     %property(CellHighlightPenWidth, GetCellHighlightPenWidth, SetCellHighlightPenWidth, doc="See `GetCellHighlightPenWidth` and `SetCellHighlightPenWidth`");
 
2112     %property(CellHighlightROPenWidth, GetCellHighlightROPenWidth, SetCellHighlightROPenWidth, doc="See `GetCellHighlightROPenWidth` and `SetCellHighlightROPenWidth`");
 
2113     %property(CellSize, GetCellSize, SetCellSize, doc="See `GetCellSize` and `SetCellSize`");
 
2114     %property(ColLabelAlignment, GetColLabelAlignment, SetColLabelAlignment, doc="See `GetColLabelAlignment` and `SetColLabelAlignment`");
 
2115     %property(ColLabelSize, GetColLabelSize, SetColLabelSize, doc="See `GetColLabelSize` and `SetColLabelSize`");
 
2116     %property(ColLabelTextOrientation, GetColLabelTextOrientation, SetColLabelTextOrientation, doc="See `GetColLabelTextOrientation` and `SetColLabelTextOrientation`");
 
2117     %property(ColMinimalAcceptableWidth, GetColMinimalAcceptableWidth, SetColMinimalAcceptableWidth, doc="See `GetColMinimalAcceptableWidth` and `SetColMinimalAcceptableWidth`");
 
2118     %property(DefaultCellAlignment, GetDefaultCellAlignment, SetDefaultCellAlignment, doc="See `GetDefaultCellAlignment` and `SetDefaultCellAlignment`");
 
2119     %property(DefaultCellBackgroundColour, GetDefaultCellBackgroundColour, SetDefaultCellBackgroundColour, doc="See `GetDefaultCellBackgroundColour` and `SetDefaultCellBackgroundColour`");
 
2120     %property(DefaultCellFont, GetDefaultCellFont, SetDefaultCellFont, doc="See `GetDefaultCellFont` and `SetDefaultCellFont`");
 
2121     %property(DefaultCellOverflow, GetDefaultCellOverflow, SetDefaultCellOverflow, doc="See `GetDefaultCellOverflow` and `SetDefaultCellOverflow`");
 
2122     %property(DefaultCellTextColour, GetDefaultCellTextColour, SetDefaultCellTextColour, doc="See `GetDefaultCellTextColour` and `SetDefaultCellTextColour`");
 
2123     %property(DefaultColLabelSize, GetDefaultColLabelSize, doc="See `GetDefaultColLabelSize`");
 
2124     %property(DefaultColSize, GetDefaultColSize, SetDefaultColSize, doc="See `GetDefaultColSize` and `SetDefaultColSize`");
 
2125     %property(DefaultEditor, GetDefaultEditor, SetDefaultEditor, doc="See `GetDefaultEditor` and `SetDefaultEditor`");
 
2126     %property(DefaultGridLinePen, GetDefaultGridLinePen, doc="See `GetDefaultGridLinePen`");
 
2127     %property(DefaultRenderer, GetDefaultRenderer, SetDefaultRenderer, doc="See `GetDefaultRenderer` and `SetDefaultRenderer`");
 
2128     %property(DefaultRowLabelSize, GetDefaultRowLabelSize, doc="See `GetDefaultRowLabelSize`");
 
2129     %property(DefaultRowSize, GetDefaultRowSize, SetDefaultRowSize, doc="See `GetDefaultRowSize` and `SetDefaultRowSize`");
 
2130     %property(GridColLabelWindow, GetGridColLabelWindow, doc="See `GetGridColLabelWindow`");
 
2131     %property(GridCornerLabelWindow, GetGridCornerLabelWindow, doc="See `GetGridCornerLabelWindow`");
 
2132     %property(GridCursorCol, GetGridCursorCol, doc="See `GetGridCursorCol`");
 
2133     %property(GridCursorRow, GetGridCursorRow, doc="See `GetGridCursorRow`");
 
2134     %property(GridLineColour, GetGridLineColour, SetGridLineColour, doc="See `GetGridLineColour` and `SetGridLineColour`");
 
2135     %property(GridRowLabelWindow, GetGridRowLabelWindow, doc="See `GetGridRowLabelWindow`");
 
2136     %property(GridWindow, GetGridWindow, doc="See `GetGridWindow`");
 
2137     %property(LabelBackgroundColour, GetLabelBackgroundColour, SetLabelBackgroundColour, doc="See `GetLabelBackgroundColour` and `SetLabelBackgroundColour`");
 
2138     %property(LabelFont, GetLabelFont, SetLabelFont, doc="See `GetLabelFont` and `SetLabelFont`");
 
2139     %property(LabelTextColour, GetLabelTextColour, SetLabelTextColour, doc="See `GetLabelTextColour` and `SetLabelTextColour`");
 
2140     %property(NumberCols, GetNumberCols, doc="See `GetNumberCols`");
 
2141     %property(NumberRows, GetNumberRows, doc="See `GetNumberRows`");
 
2142     %property(RowLabelAlignment, GetRowLabelAlignment, SetRowLabelAlignment, doc="See `GetRowLabelAlignment` and `SetRowLabelAlignment`");
 
2143     %property(RowLabelSize, GetRowLabelSize, SetRowLabelSize, doc="See `GetRowLabelSize` and `SetRowLabelSize`");
 
2144     %property(RowMinimalAcceptableHeight, GetRowMinimalAcceptableHeight, SetRowMinimalAcceptableHeight, doc="See `GetRowMinimalAcceptableHeight` and `SetRowMinimalAcceptableHeight`");
 
2145     %property(ScrollLineX, GetScrollLineX, SetScrollLineX, doc="See `GetScrollLineX` and `SetScrollLineX`");
 
2146     %property(ScrollLineY, GetScrollLineY, SetScrollLineY, doc="See `GetScrollLineY` and `SetScrollLineY`");
 
2147     %property(SelectedCells, GetSelectedCells, doc="See `GetSelectedCells`");
 
2148     %property(SelectedCols, GetSelectedCols, doc="See `GetSelectedCols`");
 
2149     %property(SelectedRows, GetSelectedRows, doc="See `GetSelectedRows`");
 
2150     %property(SelectionBackground, GetSelectionBackground, SetSelectionBackground, doc="See `GetSelectionBackground` and `SetSelectionBackground`");
 
2151     %property(SelectionBlockBottomRight, GetSelectionBlockBottomRight, doc="See `GetSelectionBlockBottomRight`");
 
2152     %property(SelectionBlockTopLeft, GetSelectionBlockTopLeft, doc="See `GetSelectionBlockTopLeft`");
 
2153     %property(SelectionForeground, GetSelectionForeground, SetSelectionForeground, doc="See `GetSelectionForeground` and `SetSelectionForeground`");
 
2154     %property(SelectionMode, GetSelectionMode, SetSelectionMode, doc="See `GetSelectionMode` and `SetSelectionMode`");
 
2155     %property(Table, GetTable, SetTable, doc="See `GetTable` and `SetTable`");
 
2160 // ----------------------------------------------------------------------------
 
2161 // wxGridUpdateLocker prevents updates to a grid during its lifetime
 
2162 // ----------------------------------------------------------------------------
 
2164 class wxGridUpdateLocker
 
2167     // if the pointer is NULL, Create() can be called later
 
2168     wxGridUpdateLocker(wxGrid *grid = NULL);
 
2169     ~wxGridUpdateLocker();
 
2171     // can be called if ctor was used with a NULL pointer, must not be called
 
2173     void Create(wxGrid *grid);
 
2177 //---------------------------------------------------------------------------
 
2178 //---------------------------------------------------------------------------
 
2179 // Grid events and stuff
 
2183 class wxGridEvent : public wxNotifyEvent
 
2186     wxGridEvent(int id, wxEventType type, wxGrid* obj,
 
2187                 int row=-1, int col=-1, int x=-1, int y=-1, bool sel = true,
 
2188                 bool control=false, bool shift=false, bool alt=false, bool meta=false);
 
2190     virtual int GetRow();
 
2191     virtual int GetCol();
 
2192     wxPoint     GetPosition();
 
2200     %property(Col, GetCol, doc="See `GetCol`");
 
2201     %property(Position, GetPosition, doc="See `GetPosition`");
 
2202     %property(Row, GetRow, doc="See `GetRow`");
 
2206 class  wxGridSizeEvent : public wxNotifyEvent
 
2209     wxGridSizeEvent(int id, wxEventType type, wxGrid* obj,
 
2210                 int rowOrCol=-1, int x=-1, int y=-1,
 
2211                 bool control=false, bool shift=false, bool alt=false, bool meta=false);
 
2214     wxPoint     GetPosition();
 
2221     %property(Position, GetPosition, doc="See `GetPosition`");
 
2222     %property(RowOrCol, GetRowOrCol, doc="See `GetRowOrCol`");
 
2226 class wxGridRangeSelectEvent : public wxNotifyEvent
 
2229     wxGridRangeSelectEvent(int id, wxEventType type, wxGrid* obj,
 
2230                            const wxGridCellCoords& topLeft,
 
2231                            const wxGridCellCoords& bottomRight,
 
2233                            bool control=false, bool shift=false,
 
2234                            bool alt=false, bool meta=false);
 
2236     wxGridCellCoords GetTopLeftCoords();
 
2237     wxGridCellCoords GetBottomRightCoords();
 
2249     %property(BottomRightCoords, GetBottomRightCoords, doc="See `GetBottomRightCoords`");
 
2250     %property(BottomRow, GetBottomRow, doc="See `GetBottomRow`");
 
2251     %property(LeftCol, GetLeftCol, doc="See `GetLeftCol`");
 
2252     %property(RightCol, GetRightCol, doc="See `GetRightCol`");
 
2253     %property(TopLeftCoords, GetTopLeftCoords, doc="See `GetTopLeftCoords`");
 
2254     %property(TopRow, GetTopRow, doc="See `GetTopRow`");
 
2258 class wxGridEditorCreatedEvent : public wxCommandEvent {
 
2260     wxGridEditorCreatedEvent(int id, wxEventType type, wxObject* obj,
 
2261                              int row, int col, wxControl* ctrl);
 
2265     wxControl* GetControl();
 
2266     void SetRow(int row);
 
2267     void SetCol(int col);
 
2268     void SetControl(wxControl* ctrl);
 
2270     %property(Col, GetCol, SetCol, doc="See `GetCol` and `SetCol`");
 
2271     %property(Control, GetControl, SetControl, doc="See `GetControl` and `SetControl`");
 
2272     %property(Row, GetRow, SetRow, doc="See `GetRow` and `SetRow`");
 
2277 %constant wxEventType wxEVT_GRID_CELL_LEFT_CLICK;
 
2278 %constant wxEventType wxEVT_GRID_CELL_RIGHT_CLICK;
 
2279 %constant wxEventType wxEVT_GRID_CELL_LEFT_DCLICK;
 
2280 %constant wxEventType wxEVT_GRID_CELL_RIGHT_DCLICK;
 
2281 %constant wxEventType wxEVT_GRID_LABEL_LEFT_CLICK;
 
2282 %constant wxEventType wxEVT_GRID_LABEL_RIGHT_CLICK;
 
2283 %constant wxEventType wxEVT_GRID_LABEL_LEFT_DCLICK;
 
2284 %constant wxEventType wxEVT_GRID_LABEL_RIGHT_DCLICK;
 
2285 %constant wxEventType wxEVT_GRID_ROW_SIZE;
 
2286 %constant wxEventType wxEVT_GRID_COL_SIZE;
 
2287 %constant wxEventType wxEVT_GRID_RANGE_SELECT;
 
2288 %constant wxEventType wxEVT_GRID_CELL_CHANGE;
 
2289 %constant wxEventType wxEVT_GRID_SELECT_CELL;
 
2290 %constant wxEventType wxEVT_GRID_EDITOR_SHOWN;
 
2291 %constant wxEventType wxEVT_GRID_EDITOR_HIDDEN;
 
2292 %constant wxEventType wxEVT_GRID_EDITOR_CREATED;
 
2293 %constant wxEventType wxEVT_GRID_CELL_BEGIN_DRAG;
 
2298 EVT_GRID_CELL_LEFT_CLICK = wx.PyEventBinder( wxEVT_GRID_CELL_LEFT_CLICK )
 
2299 EVT_GRID_CELL_RIGHT_CLICK = wx.PyEventBinder( wxEVT_GRID_CELL_RIGHT_CLICK )
 
2300 EVT_GRID_CELL_LEFT_DCLICK = wx.PyEventBinder( wxEVT_GRID_CELL_LEFT_DCLICK )
 
2301 EVT_GRID_CELL_RIGHT_DCLICK = wx.PyEventBinder( wxEVT_GRID_CELL_RIGHT_DCLICK )
 
2302 EVT_GRID_LABEL_LEFT_CLICK = wx.PyEventBinder( wxEVT_GRID_LABEL_LEFT_CLICK )
 
2303 EVT_GRID_LABEL_RIGHT_CLICK = wx.PyEventBinder( wxEVT_GRID_LABEL_RIGHT_CLICK )
 
2304 EVT_GRID_LABEL_LEFT_DCLICK = wx.PyEventBinder( wxEVT_GRID_LABEL_LEFT_DCLICK )
 
2305 EVT_GRID_LABEL_RIGHT_DCLICK = wx.PyEventBinder( wxEVT_GRID_LABEL_RIGHT_DCLICK )
 
2306 EVT_GRID_ROW_SIZE = wx.PyEventBinder( wxEVT_GRID_ROW_SIZE )
 
2307 EVT_GRID_COL_SIZE = wx.PyEventBinder( wxEVT_GRID_COL_SIZE )
 
2308 EVT_GRID_RANGE_SELECT = wx.PyEventBinder( wxEVT_GRID_RANGE_SELECT )
 
2309 EVT_GRID_CELL_CHANGE = wx.PyEventBinder( wxEVT_GRID_CELL_CHANGE )
 
2310 EVT_GRID_SELECT_CELL = wx.PyEventBinder( wxEVT_GRID_SELECT_CELL )
 
2311 EVT_GRID_EDITOR_SHOWN = wx.PyEventBinder( wxEVT_GRID_EDITOR_SHOWN )
 
2312 EVT_GRID_EDITOR_HIDDEN = wx.PyEventBinder( wxEVT_GRID_EDITOR_HIDDEN )
 
2313 EVT_GRID_EDITOR_CREATED = wx.PyEventBinder( wxEVT_GRID_EDITOR_CREATED )
 
2314 EVT_GRID_CELL_BEGIN_DRAG = wx.PyEventBinder( wxEVT_GRID_CELL_BEGIN_DRAG )
 
2317 %# The same as above but with the ability to specify an identifier
 
2318 EVT_GRID_CMD_CELL_LEFT_CLICK =     wx.PyEventBinder( wxEVT_GRID_CELL_LEFT_CLICK,    1 )
 
2319 EVT_GRID_CMD_CELL_RIGHT_CLICK =    wx.PyEventBinder( wxEVT_GRID_CELL_RIGHT_CLICK,   1 )
 
2320 EVT_GRID_CMD_CELL_LEFT_DCLICK =    wx.PyEventBinder( wxEVT_GRID_CELL_LEFT_DCLICK,   1 )
 
2321 EVT_GRID_CMD_CELL_RIGHT_DCLICK =   wx.PyEventBinder( wxEVT_GRID_CELL_RIGHT_DCLICK,  1 )
 
2322 EVT_GRID_CMD_LABEL_LEFT_CLICK =    wx.PyEventBinder( wxEVT_GRID_LABEL_LEFT_CLICK,   1 )
 
2323 EVT_GRID_CMD_LABEL_RIGHT_CLICK =   wx.PyEventBinder( wxEVT_GRID_LABEL_RIGHT_CLICK,  1 )
 
2324 EVT_GRID_CMD_LABEL_LEFT_DCLICK =   wx.PyEventBinder( wxEVT_GRID_LABEL_LEFT_DCLICK,  1 )
 
2325 EVT_GRID_CMD_LABEL_RIGHT_DCLICK =  wx.PyEventBinder( wxEVT_GRID_LABEL_RIGHT_DCLICK, 1 )
 
2326 EVT_GRID_CMD_ROW_SIZE =            wx.PyEventBinder( wxEVT_GRID_ROW_SIZE,           1 )
 
2327 EVT_GRID_CMD_COL_SIZE =            wx.PyEventBinder( wxEVT_GRID_COL_SIZE,           1 )
 
2328 EVT_GRID_CMD_RANGE_SELECT =        wx.PyEventBinder( wxEVT_GRID_RANGE_SELECT,       1 )
 
2329 EVT_GRID_CMD_CELL_CHANGE =         wx.PyEventBinder( wxEVT_GRID_CELL_CHANGE,        1 )
 
2330 EVT_GRID_CMD_SELECT_CELL =         wx.PyEventBinder( wxEVT_GRID_SELECT_CELL,        1 )
 
2331 EVT_GRID_CMD_EDITOR_SHOWN =        wx.PyEventBinder( wxEVT_GRID_EDITOR_SHOWN,       1 )
 
2332 EVT_GRID_CMD_EDITOR_HIDDEN =       wx.PyEventBinder( wxEVT_GRID_EDITOR_HIDDEN,      1 )
 
2333 EVT_GRID_CMD_EDITOR_CREATED =      wx.PyEventBinder( wxEVT_GRID_EDITOR_CREATED,     1 )
 
2334 EVT_GRID_CMD_CELL_BEGIN_DRAG =     wx.PyEventBinder( wxEVT_GRID_CELL_BEGIN_DRAG,    1 )
 
2338 //---------------------------------------------------------------------------
 
2343 //---------------------------------------------------------------------------
 
2344 //---------------------------------------------------------------------------