From 6af85fcd90fc50853ab0ce18721c522b053b065b Mon Sep 17 00:00:00 2001 From: Robin Dunn Date: Mon, 12 Aug 2002 19:17:43 +0000 Subject: [PATCH] Added accessor for the main window in generic wxListCtrl. In wxMSW just returns self. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@16470 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- wxPython/src/controls2.i | 11 +++++++++++ wxPython/src/msw/controls2.cpp | 35 ++++++++++++++++++++++++++++++++++ wxPython/src/msw/controls2.py | 3 +++ 3 files changed, 49 insertions(+) diff --git a/wxPython/src/controls2.i b/wxPython/src/controls2.i index 281e04fbd4..a4af34c4bc 100644 --- a/wxPython/src/controls2.i +++ b/wxPython/src/controls2.i @@ -740,6 +740,17 @@ public: return self->SortItems(wxPyListCtrl_SortItems, (long)func); } } + + + %addmethods { + wxWindow* GetMainWindow() { + #ifdef __WXMSW__ + return self; + #else + return (wxWindow*)m_mainWin; + #endif + } + } }; diff --git a/wxPython/src/msw/controls2.cpp b/wxPython/src/msw/controls2.cpp index f14dfc789e..97cadeefae 100644 --- a/wxPython/src/msw/controls2.cpp +++ b/wxPython/src/msw/controls2.cpp @@ -5032,6 +5032,40 @@ static PyObject *_wrap_wxListCtrl_SortItems(PyObject *self, PyObject *args, PyOb return _resultobj; } +static wxWindow * wxPyListCtrl_GetMainWindow(wxPyListCtrl *self) { + #ifdef __WXMSW__ + return self; + #else + return (wxWindow*)m_mainWin; + #endif + } +static PyObject *_wrap_wxListCtrl_GetMainWindow(PyObject *self, PyObject *args, PyObject *kwargs) { + PyObject * _resultobj; + wxWindow * _result; + wxPyListCtrl * _arg0; + PyObject * _argo0 = 0; + char *_kwnames[] = { "self", NULL }; + + self = self; + if(!PyArg_ParseTupleAndKeywords(args,kwargs,"O:wxListCtrl_GetMainWindow",_kwnames,&_argo0)) + return NULL; + if (_argo0) { + if (_argo0 == Py_None) { _arg0 = NULL; } + else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxPyListCtrl_p")) { + PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxListCtrl_GetMainWindow. Expected _wxPyListCtrl_p."); + return NULL; + } + } +{ + PyThreadState* __tstate = wxPyBeginAllowThreads(); + _result = (wxWindow *)wxPyListCtrl_GetMainWindow(_arg0); + + wxPyEndAllowThreads(__tstate); + if (PyErr_Occurred()) return NULL; +}{ _resultobj = wxPyMake_wxObject(_result); } + return _resultobj; +} + static void *SwigwxListViewTowxPyListCtrl(void *ptr) { wxListView *src; wxPyListCtrl *dest; @@ -10880,6 +10914,7 @@ static PyMethodDef controls2cMethods[] = { { "wxListView_Create", (PyCFunction) _wrap_wxListView_Create, METH_VARARGS | METH_KEYWORDS }, { "new_wxPreListView", (PyCFunction) _wrap_new_wxPreListView, METH_VARARGS | METH_KEYWORDS }, { "new_wxListView", (PyCFunction) _wrap_new_wxListView, METH_VARARGS | METH_KEYWORDS }, + { "wxListCtrl_GetMainWindow", (PyCFunction) _wrap_wxListCtrl_GetMainWindow, METH_VARARGS | METH_KEYWORDS }, { "wxListCtrl_SortItems", (PyCFunction) _wrap_wxListCtrl_SortItems, METH_VARARGS | METH_KEYWORDS }, { "wxListCtrl_GetItemBackgroundColour", (PyCFunction) _wrap_wxListCtrl_GetItemBackgroundColour, METH_VARARGS | METH_KEYWORDS }, { "wxListCtrl_SetItemBackgroundColour", (PyCFunction) _wrap_wxListCtrl_SetItemBackgroundColour, METH_VARARGS | METH_KEYWORDS }, diff --git a/wxPython/src/msw/controls2.py b/wxPython/src/msw/controls2.py index 5e0904baf5..6ef53ea460 100644 --- a/wxPython/src/msw/controls2.py +++ b/wxPython/src/msw/controls2.py @@ -635,6 +635,9 @@ class wxListCtrlPtr(wxControlPtr): def SortItems(self, *_args, **_kwargs): val = apply(controls2c.wxListCtrl_SortItems,(self,) + _args, _kwargs) return val + def GetMainWindow(self, *_args, **_kwargs): + val = apply(controls2c.wxListCtrl_GetMainWindow,(self,) + _args, _kwargs) + return val def __repr__(self): return "" % (self.this,)