From 86d56a0fc39bcb128b24800d058f316d40e29b24 Mon Sep 17 00:00:00 2001 From: Robin Dunn Date: Wed, 15 Jan 2003 01:53:18 +0000 Subject: [PATCH] SWIGged updates for wxMSW git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/branches/WX_2_4_BRANCH@18741 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- wxPython/src/msw/controls.cpp | 29 +++++++++++++++++++++++++++++ wxPython/src/msw/controls.py | 3 +++ wxPython/src/msw/filesys.py | 1 - wxPython/src/msw/grid.cpp | 8 ++++---- wxPython/src/msw/sizers.py | 17 ++++++++--------- wxPython/src/msw/streams.py | 1 - wxPython/src/msw/utils.py | 12 ++++++------ wxPython/src/msw/wx.py | 1 + 8 files changed, 51 insertions(+), 21 deletions(-) diff --git a/wxPython/src/msw/controls.cpp b/wxPython/src/msw/controls.cpp index d11d7bd0b4..284aaf449d 100644 --- a/wxPython/src/msw/controls.cpp +++ b/wxPython/src/msw/controls.cpp @@ -2199,6 +2199,34 @@ static PyObject *_wrap_wxCheckBox_GetValue(PyObject *self, PyObject *args, PyObj return _resultobj; } +#define wxCheckBox_IsChecked(_swigobj) (_swigobj->IsChecked()) +static PyObject *_wrap_wxCheckBox_IsChecked(PyObject *self, PyObject *args, PyObject *kwargs) { + PyObject * _resultobj; + bool _result; + wxCheckBox * _arg0; + PyObject * _argo0 = 0; + char *_kwnames[] = { "self", NULL }; + + self = self; + if(!PyArg_ParseTupleAndKeywords(args,kwargs,"O:wxCheckBox_IsChecked",_kwnames,&_argo0)) + return NULL; + if (_argo0) { + if (_argo0 == Py_None) { _arg0 = NULL; } + else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxCheckBox_p")) { + PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxCheckBox_IsChecked. Expected _wxCheckBox_p."); + return NULL; + } + } +{ + PyThreadState* __tstate = wxPyBeginAllowThreads(); + _result = (bool )wxCheckBox_IsChecked(_arg0); + + wxPyEndAllowThreads(__tstate); + if (PyErr_Occurred()) return NULL; +} _resultobj = Py_BuildValue("i",_result); + return _resultobj; +} + #define wxCheckBox_SetValue(_swigobj,_swigarg0) (_swigobj->SetValue(_swigarg0)) static PyObject *_wrap_wxCheckBox_SetValue(PyObject *self, PyObject *args, PyObject *kwargs) { PyObject * _resultobj; @@ -11695,6 +11723,7 @@ static PyMethodDef controlscMethods[] = { { "new_wxPreChoice", (PyCFunction) _wrap_new_wxPreChoice, METH_VARARGS | METH_KEYWORDS }, { "new_wxChoice", (PyCFunction) _wrap_new_wxChoice, METH_VARARGS | METH_KEYWORDS }, { "wxCheckBox_SetValue", (PyCFunction) _wrap_wxCheckBox_SetValue, METH_VARARGS | METH_KEYWORDS }, + { "wxCheckBox_IsChecked", (PyCFunction) _wrap_wxCheckBox_IsChecked, METH_VARARGS | METH_KEYWORDS }, { "wxCheckBox_GetValue", (PyCFunction) _wrap_wxCheckBox_GetValue, METH_VARARGS | METH_KEYWORDS }, { "wxCheckBox_Create", (PyCFunction) _wrap_wxCheckBox_Create, METH_VARARGS | METH_KEYWORDS }, { "new_wxPreCheckBox", (PyCFunction) _wrap_new_wxPreCheckBox, METH_VARARGS | METH_KEYWORDS }, diff --git a/wxPython/src/msw/controls.py b/wxPython/src/msw/controls.py index 4e06f17121..d13648f9d9 100644 --- a/wxPython/src/msw/controls.py +++ b/wxPython/src/msw/controls.py @@ -206,6 +206,9 @@ class wxCheckBoxPtr(wxControlPtr): def GetValue(self, *_args, **_kwargs): val = apply(controlsc.wxCheckBox_GetValue,(self,) + _args, _kwargs) return val + def IsChecked(self, *_args, **_kwargs): + val = apply(controlsc.wxCheckBox_IsChecked,(self,) + _args, _kwargs) + return val def SetValue(self, *_args, **_kwargs): val = apply(controlsc.wxCheckBox_SetValue,(self,) + _args, _kwargs) return val diff --git a/wxPython/src/msw/filesys.py b/wxPython/src/msw/filesys.py index 98a3c2cc1a..8950e6059b 100644 --- a/wxPython/src/msw/filesys.py +++ b/wxPython/src/msw/filesys.py @@ -13,7 +13,6 @@ from fonts import * from streams import * import wx -import string import types def wxMemoryFSHandler_AddFile(filename, a, b=''): diff --git a/wxPython/src/msw/grid.cpp b/wxPython/src/msw/grid.cpp index f51a2fde07..6797d126f1 100644 --- a/wxPython/src/msw/grid.cpp +++ b/wxPython/src/msw/grid.cpp @@ -12675,8 +12675,7 @@ static PyObject *_wrap_wxGrid_GetSelectedRows(PyObject *self, PyObject *args, Py } { PyThreadState* __tstate = wxPyBeginAllowThreads(); - const wxArrayInt & _result_ref = wxGrid_GetSelectedRows(_arg0); - _result = (wxArrayInt *) &_result_ref; + _result = new wxArrayInt (wxGrid_GetSelectedRows(_arg0)); wxPyEndAllowThreads(__tstate); if (PyErr_Occurred()) return NULL; @@ -12688,6 +12687,7 @@ static PyObject *_wrap_wxGrid_GetSelectedRows(PyObject *self, PyObject *args, Py PyList_Append(_resultobj, val); Py_DECREF(val); } + delete _result; } return _resultobj; } @@ -12712,8 +12712,7 @@ static PyObject *_wrap_wxGrid_GetSelectedCols(PyObject *self, PyObject *args, Py } { PyThreadState* __tstate = wxPyBeginAllowThreads(); - const wxArrayInt & _result_ref = wxGrid_GetSelectedCols(_arg0); - _result = (wxArrayInt *) &_result_ref; + _result = new wxArrayInt (wxGrid_GetSelectedCols(_arg0)); wxPyEndAllowThreads(__tstate); if (PyErr_Occurred()) return NULL; @@ -12725,6 +12724,7 @@ static PyObject *_wrap_wxGrid_GetSelectedCols(PyObject *self, PyObject *args, Py PyList_Append(_resultobj, val); Py_DECREF(val); } + delete _result; } return _resultobj; } diff --git a/wxPython/src/msw/sizers.py b/wxPython/src/msw/sizers.py index 607c54f162..e1653c22b5 100644 --- a/wxPython/src/msw/sizers.py +++ b/wxPython/src/msw/sizers.py @@ -15,7 +15,6 @@ from controls import * from events import * import wx -import string class wxSizerItemPtr(wxObjectPtr): def __init__(self,this): self.this = this @@ -235,7 +234,7 @@ class wxSizerPtr(wxObjectPtr): def Add(self, *args, **kw): if type(args[0]) == type(1): apply(self.AddSpacer, args, kw) - elif string.find(args[0].this, 'Sizer') != -1: + elif isinstance(args[0], wxSizerPtr): apply(self.AddSizer, args, kw) else: apply(self.AddWindow, args, kw) @@ -243,7 +242,7 @@ class wxSizerPtr(wxObjectPtr): def Insert(self, *args, **kw): if type(args[1]) == type(1): apply(self.InsertSpacer, args, kw) - elif string.find(args[1].this, 'Sizer') != -1: + elif isinstance(args[0], wxSizerPtr): apply(self.InsertSizer, args, kw) else: apply(self.InsertWindow, args, kw) @@ -251,7 +250,7 @@ class wxSizerPtr(wxObjectPtr): def Prepend(self, *args, **kw): if type(args[0]) == type(1): apply(self.PrependSpacer, args, kw) - elif string.find(args[0].this, 'Sizer') != -1: + elif isinstance(args[0], wxSizerPtr): apply(self.PrependSizer, args, kw) else: apply(self.PrependWindow, args, kw) @@ -259,7 +258,7 @@ class wxSizerPtr(wxObjectPtr): def Remove(self, *args, **kw): if type(args[0]) == type(1): return apply(self.RemovePos, args, kw) - elif string.find(args[0].this, 'Sizer') != -1: + elif isinstance(args[0], wxSizerPtr): return apply(self.RemoveSizer, args, kw) else: return apply(self.RemoveWindow, args, kw) @@ -274,7 +273,7 @@ class wxSizerPtr(wxObjectPtr): def SetItemMinSize(self, *args): if type(args[0]) == type(1): apply(self.SetItemMinSizePos, args) - elif string.find(args[0].this, 'Sizer') != -1: + elif isinstance(args[0], wxSizerPtr): apply(self.SetItemMinSizeSizer, args) else: apply(self.SetItemMinSizeWindow, args) @@ -289,19 +288,19 @@ class wxSizerPtr(wxObjectPtr): def Show(self, *args): - if string.find(args[0].this, 'Sizer') != -1: + if isinstance(args[0], wxSizerPtr): apply(self.ShowSizer, args) else: apply(self.ShowWindow, args) def Hide(self, *args): - if string.find(args[0].this, 'Sizer') != -1: + if isinstance(args[0], wxSizerPtr): apply(self.HideSizer, args) else: apply(self.HideWindow, args) def IsShown(self, *args): - if string.find(args[0].this, 'Sizer') != -1: + if isinstance(args[0], wxSizerPtr): return apply(self.IsShownSizer, args) else: return apply(self.IsShownWindow, args) diff --git a/wxPython/src/msw/streams.py b/wxPython/src/msw/streams.py index 1112cf2836..d2a8b18800 100644 --- a/wxPython/src/msw/streams.py +++ b/wxPython/src/msw/streams.py @@ -1,7 +1,6 @@ # This file was created automatically by SWIG. import streamsc import wx -import string class wxInputStreamPtr : def __init__(self,this): self.this = this diff --git a/wxPython/src/msw/utils.py b/wxPython/src/msw/utils.py index bd4885827f..2358279794 100644 --- a/wxPython/src/msw/utils.py +++ b/wxPython/src/msw/utils.py @@ -1,6 +1,6 @@ # This file was created automatically by SWIG. import utilsc -import string +import wx class wxConfigBasePtr : Type_Unknown = utilsc.wxConfigBase_Type_Unknown Type_String = utilsc.wxConfigBase_Type_String @@ -551,17 +551,17 @@ class wxDateTimePtr : return "" % (self.this,) def __add__(self, other): - if string.find(other.this, 'wxTimeSpan') != -1: + if isinstance(other, wxTimeSpanPtr): return self.__add__TS(other) - if string.find(other.this, 'wxDateSpan') != -1: + if isinstance(other, wxDateSpanPtr): return self.__add__DS(other) raise TypeError, 'Invalid r.h.s. type for __add__' def __sub__(self, other): - if string.find(other.this, 'wxDateTime') != -1: + if isinstance(other, wxDateTimePtr): return self.__sub__DT(other) - if string.find(other.this, 'wxTimeSpan') != -1: + if isinstance(other, wxTimeSpanPtr): return self.__sub__TS(other) - if string.find(other.this, 'wxDateSpan') != -1: + if isinstnace(other, wxDateSpanPtr): return self.__sub__DS(other) raise TypeError, 'Invalid r.h.s. type for __sub__' diff --git a/wxPython/src/msw/wx.py b/wxPython/src/msw/wx.py index ab3fbc987f..87ed5bdd3f 100644 --- a/wxPython/src/msw/wx.py +++ b/wxPython/src/msw/wx.py @@ -1549,6 +1549,7 @@ wxSystemSettings_GetSystemMetric = wxSystemSettings_GetMetric wxGauge95 = wxGauge wxGauge95Ptr = wxGaugePtr + wxPyAssertionError = wxc.wxPyAssertionError