+ %addmethods {
+ PyObject* GetCells() {
+ int row, col;
+ PyObject* rows = PyList_New(0);
+ for (row=0; row < self->GetRows(); row++) {
+ PyObject* rowList = PyList_New(0);
+ for (col=0; col < self->GetCols(); col++) {
+ wxGridCell* cell = self->GetCell(row, col);
+
+ bool doSave = wxPyRestoreThread();
+ PyObject* pyCell = wxPyConstructObject(cell, "wxGridCell");
+ wxPySaveThread(doSave);
+
+ if (PyList_Append(rowList, pyCell) == -1)
+ return NULL;
+ }
+ if (PyList_Append(rows, rowList) == -1)
+ return NULL;
+ }
+ return rows;
+ }
+ }