From 7f44209657f65bc7d0c453d7659cafc175010e37 Mon Sep 17 00:00:00 2001 From: Robin Dunn Date: Tue, 24 Oct 2006 01:08:17 +0000 Subject: [PATCH] Allow both SetCurrent() and SetCurrent(context) git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@42319 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- wxPython/contrib/glcanvas/glcanvas.i | 4 +- wxPython/contrib/glcanvas/gtk/glcanvas.py | 9 ++- .../contrib/glcanvas/gtk/glcanvas_wrap.cpp | 59 +++++++++++++++---- wxPython/contrib/glcanvas/mac/glcanvas.py | 4 +- wxPython/contrib/glcanvas/msw/glcanvas.py | 9 ++- .../contrib/glcanvas/msw/glcanvas_wrap.cpp | 59 +++++++++++++++---- 6 files changed, 114 insertions(+), 30 deletions(-) diff --git a/wxPython/contrib/glcanvas/glcanvas.i b/wxPython/contrib/glcanvas/glcanvas.i index 1cdf228276..77d209a58e 100644 --- a/wxPython/contrib/glcanvas/glcanvas.i +++ b/wxPython/contrib/glcanvas/glcanvas.i @@ -131,9 +131,9 @@ public: int *attribList = NULL, const wxPalette& palette = wxNullPalette )); -#ifdef __WXMAC__ + %nokwargs SetCurrent; void SetCurrent(); -#else +#ifndef __WXMAC__ void SetCurrent(const wxGLContext& RC); #endif void SetColour(const wxString& colour); diff --git a/wxPython/contrib/glcanvas/gtk/glcanvas.py b/wxPython/contrib/glcanvas/gtk/glcanvas.py index 38f48cc8c2..550270f00f 100644 --- a/wxPython/contrib/glcanvas/gtk/glcanvas.py +++ b/wxPython/contrib/glcanvas/gtk/glcanvas.py @@ -104,9 +104,12 @@ class GLCanvas(_core.Window): _glcanvas.GLCanvas_swiginit(self,_glcanvas.new_GLCanvas(*args, **kwargs)) self._setOORInfo(self) - def SetCurrent(*args, **kwargs): - """SetCurrent(self, GLContext RC)""" - return _glcanvas.GLCanvas_SetCurrent(*args, **kwargs) + def SetCurrent(*args): + """ + SetCurrent(self) + SetCurrent(self, GLContext RC) + """ + return _glcanvas.GLCanvas_SetCurrent(*args) def SetColour(*args, **kwargs): """SetColour(self, String colour)""" diff --git a/wxPython/contrib/glcanvas/gtk/glcanvas_wrap.cpp b/wxPython/contrib/glcanvas/gtk/glcanvas_wrap.cpp index 3f874f2030..2d0258ca8a 100644 --- a/wxPython/contrib/glcanvas/gtk/glcanvas_wrap.cpp +++ b/wxPython/contrib/glcanvas/gtk/glcanvas_wrap.cpp @@ -3125,7 +3125,32 @@ fail: } -SWIGINTERN PyObject *_wrap_GLCanvas_SetCurrent(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) { +SWIGINTERN PyObject *_wrap_GLCanvas_SetCurrent__SWIG_0(PyObject *SWIGUNUSEDPARM(self), int nobjs, PyObject **swig_obj) { + PyObject *resultobj = 0; + wxGLCanvas *arg1 = (wxGLCanvas *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + + if ((nobjs < 1) || (nobjs > 1)) SWIG_fail; + res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_wxGLCanvas, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "GLCanvas_SetCurrent" "', expected argument " "1"" of type '" "wxGLCanvas *""'"); + } + arg1 = reinterpret_cast< wxGLCanvas * >(argp1); + { + PyThreadState* __tstate = wxPyBeginAllowThreads(); + (arg1)->SetCurrent(); + wxPyEndAllowThreads(__tstate); + if (PyErr_Occurred()) SWIG_fail; + } + resultobj = SWIG_Py_Void(); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_GLCanvas_SetCurrent__SWIG_1(PyObject *SWIGUNUSEDPARM(self), int nobjs, PyObject **swig_obj) { PyObject *resultobj = 0; wxGLCanvas *arg1 = (wxGLCanvas *) 0 ; wxGLContext *arg2 = 0 ; @@ -3133,19 +3158,14 @@ SWIGINTERN PyObject *_wrap_GLCanvas_SetCurrent(PyObject *SWIGUNUSEDPARM(self), P int res1 = 0 ; void *argp2 = 0 ; int res2 = 0 ; - PyObject * obj0 = 0 ; - PyObject * obj1 = 0 ; - char * kwnames[] = { - (char *) "self",(char *) "RC", NULL - }; - if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OO:GLCanvas_SetCurrent",kwnames,&obj0,&obj1)) SWIG_fail; - res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_wxGLCanvas, 0 | 0 ); + if ((nobjs < 2) || (nobjs > 2)) SWIG_fail; + res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_wxGLCanvas, 0 | 0 ); if (!SWIG_IsOK(res1)) { SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "GLCanvas_SetCurrent" "', expected argument " "1"" of type '" "wxGLCanvas *""'"); } arg1 = reinterpret_cast< wxGLCanvas * >(argp1); - res2 = SWIG_ConvertPtr(obj1, &argp2, SWIGTYPE_p_wxGLContext, 0 | 0); + res2 = SWIG_ConvertPtr(swig_obj[1], &argp2, SWIGTYPE_p_wxGLContext, 0 | 0); if (!SWIG_IsOK(res2)) { SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "GLCanvas_SetCurrent" "', expected argument " "2"" of type '" "wxGLContext const &""'"); } @@ -3166,6 +3186,25 @@ fail: } +SWIGINTERN PyObject *_wrap_GLCanvas_SetCurrent(PyObject *self, PyObject *args) { + int argc; + PyObject *argv[3]; + + if (!(argc = SWIG_Python_UnpackTuple(args,"GLCanvas_SetCurrent",0,2,argv))) SWIG_fail; + --argc; + if (argc == 1) { + return _wrap_GLCanvas_SetCurrent__SWIG_0(self, argc, argv); + } + if (argc == 2) { + return _wrap_GLCanvas_SetCurrent__SWIG_1(self, argc, argv); + } + +fail: + SWIG_SetErrorMsg(PyExc_NotImplementedError,"No matching function for overloaded 'GLCanvas_SetCurrent'"); + return NULL; +} + + SWIGINTERN PyObject *_wrap_GLCanvas_SetColour(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) { PyObject *resultobj = 0; wxGLCanvas *arg1 = (wxGLCanvas *) 0 ; @@ -3285,7 +3324,7 @@ static PyMethodDef SwigMethods[] = { { (char *)"GLContext_swiginit", GLContext_swiginit, METH_VARARGS, NULL}, { (char *)"new_GLCanvas", (PyCFunction) _wrap_new_GLCanvas, METH_VARARGS | METH_KEYWORDS, NULL}, { (char *)"new_GLCanvasWithContext", (PyCFunction) _wrap_new_GLCanvasWithContext, METH_VARARGS | METH_KEYWORDS, NULL}, - { (char *)"GLCanvas_SetCurrent", (PyCFunction) _wrap_GLCanvas_SetCurrent, METH_VARARGS | METH_KEYWORDS, NULL}, + { (char *)"GLCanvas_SetCurrent", _wrap_GLCanvas_SetCurrent, METH_VARARGS, NULL}, { (char *)"GLCanvas_SetColour", (PyCFunction) _wrap_GLCanvas_SetColour, METH_VARARGS | METH_KEYWORDS, NULL}, { (char *)"GLCanvas_SwapBuffers", (PyCFunction)_wrap_GLCanvas_SwapBuffers, METH_O, NULL}, { (char *)"GLCanvas_GetContext", (PyCFunction)_wrap_GLCanvas_GetContext, METH_O, NULL}, diff --git a/wxPython/contrib/glcanvas/mac/glcanvas.py b/wxPython/contrib/glcanvas/mac/glcanvas.py index f72b0d71f6..127fe8fb79 100644 --- a/wxPython/contrib/glcanvas/mac/glcanvas.py +++ b/wxPython/contrib/glcanvas/mac/glcanvas.py @@ -103,9 +103,9 @@ class GLCanvas(_core.Window): _glcanvas.GLCanvas_swiginit(self,_glcanvas.new_GLCanvas(*args, **kwargs)) self._setOORInfo(self) - def SetCurrent(*args, **kwargs): + def SetCurrent(*args): """SetCurrent(self)""" - return _glcanvas.GLCanvas_SetCurrent(*args, **kwargs) + return _glcanvas.GLCanvas_SetCurrent(*args) def SetColour(*args, **kwargs): """SetColour(self, String colour)""" diff --git a/wxPython/contrib/glcanvas/msw/glcanvas.py b/wxPython/contrib/glcanvas/msw/glcanvas.py index 755332e2f8..dabff1a972 100644 --- a/wxPython/contrib/glcanvas/msw/glcanvas.py +++ b/wxPython/contrib/glcanvas/msw/glcanvas.py @@ -104,9 +104,12 @@ class GLCanvas(_core.Window): _glcanvas.GLCanvas_swiginit(self,_glcanvas.new_GLCanvas(*args, **kwargs)) self._setOORInfo(self) - def SetCurrent(*args, **kwargs): - """SetCurrent(self, GLContext RC)""" - return _glcanvas.GLCanvas_SetCurrent(*args, **kwargs) + def SetCurrent(*args): + """ + SetCurrent(self) + SetCurrent(self, GLContext RC) + """ + return _glcanvas.GLCanvas_SetCurrent(*args) def SetColour(*args, **kwargs): """SetColour(self, String colour)""" diff --git a/wxPython/contrib/glcanvas/msw/glcanvas_wrap.cpp b/wxPython/contrib/glcanvas/msw/glcanvas_wrap.cpp index 5477c051ff..d7c69f7c5c 100644 --- a/wxPython/contrib/glcanvas/msw/glcanvas_wrap.cpp +++ b/wxPython/contrib/glcanvas/msw/glcanvas_wrap.cpp @@ -3125,7 +3125,32 @@ fail: } -SWIGINTERN PyObject *_wrap_GLCanvas_SetCurrent(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) { +SWIGINTERN PyObject *_wrap_GLCanvas_SetCurrent__SWIG_0(PyObject *SWIGUNUSEDPARM(self), int nobjs, PyObject **swig_obj) { + PyObject *resultobj = 0; + wxGLCanvas *arg1 = (wxGLCanvas *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + + if ((nobjs < 1) || (nobjs > 1)) SWIG_fail; + res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_wxGLCanvas, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "GLCanvas_SetCurrent" "', expected argument " "1"" of type '" "wxGLCanvas *""'"); + } + arg1 = reinterpret_cast< wxGLCanvas * >(argp1); + { + PyThreadState* __tstate = wxPyBeginAllowThreads(); + (arg1)->SetCurrent(); + wxPyEndAllowThreads(__tstate); + if (PyErr_Occurred()) SWIG_fail; + } + resultobj = SWIG_Py_Void(); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_GLCanvas_SetCurrent__SWIG_1(PyObject *SWIGUNUSEDPARM(self), int nobjs, PyObject **swig_obj) { PyObject *resultobj = 0; wxGLCanvas *arg1 = (wxGLCanvas *) 0 ; wxGLContext *arg2 = 0 ; @@ -3133,19 +3158,14 @@ SWIGINTERN PyObject *_wrap_GLCanvas_SetCurrent(PyObject *SWIGUNUSEDPARM(self), P int res1 = 0 ; void *argp2 = 0 ; int res2 = 0 ; - PyObject * obj0 = 0 ; - PyObject * obj1 = 0 ; - char * kwnames[] = { - (char *) "self",(char *) "RC", NULL - }; - if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OO:GLCanvas_SetCurrent",kwnames,&obj0,&obj1)) SWIG_fail; - res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_wxGLCanvas, 0 | 0 ); + if ((nobjs < 2) || (nobjs > 2)) SWIG_fail; + res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_wxGLCanvas, 0 | 0 ); if (!SWIG_IsOK(res1)) { SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "GLCanvas_SetCurrent" "', expected argument " "1"" of type '" "wxGLCanvas *""'"); } arg1 = reinterpret_cast< wxGLCanvas * >(argp1); - res2 = SWIG_ConvertPtr(obj1, &argp2, SWIGTYPE_p_wxGLContext, 0 | 0); + res2 = SWIG_ConvertPtr(swig_obj[1], &argp2, SWIGTYPE_p_wxGLContext, 0 | 0); if (!SWIG_IsOK(res2)) { SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "GLCanvas_SetCurrent" "', expected argument " "2"" of type '" "wxGLContext const &""'"); } @@ -3166,6 +3186,25 @@ fail: } +SWIGINTERN PyObject *_wrap_GLCanvas_SetCurrent(PyObject *self, PyObject *args) { + int argc; + PyObject *argv[3]; + + if (!(argc = SWIG_Python_UnpackTuple(args,"GLCanvas_SetCurrent",0,2,argv))) SWIG_fail; + --argc; + if (argc == 1) { + return _wrap_GLCanvas_SetCurrent__SWIG_0(self, argc, argv); + } + if (argc == 2) { + return _wrap_GLCanvas_SetCurrent__SWIG_1(self, argc, argv); + } + +fail: + SWIG_SetErrorMsg(PyExc_NotImplementedError,"No matching function for overloaded 'GLCanvas_SetCurrent'"); + return NULL; +} + + SWIGINTERN PyObject *_wrap_GLCanvas_SetColour(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) { PyObject *resultobj = 0; wxGLCanvas *arg1 = (wxGLCanvas *) 0 ; @@ -3434,7 +3473,7 @@ static PyMethodDef SwigMethods[] = { { (char *)"GLContext_swiginit", GLContext_swiginit, METH_VARARGS, NULL}, { (char *)"new_GLCanvas", (PyCFunction) _wrap_new_GLCanvas, METH_VARARGS | METH_KEYWORDS, NULL}, { (char *)"new_GLCanvasWithContext", (PyCFunction) _wrap_new_GLCanvasWithContext, METH_VARARGS | METH_KEYWORDS, NULL}, - { (char *)"GLCanvas_SetCurrent", (PyCFunction) _wrap_GLCanvas_SetCurrent, METH_VARARGS | METH_KEYWORDS, NULL}, + { (char *)"GLCanvas_SetCurrent", _wrap_GLCanvas_SetCurrent, METH_VARARGS, NULL}, { (char *)"GLCanvas_SetColour", (PyCFunction) _wrap_GLCanvas_SetColour, METH_VARARGS | METH_KEYWORDS, NULL}, { (char *)"GLCanvas_SwapBuffers", (PyCFunction)_wrap_GLCanvas_SwapBuffers, METH_O, NULL}, { (char *)"GLCanvas_GetContext", (PyCFunction)_wrap_GLCanvas_GetContext, METH_O, NULL}, -- 2.47.2