From bf7945cef10c0844a32e95695c544d829da9293a Mon Sep 17 00:00:00 2001 From: Robin Dunn Date: Thu, 31 May 2001 06:23:06 +0000 Subject: [PATCH] Added EVT_GRID_EDITOR_CREATED and wxGridEditorCreatedEvent so the user code can get access to the edit control when it is created, (to push on a custom event handler for example.) git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@10390 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- include/wx/generic/grid.h | 33 +++++ src/generic/grid.cpp | 43 ++++-- wxPython/CHANGES.txt | 16 ++- wxPython/demo/GridSimple.py | 6 + wxPython/src/_gridextras.py | 1 + wxPython/src/grid.i | 20 +++ wxPython/src/msw/grid.cpp | 262 ++++++++++++++++++++++++++++++++++++ wxPython/src/msw/grid.py | 37 +++++ 8 files changed, 404 insertions(+), 14 deletions(-) diff --git a/include/wx/generic/grid.h b/include/wx/generic/grid.h index ae7294f833..f599587f6c 100644 --- a/include/wx/generic/grid.h +++ b/include/wx/generic/grid.h @@ -1920,6 +1920,36 @@ protected: DECLARE_DYNAMIC_CLASS(wxGridRangeSelectEvent) }; + +class WXDLLEXPORT wxGridEditorCreatedEvent : public wxCommandEvent { +public: + wxGridEditorCreatedEvent() + : wxCommandEvent() + { + m_row = 0; + m_col = 0; + m_ctrl = NULL; + } + + wxGridEditorCreatedEvent(int id, wxEventType type, wxObject* obj, + int row, int col, wxControl* ctrl); + + int GetRow() { return m_row; } + int GetCol() { return m_col; } + wxControl* GetControl() { return m_ctrl; } + void SetRow(int row) { m_row = row; } + void SetCol(int col) { m_col = col; } + void SetControl(wxControl* ctrl) { m_ctrl = ctrl; } + +private: + int m_row; + int m_col; + wxControl* m_ctrl; + + DECLARE_DYNAMIC_CLASS(wxGridEditorCreatedEvent) +}; + + BEGIN_DECLARE_EVENT_TYPES() DECLARE_EVENT_TYPE(wxEVT_GRID_CELL_LEFT_CLICK, 1580) DECLARE_EVENT_TYPE(wxEVT_GRID_CELL_RIGHT_CLICK, 1581) @@ -1936,12 +1966,14 @@ BEGIN_DECLARE_EVENT_TYPES() DECLARE_EVENT_TYPE(wxEVT_GRID_SELECT_CELL, 1592) DECLARE_EVENT_TYPE(wxEVT_GRID_EDITOR_SHOWN, 1593) DECLARE_EVENT_TYPE(wxEVT_GRID_EDITOR_HIDDEN, 1594) + DECLARE_EVENT_TYPE(wxEVT_GRID_EDITOR_CREATED, 1595) END_DECLARE_EVENT_TYPES() typedef void (wxEvtHandler::*wxGridEventFunction)(wxGridEvent&); typedef void (wxEvtHandler::*wxGridSizeEventFunction)(wxGridSizeEvent&); typedef void (wxEvtHandler::*wxGridRangeSelectEventFunction)(wxGridRangeSelectEvent&); +typedef void (wxEvtHandler::*wxGridEditorCreatedEventFunction)(wxGridEditorCreatedEvent&); #define EVT_GRID_CELL_LEFT_CLICK(fn) DECLARE_EVENT_TABLE_ENTRY( wxEVT_GRID_CELL_LEFT_CLICK, -1, -1, (wxObjectEventFunction) (wxEventFunction) (wxGridEventFunction) &fn, NULL ), #define EVT_GRID_CELL_RIGHT_CLICK(fn) DECLARE_EVENT_TABLE_ENTRY( wxEVT_GRID_CELL_RIGHT_CLICK, -1, -1, (wxObjectEventFunction) (wxEventFunction) (wxGridEventFunction) &fn, NULL ), @@ -1958,6 +1990,7 @@ typedef void (wxEvtHandler::*wxGridRangeSelectEventFunction)(wxGridRangeSelectEv #define EVT_GRID_SELECT_CELL(fn) DECLARE_EVENT_TABLE_ENTRY( wxEVT_GRID_SELECT_CELL, -1, -1, (wxObjectEventFunction) (wxEventFunction) (wxGridEventFunction) &fn, NULL ), #define EVT_GRID_EDITOR_SHOWN(fn) DECLARE_EVENT_TABLE_ENTRY( wxEVT_GRID_EDITOR_SHOWN, -1, -1, (wxObjectEventFunction) (wxEventFunction) (wxGridEventFunction) &fn, NULL ), #define EVT_GRID_EDITOR_HIDDEN(fn) DECLARE_EVENT_TABLE_ENTRY( wxEVT_GRID_EDITOR_HIDDEN, -1, -1, (wxObjectEventFunction) (wxEventFunction) (wxGridEventFunction) &fn, NULL ), +#define EVT_GRID_EDITOR_CREATED(fn) DECLARE_EVENT_TABLE_ENTRY( wxEVT_GRID_EDITOR_CREATED, -1, -1, (wxObjectEventFunction) (wxEventFunction) (wxGridEditorCreatedEventFunction) &fn, NULL ), #if 0 // TODO: implement these ? others ? diff --git a/src/generic/grid.cpp b/src/generic/grid.cpp index 83b2116205..6a9750f96f 100644 --- a/src/generic/grid.cpp +++ b/src/generic/grid.cpp @@ -115,6 +115,7 @@ DEFINE_EVENT_TYPE(wxEVT_GRID_CELL_CHANGE) DEFINE_EVENT_TYPE(wxEVT_GRID_SELECT_CELL) DEFINE_EVENT_TYPE(wxEVT_GRID_EDITOR_SHOWN) DEFINE_EVENT_TYPE(wxEVT_GRID_EDITOR_HIDDEN) +DEFINE_EVENT_TYPE(wxEVT_GRID_EDITOR_CREATED) // ---------------------------------------------------------------------------- // private classes @@ -1917,7 +1918,7 @@ void wxGridCellAttr::MergeWith(wxGridCellAttr *mergefrom) // // Maybe add support for merge of Render and Editor? if (!HasRenderer() && mergefrom->HasRenderer() ) - { + { m_renderer = mergefrom->m_renderer; m_renderer->IncRef(); } @@ -2302,18 +2303,18 @@ wxGridCellAttr *wxGridCellAttrProvider::GetAttr(int row, int col, //Also check merge cache, so we don't have to re-merge every time.. wxGridCellAttr *attrcell = (wxGridCellAttr *)NULL, *attrrow = (wxGridCellAttr *)NULL, - *attrcol = (wxGridCellAttr *)NULL; - + *attrcol = (wxGridCellAttr *)NULL; + attrcell = m_data->m_cellAttrs.GetAttr(row, col); attrcol = m_data->m_colAttrs.GetAttr(col); attrrow = m_data->m_rowAttrs.GetAttr(row); - if((attrcell != attrrow) && (attrrow !=attrcol) && (attrcell != attrcol)){ + if((attrcell != attrrow) && (attrrow !=attrcol) && (attrcell != attrcol)){ // Two or move are non NULL attr = new wxGridCellAttr; attr->SetKind(wxGridCellAttr::Merged); - //Order important.. + //Order important.. if(attrcell){ attr->MergeWith(attrcell); attrcell->DecRef(); @@ -2335,7 +2336,7 @@ wxGridCellAttr *wxGridCellAttrProvider::GetAttr(int row, int col, // one or none is non null return it or null. if(attrrow) attr = attrrow; if(attrcol) attr = attrcol; - if(attrcell) attr = attrcell; + if(attrcell) attr = attrcell; } } break; @@ -3690,7 +3691,7 @@ void wxGrid::Init() m_gridLineColour = wxColour( 128, 128, 255 ); m_gridLinesEnabled = TRUE; m_cellHighlightColour = m_gridLineColour; - m_cellHighlightPenWidth = 3; + m_cellHighlightPenWidth = 2; m_cellHighlightROPenWidth = 1; m_cursorMode = WXGRID_CURSOR_SELECT_CELL; @@ -6667,6 +6668,14 @@ void wxGrid::ShowCellEditControl() { editor->Create(m_gridWin, -1, new wxGridCellEditorEvtHandler(this, editor)); + + wxGridEditorCreatedEvent evt(GetId(), + wxEVT_GRID_EDITOR_CREATED, + this, + row, + col, + editor->GetControl()); + GetEventHandler()->ProcessEvent(evt); } editor->Show( TRUE, attr ); @@ -8669,7 +8678,7 @@ wxRect wxGrid::BlockToDeviceRect( const wxGridCellCoords &topLeft, // ------ Grid event classes // -IMPLEMENT_DYNAMIC_CLASS( wxGridEvent, wxEvent ) +IMPLEMENT_DYNAMIC_CLASS( wxGridEvent, wxNotifyEvent ) wxGridEvent::wxGridEvent( int id, wxEventType type, wxObject* obj, int row, int col, int x, int y, bool sel, @@ -8690,7 +8699,7 @@ wxGridEvent::wxGridEvent( int id, wxEventType type, wxObject* obj, } -IMPLEMENT_DYNAMIC_CLASS( wxGridSizeEvent, wxEvent ) +IMPLEMENT_DYNAMIC_CLASS( wxGridSizeEvent, wxNotifyEvent ) wxGridSizeEvent::wxGridSizeEvent( int id, wxEventType type, wxObject* obj, int rowOrCol, int x, int y, @@ -8709,7 +8718,7 @@ wxGridSizeEvent::wxGridSizeEvent( int id, wxEventType type, wxObject* obj, } -IMPLEMENT_DYNAMIC_CLASS( wxGridRangeSelectEvent, wxEvent ) +IMPLEMENT_DYNAMIC_CLASS( wxGridRangeSelectEvent, wxNotifyEvent ) wxGridRangeSelectEvent::wxGridRangeSelectEvent(int id, wxEventType type, wxObject* obj, const wxGridCellCoords& topLeft, @@ -8730,4 +8739,18 @@ wxGridRangeSelectEvent::wxGridRangeSelectEvent(int id, wxEventType type, wxObjec } +IMPLEMENT_DYNAMIC_CLASS(wxGridEditorCreatedEvent, wxCommandEvent) + +wxGridEditorCreatedEvent::wxGridEditorCreatedEvent(int id, wxEventType type, + wxObject* obj, int row, + int col, wxControl* ctrl) + : wxCommandEvent(type, id) +{ + SetEventObject(obj); + m_row = row; + m_col = col; + m_ctrl = ctrl; +} + + #endif // ifndef wxUSE_NEW_GRID diff --git a/wxPython/CHANGES.txt b/wxPython/CHANGES.txt index 6adf955ac6..ae25b80124 100644 --- a/wxPython/CHANGES.txt +++ b/wxPython/CHANGES.txt @@ -2,6 +2,13 @@ CHANGES.txt for wxPython ---------------------------------------------------------------------- +????? +----- +Added EVT_GRID_EDITOR_CREATED and wxGridEditorCreatedEvent so the user +code can get access to the edit control when it is created, (to push +on a custom event handler for example.) + + 2.3.0 ----- @@ -102,7 +109,8 @@ On other platforms it is equivallent to wxGetDisplaySize. There is now a wxObject class that most other classes derive from like in C++, but the methods provided don't really match but are wxPython -specific. It could have been added long ago but OOR required it. +specific. It could have been added long ago but OOR required it so it +finally got done. Finally added wxPyLineShape.GetLineControlPoints, which has been on my list for a while. The above OOR modification made this easier. @@ -113,9 +121,9 @@ Added wxWave. Added the wxPython.lib.mixins package to the library, it is where useful mix-in classes can be placed. Currently there is one to help -makeing the columns in a wxListCtrl sortable, and the MagicIMageList -from Mike Fletcher. If you have any custom code that can be factored -out of existing classes into a mix-in that would be useful to others +make the columns in a wxListCtrl sortable, and the MagicIMageList from +Mike Fletcher. If you have any custom code that can be factored out +of existing classes into a mix-in that would be useful to others please send it to me for inclusion in this package. Added a few little sample applications to help newbies to get started diff --git a/wxPython/demo/GridSimple.py b/wxPython/demo/GridSimple.py index 215eb58490..630a4fd43c 100644 --- a/wxPython/demo/GridSimple.py +++ b/wxPython/demo/GridSimple.py @@ -62,6 +62,7 @@ class SimpleGrid(wxGrid): EVT_GRID_EDITOR_SHOWN(self, self.OnEditorShown) EVT_GRID_EDITOR_HIDDEN(self, self.OnEditorHidden) + EVT_GRID_EDITOR_CREATED(self, self.OnEditorCreated) def OnCellLeftClick(self, evt): @@ -169,6 +170,11 @@ class SimpleGrid(wxGrid): (evt.GetRow(), evt.GetCol(), evt.GetPosition())) evt.Skip() + def OnEditorCreated(self, evt): + self.log.write("OnEditorCreated: (%d, %d) %s\n" % + (evt.GetRow(), evt.GetCol(), evt.GetControl())) + + #--------------------------------------------------------------------------- diff --git a/wxPython/src/_gridextras.py b/wxPython/src/_gridextras.py index 198ed644ff..5bd9c3fe67 100644 --- a/wxPython/src/_gridextras.py +++ b/wxPython/src/_gridextras.py @@ -5,6 +5,7 @@ wx.wxGridEventPtr = wxGridEventPtr wx.wxGridSizeEventPtr = wxGridSizeEventPtr wx.wxGridRangeSelectEventPtr = wxGridRangeSelectEventPtr +wx.wxGridEditorCreatedEventPtr = wxGridEditorCreatedEventPtr wx.wxGridCellRendererPtr = wxGridCellRendererPtr wx.wxPyGridCellRendererPtr = wxPyGridCellRendererPtr wx.wxGridCellEditorPtr = wxGridCellEditorPtr diff --git a/wxPython/src/grid.i b/wxPython/src/grid.i index 649ccf7534..0859bf204a 100644 --- a/wxPython/src/grid.i +++ b/wxPython/src/grid.i @@ -1693,6 +1693,22 @@ public: bool AltDown(); }; + +class wxGridEditorCreatedEvent : public wxCommandEvent { +public: + wxGridEditorCreatedEvent(int id, wxEventType type, wxObject* obj, + int row, int col, wxControl* ctrl); + + int GetRow(); + int GetCol(); + wxControl* GetControl(); + void SetRow(int row); + void SetCol(int col); + void SetControl(wxControl* ctrl); +}; + + + enum { wxEVT_GRID_CELL_LEFT_CLICK, wxEVT_GRID_CELL_RIGHT_CLICK, @@ -1709,6 +1725,7 @@ enum { wxEVT_GRID_SELECT_CELL, wxEVT_GRID_EDITOR_SHOWN, wxEVT_GRID_EDITOR_HIDDEN, + wxEVT_GRID_EDITOR_CREATED, }; @@ -1759,6 +1776,9 @@ def EVT_GRID_EDITOR_SHOWN(win, fn): def EVT_GRID_EDITOR_HIDDEN(win, fn): win.Connect(-1, -1, wxEVT_GRID_EDITOR_HIDDEN, fn) +def EVT_GRID_EDITOR_CREATED(win, fn): + win.Connect(-1, -1, wxEVT_GRID_EDITOR_CREATED, fn) + " //--------------------------------------------------------------------------- diff --git a/wxPython/src/msw/grid.cpp b/wxPython/src/msw/grid.cpp index 72d648fc42..5b4fcc65a6 100644 --- a/wxPython/src/msw/grid.cpp +++ b/wxPython/src/msw/grid.cpp @@ -13405,7 +13405,265 @@ static PyObject *_wrap_wxGridRangeSelectEvent_AltDown(PyObject *self, PyObject * return _resultobj; } +static void *SwigwxGridEditorCreatedEventTowxCommandEvent(void *ptr) { + wxGridEditorCreatedEvent *src; + wxCommandEvent *dest; + src = (wxGridEditorCreatedEvent *) ptr; + dest = (wxCommandEvent *) src; + return (void *) dest; +} + +static void *SwigwxGridEditorCreatedEventTowxEvent(void *ptr) { + wxGridEditorCreatedEvent *src; + wxEvent *dest; + src = (wxGridEditorCreatedEvent *) ptr; + dest = (wxEvent *) src; + return (void *) dest; +} + +static void *SwigwxGridEditorCreatedEventTowxObject(void *ptr) { + wxGridEditorCreatedEvent *src; + wxObject *dest; + src = (wxGridEditorCreatedEvent *) ptr; + dest = (wxObject *) src; + return (void *) dest; +} + +#define new_wxGridEditorCreatedEvent(_swigarg0,_swigarg1,_swigarg2,_swigarg3,_swigarg4,_swigarg5) (new wxGridEditorCreatedEvent(_swigarg0,_swigarg1,_swigarg2,_swigarg3,_swigarg4,_swigarg5)) +static PyObject *_wrap_new_wxGridEditorCreatedEvent(PyObject *self, PyObject *args, PyObject *kwargs) { + PyObject * _resultobj; + wxGridEditorCreatedEvent * _result; + int _arg0; + wxEventType _arg1; + wxObject * _arg2; + int _arg3; + int _arg4; + wxControl * _arg5; + PyObject * _argo2 = 0; + PyObject * _argo5 = 0; + char *_kwnames[] = { "id","type","obj","row","col","ctrl", NULL }; + char _ptemp[128]; + + self = self; + if(!PyArg_ParseTupleAndKeywords(args,kwargs,"iiOiiO:new_wxGridEditorCreatedEvent",_kwnames,&_arg0,&_arg1,&_argo2,&_arg3,&_arg4,&_argo5)) + return NULL; + if (_argo2) { + if (_argo2 == Py_None) { _arg2 = NULL; } + else if (SWIG_GetPtrObj(_argo2,(void **) &_arg2,"_wxObject_p")) { + PyErr_SetString(PyExc_TypeError,"Type error in argument 3 of new_wxGridEditorCreatedEvent. Expected _wxObject_p."); + return NULL; + } + } + if (_argo5) { + if (_argo5 == Py_None) { _arg5 = NULL; } + else if (SWIG_GetPtrObj(_argo5,(void **) &_arg5,"_wxControl_p")) { + PyErr_SetString(PyExc_TypeError,"Type error in argument 6 of new_wxGridEditorCreatedEvent. Expected _wxControl_p."); + return NULL; + } + } +{ + wxPy_BEGIN_ALLOW_THREADS; + _result = (wxGridEditorCreatedEvent *)new_wxGridEditorCreatedEvent(_arg0,_arg1,_arg2,_arg3,_arg4,_arg5); + + wxPy_END_ALLOW_THREADS; + if (PyErr_Occurred()) return NULL; +} if (_result) { + SWIG_MakePtr(_ptemp, (char *) _result,"_wxGridEditorCreatedEvent_p"); + _resultobj = Py_BuildValue("s",_ptemp); + } else { + Py_INCREF(Py_None); + _resultobj = Py_None; + } + return _resultobj; +} + +#define wxGridEditorCreatedEvent_GetRow(_swigobj) (_swigobj->GetRow()) +static PyObject *_wrap_wxGridEditorCreatedEvent_GetRow(PyObject *self, PyObject *args, PyObject *kwargs) { + PyObject * _resultobj; + int _result; + wxGridEditorCreatedEvent * _arg0; + PyObject * _argo0 = 0; + char *_kwnames[] = { "self", NULL }; + + self = self; + if(!PyArg_ParseTupleAndKeywords(args,kwargs,"O:wxGridEditorCreatedEvent_GetRow",_kwnames,&_argo0)) + return NULL; + if (_argo0) { + if (_argo0 == Py_None) { _arg0 = NULL; } + else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxGridEditorCreatedEvent_p")) { + PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxGridEditorCreatedEvent_GetRow. Expected _wxGridEditorCreatedEvent_p."); + return NULL; + } + } +{ + wxPy_BEGIN_ALLOW_THREADS; + _result = (int )wxGridEditorCreatedEvent_GetRow(_arg0); + + wxPy_END_ALLOW_THREADS; + if (PyErr_Occurred()) return NULL; +} _resultobj = Py_BuildValue("i",_result); + return _resultobj; +} + +#define wxGridEditorCreatedEvent_GetCol(_swigobj) (_swigobj->GetCol()) +static PyObject *_wrap_wxGridEditorCreatedEvent_GetCol(PyObject *self, PyObject *args, PyObject *kwargs) { + PyObject * _resultobj; + int _result; + wxGridEditorCreatedEvent * _arg0; + PyObject * _argo0 = 0; + char *_kwnames[] = { "self", NULL }; + + self = self; + if(!PyArg_ParseTupleAndKeywords(args,kwargs,"O:wxGridEditorCreatedEvent_GetCol",_kwnames,&_argo0)) + return NULL; + if (_argo0) { + if (_argo0 == Py_None) { _arg0 = NULL; } + else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxGridEditorCreatedEvent_p")) { + PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxGridEditorCreatedEvent_GetCol. Expected _wxGridEditorCreatedEvent_p."); + return NULL; + } + } +{ + wxPy_BEGIN_ALLOW_THREADS; + _result = (int )wxGridEditorCreatedEvent_GetCol(_arg0); + + wxPy_END_ALLOW_THREADS; + if (PyErr_Occurred()) return NULL; +} _resultobj = Py_BuildValue("i",_result); + return _resultobj; +} + +#define wxGridEditorCreatedEvent_GetControl(_swigobj) (_swigobj->GetControl()) +static PyObject *_wrap_wxGridEditorCreatedEvent_GetControl(PyObject *self, PyObject *args, PyObject *kwargs) { + PyObject * _resultobj; + wxControl * _result; + wxGridEditorCreatedEvent * _arg0; + PyObject * _argo0 = 0; + char *_kwnames[] = { "self", NULL }; + + self = self; + if(!PyArg_ParseTupleAndKeywords(args,kwargs,"O:wxGridEditorCreatedEvent_GetControl",_kwnames,&_argo0)) + return NULL; + if (_argo0) { + if (_argo0 == Py_None) { _arg0 = NULL; } + else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxGridEditorCreatedEvent_p")) { + PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxGridEditorCreatedEvent_GetControl. Expected _wxGridEditorCreatedEvent_p."); + return NULL; + } + } +{ + wxPy_BEGIN_ALLOW_THREADS; + _result = (wxControl *)wxGridEditorCreatedEvent_GetControl(_arg0); + + wxPy_END_ALLOW_THREADS; + if (PyErr_Occurred()) return NULL; +}{ _resultobj = wxPyMake_wxObject(_result); } + return _resultobj; +} + +#define wxGridEditorCreatedEvent_SetRow(_swigobj,_swigarg0) (_swigobj->SetRow(_swigarg0)) +static PyObject *_wrap_wxGridEditorCreatedEvent_SetRow(PyObject *self, PyObject *args, PyObject *kwargs) { + PyObject * _resultobj; + wxGridEditorCreatedEvent * _arg0; + int _arg1; + PyObject * _argo0 = 0; + char *_kwnames[] = { "self","row", NULL }; + + self = self; + if(!PyArg_ParseTupleAndKeywords(args,kwargs,"Oi:wxGridEditorCreatedEvent_SetRow",_kwnames,&_argo0,&_arg1)) + return NULL; + if (_argo0) { + if (_argo0 == Py_None) { _arg0 = NULL; } + else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxGridEditorCreatedEvent_p")) { + PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxGridEditorCreatedEvent_SetRow. Expected _wxGridEditorCreatedEvent_p."); + return NULL; + } + } +{ + wxPy_BEGIN_ALLOW_THREADS; + wxGridEditorCreatedEvent_SetRow(_arg0,_arg1); + + wxPy_END_ALLOW_THREADS; + if (PyErr_Occurred()) return NULL; +} Py_INCREF(Py_None); + _resultobj = Py_None; + return _resultobj; +} + +#define wxGridEditorCreatedEvent_SetCol(_swigobj,_swigarg0) (_swigobj->SetCol(_swigarg0)) +static PyObject *_wrap_wxGridEditorCreatedEvent_SetCol(PyObject *self, PyObject *args, PyObject *kwargs) { + PyObject * _resultobj; + wxGridEditorCreatedEvent * _arg0; + int _arg1; + PyObject * _argo0 = 0; + char *_kwnames[] = { "self","col", NULL }; + + self = self; + if(!PyArg_ParseTupleAndKeywords(args,kwargs,"Oi:wxGridEditorCreatedEvent_SetCol",_kwnames,&_argo0,&_arg1)) + return NULL; + if (_argo0) { + if (_argo0 == Py_None) { _arg0 = NULL; } + else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxGridEditorCreatedEvent_p")) { + PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxGridEditorCreatedEvent_SetCol. Expected _wxGridEditorCreatedEvent_p."); + return NULL; + } + } +{ + wxPy_BEGIN_ALLOW_THREADS; + wxGridEditorCreatedEvent_SetCol(_arg0,_arg1); + + wxPy_END_ALLOW_THREADS; + if (PyErr_Occurred()) return NULL; +} Py_INCREF(Py_None); + _resultobj = Py_None; + return _resultobj; +} + +#define wxGridEditorCreatedEvent_SetControl(_swigobj,_swigarg0) (_swigobj->SetControl(_swigarg0)) +static PyObject *_wrap_wxGridEditorCreatedEvent_SetControl(PyObject *self, PyObject *args, PyObject *kwargs) { + PyObject * _resultobj; + wxGridEditorCreatedEvent * _arg0; + wxControl * _arg1; + PyObject * _argo0 = 0; + PyObject * _argo1 = 0; + char *_kwnames[] = { "self","ctrl", NULL }; + + self = self; + if(!PyArg_ParseTupleAndKeywords(args,kwargs,"OO:wxGridEditorCreatedEvent_SetControl",_kwnames,&_argo0,&_argo1)) + return NULL; + if (_argo0) { + if (_argo0 == Py_None) { _arg0 = NULL; } + else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxGridEditorCreatedEvent_p")) { + PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxGridEditorCreatedEvent_SetControl. Expected _wxGridEditorCreatedEvent_p."); + return NULL; + } + } + if (_argo1) { + if (_argo1 == Py_None) { _arg1 = NULL; } + else if (SWIG_GetPtrObj(_argo1,(void **) &_arg1,"_wxControl_p")) { + PyErr_SetString(PyExc_TypeError,"Type error in argument 2 of wxGridEditorCreatedEvent_SetControl. Expected _wxControl_p."); + return NULL; + } + } +{ + wxPy_BEGIN_ALLOW_THREADS; + wxGridEditorCreatedEvent_SetControl(_arg0,_arg1); + + wxPy_END_ALLOW_THREADS; + if (PyErr_Occurred()) return NULL; +} Py_INCREF(Py_None); + _resultobj = Py_None; + return _resultobj; +} + static PyMethodDef gridcMethods[] = { + { "wxGridEditorCreatedEvent_SetControl", (PyCFunction) _wrap_wxGridEditorCreatedEvent_SetControl, METH_VARARGS | METH_KEYWORDS }, + { "wxGridEditorCreatedEvent_SetCol", (PyCFunction) _wrap_wxGridEditorCreatedEvent_SetCol, METH_VARARGS | METH_KEYWORDS }, + { "wxGridEditorCreatedEvent_SetRow", (PyCFunction) _wrap_wxGridEditorCreatedEvent_SetRow, METH_VARARGS | METH_KEYWORDS }, + { "wxGridEditorCreatedEvent_GetControl", (PyCFunction) _wrap_wxGridEditorCreatedEvent_GetControl, METH_VARARGS | METH_KEYWORDS }, + { "wxGridEditorCreatedEvent_GetCol", (PyCFunction) _wrap_wxGridEditorCreatedEvent_GetCol, METH_VARARGS | METH_KEYWORDS }, + { "wxGridEditorCreatedEvent_GetRow", (PyCFunction) _wrap_wxGridEditorCreatedEvent_GetRow, METH_VARARGS | METH_KEYWORDS }, + { "new_wxGridEditorCreatedEvent", (PyCFunction) _wrap_new_wxGridEditorCreatedEvent, METH_VARARGS | METH_KEYWORDS }, { "wxGridRangeSelectEvent_AltDown", (PyCFunction) _wrap_wxGridRangeSelectEvent_AltDown, METH_VARARGS | METH_KEYWORDS }, { "wxGridRangeSelectEvent_ShiftDown", (PyCFunction) _wrap_wxGridRangeSelectEvent_ShiftDown, METH_VARARGS | METH_KEYWORDS }, { "wxGridRangeSelectEvent_MetaDown", (PyCFunction) _wrap_wxGridRangeSelectEvent_MetaDown, METH_VARARGS | METH_KEYWORDS }, @@ -13776,6 +14034,7 @@ static PyMethodDef gridcMethods[] = { * This table is used by the pointer type-checker */ static struct { char *n1; char *n2; void *(*pcnv)(void *); } _swig_mapping[] = { + { "_wxEvent","_wxGridEditorCreatedEvent",SwigwxGridEditorCreatedEventTowxEvent}, { "_wxEvent","_wxGridRangeSelectEvent",SwigwxGridRangeSelectEventTowxEvent}, { "_wxEvent","_wxGridSizeEvent",SwigwxGridSizeEventTowxEvent}, { "_wxEvent","_wxGridEvent",SwigwxGridEventTowxEvent}, @@ -13814,6 +14073,7 @@ static struct { char *n1; char *n2; void *(*pcnv)(void *); } _swig_mapping[] = { { "_uint","_int",0}, { "_uint","_wxWindowID",0}, { "_wxChar","_char",0}, + { "_wxCommandEvent","_wxGridEditorCreatedEvent",SwigwxGridEditorCreatedEventTowxCommandEvent}, { "_wxCommandEvent","_wxGridRangeSelectEvent",SwigwxGridRangeSelectEventTowxCommandEvent}, { "_wxCommandEvent","_wxGridSizeEvent",SwigwxGridSizeEventTowxCommandEvent}, { "_wxCommandEvent","_wxGridEvent",SwigwxGridEventTowxCommandEvent}, @@ -13857,6 +14117,7 @@ static struct { char *n1; char *n2; void *(*pcnv)(void *); } _swig_mapping[] = { { "_wxGridCellAttrProvider","_wxPyGridCellAttrProvider",SwigwxPyGridCellAttrProviderTowxGridCellAttrProvider}, { "_unsigned_short","_WXTYPE",0}, { "_unsigned_short","_short",0}, + { "_wxObject","_wxGridEditorCreatedEvent",SwigwxGridEditorCreatedEventTowxObject}, { "_wxObject","_wxGridRangeSelectEvent",SwigwxGridRangeSelectEventTowxObject}, { "_wxObject","_wxGridSizeEvent",SwigwxGridSizeEventTowxObject}, { "_wxObject","_wxGridEvent",SwigwxGridEventTowxObject}, @@ -13970,6 +14231,7 @@ SWIGEXPORT(void) initgridc() { PyDict_SetItemString(d,"wxEVT_GRID_SELECT_CELL", PyInt_FromLong((long) wxEVT_GRID_SELECT_CELL)); PyDict_SetItemString(d,"wxEVT_GRID_EDITOR_SHOWN", PyInt_FromLong((long) wxEVT_GRID_EDITOR_SHOWN)); PyDict_SetItemString(d,"wxEVT_GRID_EDITOR_HIDDEN", PyInt_FromLong((long) wxEVT_GRID_EDITOR_HIDDEN)); + PyDict_SetItemString(d,"wxEVT_GRID_EDITOR_CREATED", PyInt_FromLong((long) wxEVT_GRID_EDITOR_CREATED)); wxClassInfo::CleanUpClasses(); wxClassInfo::InitializeClasses(); diff --git a/wxPython/src/msw/grid.py b/wxPython/src/msw/grid.py index 761152947a..723c0e0a0a 100644 --- a/wxPython/src/msw/grid.py +++ b/wxPython/src/msw/grid.py @@ -59,6 +59,9 @@ def EVT_GRID_EDITOR_SHOWN(win, fn): def EVT_GRID_EDITOR_HIDDEN(win, fn): win.Connect(-1, -1, wxEVT_GRID_EDITOR_HIDDEN, fn) +def EVT_GRID_EDITOR_CREATED(win, fn): + win.Connect(-1, -1, wxEVT_GRID_EDITOR_CREATED, fn) + class wxGridCellRendererPtr : def __init__(self,this): @@ -1481,6 +1484,38 @@ class wxGridRangeSelectEvent(wxGridRangeSelectEventPtr): +class wxGridEditorCreatedEventPtr(wxCommandEventPtr): + def __init__(self,this): + self.this = this + self.thisown = 0 + def GetRow(self, *_args, **_kwargs): + val = apply(gridc.wxGridEditorCreatedEvent_GetRow,(self,) + _args, _kwargs) + return val + def GetCol(self, *_args, **_kwargs): + val = apply(gridc.wxGridEditorCreatedEvent_GetCol,(self,) + _args, _kwargs) + return val + def GetControl(self, *_args, **_kwargs): + val = apply(gridc.wxGridEditorCreatedEvent_GetControl,(self,) + _args, _kwargs) + return val + def SetRow(self, *_args, **_kwargs): + val = apply(gridc.wxGridEditorCreatedEvent_SetRow,(self,) + _args, _kwargs) + return val + def SetCol(self, *_args, **_kwargs): + val = apply(gridc.wxGridEditorCreatedEvent_SetCol,(self,) + _args, _kwargs) + return val + def SetControl(self, *_args, **_kwargs): + val = apply(gridc.wxGridEditorCreatedEvent_SetControl,(self,) + _args, _kwargs) + return val + def __repr__(self): + return "" % (self.this,) +class wxGridEditorCreatedEvent(wxGridEditorCreatedEventPtr): + def __init__(self,*_args,**_kwargs): + self.this = apply(gridc.new_wxGridEditorCreatedEvent,_args,_kwargs) + self.thisown = 1 + + + + #-------------- FUNCTION WRAPPERS ------------------ @@ -1522,6 +1557,7 @@ wxEVT_GRID_CELL_CHANGE = gridc.wxEVT_GRID_CELL_CHANGE wxEVT_GRID_SELECT_CELL = gridc.wxEVT_GRID_SELECT_CELL wxEVT_GRID_EDITOR_SHOWN = gridc.wxEVT_GRID_EDITOR_SHOWN wxEVT_GRID_EDITOR_HIDDEN = gridc.wxEVT_GRID_EDITOR_HIDDEN +wxEVT_GRID_EDITOR_CREATED = gridc.wxEVT_GRID_EDITOR_CREATED #-------------- USER INCLUDE ----------------------- @@ -1533,6 +1569,7 @@ wxEVT_GRID_EDITOR_HIDDEN = gridc.wxEVT_GRID_EDITOR_HIDDEN wx.wxGridEventPtr = wxGridEventPtr wx.wxGridSizeEventPtr = wxGridSizeEventPtr wx.wxGridRangeSelectEventPtr = wxGridRangeSelectEventPtr +wx.wxGridEditorCreatedEventPtr = wxGridEditorCreatedEventPtr wx.wxGridCellRendererPtr = wxGridCellRendererPtr wx.wxPyGridCellRendererPtr = wxPyGridCellRendererPtr wx.wxGridCellEditorPtr = wxGridCellEditorPtr -- 2.45.2