X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/0dcf9a749fdfa0666518747d287f61d78eb59abe..0190c47234148dbbb778fb3150d7a375389dbb8b:/wxPython/src/gtk/grid_wrap.cpp diff --git a/wxPython/src/gtk/grid_wrap.cpp b/wxPython/src/gtk/grid_wrap.cpp index abeadb6256..c4132d7433 100644 --- a/wxPython/src/gtk/grid_wrap.cpp +++ b/wxPython/src/gtk/grid_wrap.cpp @@ -336,7 +336,8 @@ PyObject* wxPyMake_##TYPE(TYPE* source, bool setThisOwn) { \ wxPyOORClientData* data = (wxPyOORClientData*)source->GetClientObject(); \ if (data) { \ target = data->m_obj; \ - Py_INCREF(target); \ + if (target) \ + Py_INCREF(target); \ } \ /* Otherwise make a new wrapper for it the old fashioned way and \ give it the OOR treatment */ \ @@ -781,8 +782,21 @@ SWIG_FromCharPtr(const char* cptr) } } + +#define wxGRID_DEFAULT_NUMBER_ROWS WXGRID_DEFAULT_NUMBER_ROWS +#define wxGRID_DEFAULT_NUMBER_COLS WXGRID_DEFAULT_NUMBER_COLS +#define wxGRID_DEFAULT_ROW_HEIGHT WXGRID_DEFAULT_ROW_HEIGHT +#define wxGRID_DEFAULT_COL_WIDTH WXGRID_DEFAULT_COL_WIDTH +#define wxGRID_DEFAULT_COL_LABEL_HEIGHT WXGRID_DEFAULT_COL_LABEL_HEIGHT +#define wxGRID_DEFAULT_ROW_LABEL_WIDTH WXGRID_DEFAULT_ROW_LABEL_WIDTH +#define wxGRID_LABEL_EDGE_ZONE WXGRID_LABEL_EDGE_ZONE +#define wxGRID_MIN_ROW_HEIGHT WXGRID_MIN_ROW_HEIGHT +#define wxGRID_MIN_COL_WIDTH WXGRID_MIN_COL_WIDTH +#define wxGRID_DEFAULT_SCROLLBAR_WIDTH WXGRID_DEFAULT_SCROLLBAR_WIDTH + void wxGridCellRenderer__setOORInfo(wxGridCellRenderer *self,PyObject *_self){ - self->SetClientObject(new wxPyOORClientData(_self)); + if (!self->GetClientObject()) + self->SetClientObject(new wxPyOORClientData(_self)); } #include @@ -969,7 +983,8 @@ IMP_PYCALLBACK__STRING( wxPyGridCellRenderer, wxGridCellRenderer, SetParameters) void wxGridCellEditor__setOORInfo(wxGridCellEditor *self,PyObject *_self){ - self->SetClientObject(new wxPyOORClientData(_self)); + if (!self->GetClientObject()) + self->SetClientObject(new wxPyOORClientData(_self)); } class wxPyGridCellEditor : public wxGridCellEditor @@ -1097,7 +1112,8 @@ IMP_PYCALLBACK_STRING__constpure(wxPyGridCellEditor, wxGridCellEditor, GetValue) void wxGridCellAttr__setOORInfo(wxGridCellAttr *self,PyObject *_self){ - self->SetClientObject(new wxPyOORClientData(_self)); + if (!self->GetClientObject()) + self->SetClientObject(new wxPyOORClientData(_self)); } static PyObject* t_output_helper(PyObject* target, PyObject* o) { @@ -1127,7 +1143,8 @@ static PyObject* t_output_helper(PyObject* target, PyObject* o) { } void wxGridCellAttrProvider__setOORInfo(wxGridCellAttrProvider *self,PyObject *_self){ - self->SetClientObject(new wxPyOORClientData(_self)); + if (!self->GetClientObject()) + self->SetClientObject(new wxPyOORClientData(_self)); } SWIGSTATICINLINE(unsigned long) @@ -1172,7 +1189,8 @@ public: }; void wxGridTableBase__setOORInfo(wxGridTableBase *self,PyObject *_self){ - self->SetClientObject(new wxPyOORClientData(_self)); + if (!self->GetClientObject()) + self->SetClientObject(new wxPyOORClientData(_self)); } SWIGSTATICINLINE(int) @@ -8108,9 +8126,7 @@ static PyObject *_wrap_new_Grid(PyObject *self, PyObject *args, PyObject *kwargs wxPyEndAllowThreads(__tstate); if (PyErr_Occurred()) SWIG_fail; } - { - resultobj = wxPyMake_wxObject(result, 1); - } + resultobj = SWIG_NewPointerObj((void*)(result), SWIGTYPE_p_wxGrid, 1); { if (temp6) delete arg6; @@ -8141,9 +8157,7 @@ static PyObject *_wrap_new_PreGrid(PyObject *self, PyObject *args, PyObject *kwa wxPyEndAllowThreads(__tstate); if (PyErr_Occurred()) SWIG_fail; } - { - resultobj = wxPyMake_wxObject(result, 1); - } + resultobj = SWIG_NewPointerObj((void*)(result), SWIGTYPE_p_wxGrid, 1); return resultobj; fail: return NULL; @@ -11237,6 +11251,90 @@ static PyObject *_wrap_Grid_CanDragGridSize(PyObject *self, PyObject *args, PyOb } +static PyObject *_wrap_Grid_EnableDragCell(PyObject *self, PyObject *args, PyObject *kwargs) { + PyObject *resultobj; + wxGrid *arg1 = (wxGrid *) 0 ; + bool arg2 = (bool) True ; + PyObject * obj0 = 0 ; + PyObject * obj1 = 0 ; + char *kwnames[] = { + (char *) "self",(char *) "enable", NULL + }; + + if(!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"O|O:Grid_EnableDragCell",kwnames,&obj0,&obj1)) goto fail; + if ((SWIG_ConvertPtr(obj0,(void **)(&arg1),SWIGTYPE_p_wxGrid, + SWIG_POINTER_EXCEPTION | 0)) == -1) SWIG_fail; + if (obj1) { + arg2 = (bool) SWIG_AsBool(obj1); + if (PyErr_Occurred()) SWIG_fail; + } + { + PyThreadState* __tstate = wxPyBeginAllowThreads(); + (arg1)->EnableDragCell(arg2); + + wxPyEndAllowThreads(__tstate); + if (PyErr_Occurred()) SWIG_fail; + } + Py_INCREF(Py_None); resultobj = Py_None; + return resultobj; + fail: + return NULL; +} + + +static PyObject *_wrap_Grid_DisableDragCell(PyObject *self, PyObject *args, PyObject *kwargs) { + PyObject *resultobj; + wxGrid *arg1 = (wxGrid *) 0 ; + PyObject * obj0 = 0 ; + char *kwnames[] = { + (char *) "self", NULL + }; + + if(!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"O:Grid_DisableDragCell",kwnames,&obj0)) goto fail; + if ((SWIG_ConvertPtr(obj0,(void **)(&arg1),SWIGTYPE_p_wxGrid, + SWIG_POINTER_EXCEPTION | 0)) == -1) SWIG_fail; + { + PyThreadState* __tstate = wxPyBeginAllowThreads(); + (arg1)->DisableDragCell(); + + wxPyEndAllowThreads(__tstate); + if (PyErr_Occurred()) SWIG_fail; + } + Py_INCREF(Py_None); resultobj = Py_None; + return resultobj; + fail: + return NULL; +} + + +static PyObject *_wrap_Grid_CanDragCell(PyObject *self, PyObject *args, PyObject *kwargs) { + PyObject *resultobj; + wxGrid *arg1 = (wxGrid *) 0 ; + bool result; + PyObject * obj0 = 0 ; + char *kwnames[] = { + (char *) "self", NULL + }; + + if(!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"O:Grid_CanDragCell",kwnames,&obj0)) goto fail; + if ((SWIG_ConvertPtr(obj0,(void **)(&arg1),SWIGTYPE_p_wxGrid, + SWIG_POINTER_EXCEPTION | 0)) == -1) SWIG_fail; + { + PyThreadState* __tstate = wxPyBeginAllowThreads(); + result = (bool)(arg1)->CanDragCell(); + + wxPyEndAllowThreads(__tstate); + if (PyErr_Occurred()) SWIG_fail; + } + { + resultobj = result ? Py_True : Py_False; Py_INCREF(resultobj); + } + return resultobj; + fail: + return NULL; +} + + static PyObject *_wrap_Grid_SetAttr(PyObject *self, PyObject *args, PyObject *kwargs) { PyObject *resultobj; wxGrid *arg1 = (wxGrid *) 0 ; @@ -11340,6 +11438,42 @@ static PyObject *_wrap_Grid_SetColAttr(PyObject *self, PyObject *args, PyObject } +static PyObject *_wrap_Grid_GetOrCreateCellAttr(PyObject *self, PyObject *args, PyObject *kwargs) { + PyObject *resultobj; + wxGrid *arg1 = (wxGrid *) 0 ; + int arg2 ; + int arg3 ; + wxGridCellAttr *result; + PyObject * obj0 = 0 ; + PyObject * obj1 = 0 ; + PyObject * obj2 = 0 ; + char *kwnames[] = { + (char *) "self",(char *) "row",(char *) "col", NULL + }; + + if(!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OOO:Grid_GetOrCreateCellAttr",kwnames,&obj0,&obj1,&obj2)) goto fail; + if ((SWIG_ConvertPtr(obj0,(void **)(&arg1),SWIGTYPE_p_wxGrid, + SWIG_POINTER_EXCEPTION | 0)) == -1) SWIG_fail; + arg2 = (int) SWIG_AsInt(obj1); + if (PyErr_Occurred()) SWIG_fail; + arg3 = (int) SWIG_AsInt(obj2); + if (PyErr_Occurred()) SWIG_fail; + { + PyThreadState* __tstate = wxPyBeginAllowThreads(); + result = (wxGridCellAttr *)((wxGrid const *)arg1)->GetOrCreateCellAttr(arg2,arg3); + + wxPyEndAllowThreads(__tstate); + if (PyErr_Occurred()) SWIG_fail; + } + { + resultobj = wxPyMake_wxGridCellAttr(result, 0); + } + return resultobj; + fail: + return NULL; +} + + static PyObject *_wrap_Grid_SetColFormatBool(PyObject *self, PyObject *args, PyObject *kwargs) { PyObject *resultobj; wxGrid *arg1 = (wxGrid *) 0 ; @@ -15939,9 +16073,13 @@ static PyMethodDef SwigMethods[] = { { (char *)"Grid_EnableDragGridSize", (PyCFunction) _wrap_Grid_EnableDragGridSize, METH_VARARGS | METH_KEYWORDS }, { (char *)"Grid_DisableDragGridSize", (PyCFunction) _wrap_Grid_DisableDragGridSize, METH_VARARGS | METH_KEYWORDS }, { (char *)"Grid_CanDragGridSize", (PyCFunction) _wrap_Grid_CanDragGridSize, METH_VARARGS | METH_KEYWORDS }, + { (char *)"Grid_EnableDragCell", (PyCFunction) _wrap_Grid_EnableDragCell, METH_VARARGS | METH_KEYWORDS }, + { (char *)"Grid_DisableDragCell", (PyCFunction) _wrap_Grid_DisableDragCell, METH_VARARGS | METH_KEYWORDS }, + { (char *)"Grid_CanDragCell", (PyCFunction) _wrap_Grid_CanDragCell, METH_VARARGS | METH_KEYWORDS }, { (char *)"Grid_SetAttr", (PyCFunction) _wrap_Grid_SetAttr, METH_VARARGS | METH_KEYWORDS }, { (char *)"Grid_SetRowAttr", (PyCFunction) _wrap_Grid_SetRowAttr, METH_VARARGS | METH_KEYWORDS }, { (char *)"Grid_SetColAttr", (PyCFunction) _wrap_Grid_SetColAttr, METH_VARARGS | METH_KEYWORDS }, + { (char *)"Grid_GetOrCreateCellAttr", (PyCFunction) _wrap_Grid_GetOrCreateCellAttr, METH_VARARGS | METH_KEYWORDS }, { (char *)"Grid_SetColFormatBool", (PyCFunction) _wrap_Grid_SetColFormatBool, METH_VARARGS | METH_KEYWORDS }, { (char *)"Grid_SetColFormatNumber", (PyCFunction) _wrap_Grid_SetColFormatNumber, METH_VARARGS | METH_KEYWORDS }, { (char *)"Grid_SetColFormatFloat", (PyCFunction) _wrap_Grid_SetColFormatFloat, METH_VARARGS | METH_KEYWORDS }, @@ -17269,16 +17407,16 @@ SWIGEXPORT(void) SWIG_init(void) { PyDict_SetItemString(d,"GRID_VALUE_DATETIME", SWIG_FromCharPtr("datetime")); SWIG_addvarlink(SWIG_globals,(char*)"GridNoCellCoords",_wrap_GridNoCellCoords_get, _wrap_GridNoCellCoords_set); SWIG_addvarlink(SWIG_globals,(char*)"GridNoCellRect",_wrap_GridNoCellRect_get, _wrap_GridNoCellRect_set); - PyDict_SetItemString(d,"GRID_DEFAULT_NUMBER_ROWS", SWIG_FromInt((int)WXGRID_DEFAULT_NUMBER_ROWS)); - PyDict_SetItemString(d,"GRID_DEFAULT_NUMBER_COLS", SWIG_FromInt((int)WXGRID_DEFAULT_NUMBER_COLS)); - PyDict_SetItemString(d,"GRID_DEFAULT_ROW_HEIGHT", SWIG_FromInt((int)WXGRID_DEFAULT_ROW_HEIGHT)); - PyDict_SetItemString(d,"GRID_DEFAULT_COL_WIDTH", SWIG_FromInt((int)WXGRID_DEFAULT_COL_WIDTH)); - PyDict_SetItemString(d,"GRID_DEFAULT_COL_LABEL_HEIGHT", SWIG_FromInt((int)WXGRID_DEFAULT_COL_LABEL_HEIGHT)); - PyDict_SetItemString(d,"GRID_DEFAULT_ROW_LABEL_WIDTH", SWIG_FromInt((int)WXGRID_DEFAULT_ROW_LABEL_WIDTH)); - PyDict_SetItemString(d,"GRID_LABEL_EDGE_ZONE", SWIG_FromInt((int)WXGRID_LABEL_EDGE_ZONE)); - PyDict_SetItemString(d,"GRID_MIN_ROW_HEIGHT", SWIG_FromInt((int)WXGRID_MIN_ROW_HEIGHT)); - PyDict_SetItemString(d,"GRID_MIN_COL_WIDTH", SWIG_FromInt((int)WXGRID_MIN_COL_WIDTH)); - PyDict_SetItemString(d,"GRID_DEFAULT_SCROLLBAR_WIDTH", SWIG_FromInt((int)WXGRID_DEFAULT_SCROLLBAR_WIDTH)); + PyDict_SetItemString(d,"GRID_DEFAULT_NUMBER_ROWS", SWIG_FromInt((int)wxGRID_DEFAULT_NUMBER_ROWS)); + PyDict_SetItemString(d,"GRID_DEFAULT_NUMBER_COLS", SWIG_FromInt((int)wxGRID_DEFAULT_NUMBER_COLS)); + PyDict_SetItemString(d,"GRID_DEFAULT_ROW_HEIGHT", SWIG_FromInt((int)wxGRID_DEFAULT_ROW_HEIGHT)); + PyDict_SetItemString(d,"GRID_DEFAULT_COL_WIDTH", SWIG_FromInt((int)wxGRID_DEFAULT_COL_WIDTH)); + PyDict_SetItemString(d,"GRID_DEFAULT_COL_LABEL_HEIGHT", SWIG_FromInt((int)wxGRID_DEFAULT_COL_LABEL_HEIGHT)); + PyDict_SetItemString(d,"GRID_DEFAULT_ROW_LABEL_WIDTH", SWIG_FromInt((int)wxGRID_DEFAULT_ROW_LABEL_WIDTH)); + PyDict_SetItemString(d,"GRID_LABEL_EDGE_ZONE", SWIG_FromInt((int)wxGRID_LABEL_EDGE_ZONE)); + PyDict_SetItemString(d,"GRID_MIN_ROW_HEIGHT", SWIG_FromInt((int)wxGRID_MIN_ROW_HEIGHT)); + PyDict_SetItemString(d,"GRID_MIN_COL_WIDTH", SWIG_FromInt((int)wxGRID_MIN_COL_WIDTH)); + PyDict_SetItemString(d,"GRID_DEFAULT_SCROLLBAR_WIDTH", SWIG_FromInt((int)wxGRID_DEFAULT_SCROLLBAR_WIDTH)); PyDict_SetItemString(d,"GridCellAttr_Any", SWIG_FromInt((int)wxGridCellAttr::Any)); PyDict_SetItemString(d,"GridCellAttr_Default", SWIG_FromInt((int)wxGridCellAttr::Default)); PyDict_SetItemString(d,"GridCellAttr_Cell", SWIG_FromInt((int)wxGridCellAttr::Cell)); @@ -17312,6 +17450,7 @@ SWIGEXPORT(void) SWIG_init(void) { PyDict_SetItemString(d, "wxEVT_GRID_EDITOR_SHOWN", PyInt_FromLong(wxEVT_GRID_EDITOR_SHOWN)); PyDict_SetItemString(d, "wxEVT_GRID_EDITOR_HIDDEN", PyInt_FromLong(wxEVT_GRID_EDITOR_HIDDEN)); PyDict_SetItemString(d, "wxEVT_GRID_EDITOR_CREATED", PyInt_FromLong(wxEVT_GRID_EDITOR_CREATED)); + PyDict_SetItemString(d, "wxEVT_GRID_CELL_BEGIN_DRAG", PyInt_FromLong(wxEVT_GRID_CELL_BEGIN_DRAG)); }