From b78b83ecb41960aabac450a6f984795037ac941f Mon Sep 17 00:00:00 2001 From: Robin Dunn Date: Wed, 14 Nov 2001 04:02:20 +0000 Subject: [PATCH] Added wxTextCtrl.GetStringSelection git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@12413 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- wxPython/src/controls.i | 1 + wxPython/src/msw/controls.cpp | 34 ++++++++++++++++++++++++++++++++++ wxPython/src/msw/controls.py | 3 +++ 3 files changed, 38 insertions(+) diff --git a/wxPython/src/controls.i b/wxPython/src/controls.i index f209d1d1c6..65f9e8e838 100644 --- a/wxPython/src/controls.i +++ b/wxPython/src/controls.i @@ -560,6 +560,7 @@ public: // If the return values from and to are the same, there is no selection. void GetSelection(long* OUTPUT, long* OUTPUT) const; + wxString GetStringSelection(); void Clear(); void Replace(long from, long to, const wxString& value); diff --git a/wxPython/src/msw/controls.cpp b/wxPython/src/msw/controls.cpp index f5c909de0e..7a1cb4bc7a 100644 --- a/wxPython/src/msw/controls.cpp +++ b/wxPython/src/msw/controls.cpp @@ -6463,6 +6463,39 @@ static PyObject *_wrap_wxTextCtrl_GetSelection(PyObject *self, PyObject *args, P return _resultobj; } +#define wxTextCtrl_GetStringSelection(_swigobj) (_swigobj->GetStringSelection()) +static PyObject *_wrap_wxTextCtrl_GetStringSelection(PyObject *self, PyObject *args, PyObject *kwargs) { + PyObject * _resultobj; + wxString * _result; + wxTextCtrl * _arg0; + PyObject * _argo0 = 0; + char *_kwnames[] = { "self", NULL }; + + self = self; + if(!PyArg_ParseTupleAndKeywords(args,kwargs,"O:wxTextCtrl_GetStringSelection",_kwnames,&_argo0)) + return NULL; + if (_argo0) { + if (_argo0 == Py_None) { _arg0 = NULL; } + else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxTextCtrl_p")) { + PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxTextCtrl_GetStringSelection. Expected _wxTextCtrl_p."); + return NULL; + } + } +{ + wxPy_BEGIN_ALLOW_THREADS; + _result = new wxString (wxTextCtrl_GetStringSelection(_arg0)); + + wxPy_END_ALLOW_THREADS; + if (PyErr_Occurred()) return NULL; +}{ + _resultobj = PyString_FromStringAndSize(_result->c_str(), _result->Len()); +} +{ + delete _result; +} + return _resultobj; +} + #define wxTextCtrl_Clear(_swigobj) (_swigobj->Clear()) static PyObject *_wrap_wxTextCtrl_Clear(PyObject *self, PyObject *args, PyObject *kwargs) { PyObject * _resultobj; @@ -11183,6 +11216,7 @@ static PyMethodDef controlscMethods[] = { { "wxTextCtrl_Remove", (PyCFunction) _wrap_wxTextCtrl_Remove, METH_VARARGS | METH_KEYWORDS }, { "wxTextCtrl_Replace", (PyCFunction) _wrap_wxTextCtrl_Replace, METH_VARARGS | METH_KEYWORDS }, { "wxTextCtrl_Clear", (PyCFunction) _wrap_wxTextCtrl_Clear, METH_VARARGS | METH_KEYWORDS }, + { "wxTextCtrl_GetStringSelection", (PyCFunction) _wrap_wxTextCtrl_GetStringSelection, METH_VARARGS | METH_KEYWORDS }, { "wxTextCtrl_GetSelection", (PyCFunction) _wrap_wxTextCtrl_GetSelection, METH_VARARGS | METH_KEYWORDS }, { "wxTextCtrl_IsEditable", (PyCFunction) _wrap_wxTextCtrl_IsEditable, METH_VARARGS | METH_KEYWORDS }, { "wxTextCtrl_IsModified", (PyCFunction) _wrap_wxTextCtrl_IsModified, METH_VARARGS | METH_KEYWORDS }, diff --git a/wxPython/src/msw/controls.py b/wxPython/src/msw/controls.py index a5ba51fdd9..563bd1a116 100644 --- a/wxPython/src/msw/controls.py +++ b/wxPython/src/msw/controls.py @@ -635,6 +635,9 @@ class wxTextCtrlPtr(wxControlPtr): def GetSelection(self, *_args, **_kwargs): val = apply(controlsc.wxTextCtrl_GetSelection,(self,) + _args, _kwargs) return val + def GetStringSelection(self, *_args, **_kwargs): + val = apply(controlsc.wxTextCtrl_GetStringSelection,(self,) + _args, _kwargs) + return val def Clear(self, *_args, **_kwargs): val = apply(controlsc.wxTextCtrl_Clear,(self,) + _args, _kwargs) return val -- 2.47.2