From b4aa9fec6574268008b58ea6b3b3bef126c2d6b3 Mon Sep 17 00:00:00 2001 From: Robin Dunn Date: Thu, 12 Apr 2007 00:34:20 +0000 Subject: [PATCH] All platforms have the same GLCanvas API now git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@45411 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- wxPython/contrib/glcanvas/glcanvas.i | 43 +- wxPython/contrib/glcanvas/gtk/glcanvas.py | 23 +- .../contrib/glcanvas/gtk/glcanvas_wrap.cpp | 323 ++++++++++---- wxPython/contrib/glcanvas/mac/glcanvas.py | 29 +- .../contrib/glcanvas/mac/glcanvas_wrap.cpp | 398 ++++++++++++------ wxPython/contrib/glcanvas/msw/glcanvas.py | 25 +- .../contrib/glcanvas/msw/glcanvas_wrap.cpp | 334 +++++++++------ 7 files changed, 787 insertions(+), 388 deletions(-) diff --git a/wxPython/contrib/glcanvas/glcanvas.i b/wxPython/contrib/glcanvas/glcanvas.i index 77d209a58e..682735ded0 100644 --- a/wxPython/contrib/glcanvas/glcanvas.i +++ b/wxPython/contrib/glcanvas/glcanvas.i @@ -45,19 +45,7 @@ MustHaveApp(wxGLContext); class wxGLContext : public wxObject { public: -#ifndef __WXMAC__ wxGLContext(wxGLCanvas *win, const wxGLContext* other = NULL); -#else - %extend { - wxGLContext(bool isRGB, wxGLCanvas *win, - const wxPalette& palette = wxNullPalette, - const wxGLContext* other = NULL) { - AGLPixelFormat fmt; // TODO: How should this be initialized? - return new wxGLContext(fmt, win, palette, other); - } - } - -#endif ~wxGLContext(); #ifndef __WXMAC__ @@ -87,7 +75,7 @@ enum { }; -%typemap(in) int *attribList (int *temp) { +%typemap(in) const int *attribList (int *temp) { int i; if (PySequence_Check($input)) { int size = PyObject_Length($input); @@ -112,13 +100,24 @@ MustHaveApp(wxGLCanvas); class wxGLCanvas : public wxWindow { public: %pythonAppend wxGLCanvas "self._setOORInfo(self)" - wxGLCanvas(wxWindow *parent, wxWindowID id = -1, + wxGLCanvas(wxWindow *parent, + wxWindowID id = -1, + const int *attribList = NULL, const wxPoint& pos = wxDefaultPosition, - const wxSize& size = wxDefaultSize, long style = 0, + const wxSize& size = wxDefaultSize, + long style = 0, const wxString& name = wxPyGLCanvasNameStr, - int *attribList = NULL, const wxPalette& palette = wxNullPalette); + bool Create(wxWindow *parent, + wxWindowID id = wxID_ANY, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = 0, + const wxString& name = wxGLCanvasName, + const int *attribList = NULL, + const wxPalette& palette = wxNullPalette); + %pythonAppend wxGLCanvas "val._setOORInfo(val)" %RenameCtor(GLCanvasWithContext, wxGLCanvas( wxWindow *parent, @@ -128,21 +127,21 @@ public: const wxSize& size = wxDefaultSize, long style = 0, const wxString& name = wxPyGLCanvasNameStr, - int *attribList = NULL, + const int *attribList = NULL, const wxPalette& palette = wxNullPalette )); %nokwargs SetCurrent; - void SetCurrent(); -#ifndef __WXMAC__ - void SetCurrent(const wxGLContext& RC); -#endif + void SetCurrent(const wxGLContext& context); void SetColour(const wxString& colour); void SwapBuffers(); + // deprecated... wxGLContext* GetContext(); + void SetCurrent(); + #ifdef __WXMSW__ - void SetupPixelFormat(int *attribList = NULL); +// void SetupPixelFormat(int *attribList = NULL); void SetupPalette(const wxPalette& palette); wxPalette CreateDefaultPalette(); wxPalette* GetPalette(); diff --git a/wxPython/contrib/glcanvas/gtk/glcanvas.py b/wxPython/contrib/glcanvas/gtk/glcanvas.py index 550270f00f..1e9777dbdc 100644 --- a/wxPython/contrib/glcanvas/gtk/glcanvas.py +++ b/wxPython/contrib/glcanvas/gtk/glcanvas.py @@ -97,19 +97,21 @@ class GLCanvas(_core.Window): __repr__ = _swig_repr def __init__(self, *args, **kwargs): """ - __init__(self, Window parent, int id=-1, Point pos=DefaultPosition, - Size size=DefaultSize, long style=0, String name=GLCanvasNameStr, - int attribList=None, Palette palette=wxNullPalette) -> GLCanvas + __init__(self, Window parent, int id=-1, int attribList=None, Point pos=DefaultPosition, + Size size=DefaultSize, + long style=0, String name=GLCanvasNameStr, Palette palette=wxNullPalette) -> GLCanvas """ _glcanvas.GLCanvas_swiginit(self,_glcanvas.new_GLCanvas(*args, **kwargs)) self._setOORInfo(self) - def SetCurrent(*args): + def Create(*args, **kwargs): """ - SetCurrent(self) - SetCurrent(self, GLContext RC) + Create(self, Window parent, int id=ID_ANY, Point pos=DefaultPosition, + Size size=DefaultSize, long style=0, String name=wxGLCanvasName, + int attribList=None, + Palette palette=wxNullPalette) -> bool """ - return _glcanvas.GLCanvas_SetCurrent(*args) + return _glcanvas.GLCanvas_Create(*args, **kwargs) def SetColour(*args, **kwargs): """SetColour(self, String colour)""" @@ -123,6 +125,13 @@ class GLCanvas(_core.Window): """GetContext(self) -> GLContext""" return _glcanvas.GLCanvas_GetContext(*args, **kwargs) + def SetCurrent(*args): + """ + SetCurrent(self, GLContext context) + SetCurrent(self) + """ + return _glcanvas.GLCanvas_SetCurrent(*args) + Context = property(GetContext,doc="See `GetContext`") _glcanvas.GLCanvas_swigregister(GLCanvas) diff --git a/wxPython/contrib/glcanvas/gtk/glcanvas_wrap.cpp b/wxPython/contrib/glcanvas/gtk/glcanvas_wrap.cpp index 3a969e0b42..68aa077ff0 100644 --- a/wxPython/contrib/glcanvas/gtk/glcanvas_wrap.cpp +++ b/wxPython/contrib/glcanvas/gtk/glcanvas_wrap.cpp @@ -2860,14 +2860,14 @@ SWIGINTERN PyObject *_wrap_new_GLCanvas(PyObject *SWIGUNUSEDPARM(self), PyObject PyObject *resultobj = 0; wxWindow *arg1 = (wxWindow *) 0 ; int arg2 = (int) -1 ; - wxPoint const &arg3_defvalue = wxDefaultPosition ; - wxPoint *arg3 = (wxPoint *) &arg3_defvalue ; - wxSize const &arg4_defvalue = wxDefaultSize ; - wxSize *arg4 = (wxSize *) &arg4_defvalue ; - long arg5 = (long) 0 ; - wxString const &arg6_defvalue = wxPyGLCanvasNameStr ; - wxString *arg6 = (wxString *) &arg6_defvalue ; - int *arg7 = (int *) NULL ; + int *arg3 = (int *) NULL ; + wxPoint const &arg4_defvalue = wxDefaultPosition ; + wxPoint *arg4 = (wxPoint *) &arg4_defvalue ; + wxSize const &arg5_defvalue = wxDefaultSize ; + wxSize *arg5 = (wxSize *) &arg5_defvalue ; + long arg6 = (long) 0 ; + wxString const &arg7_defvalue = wxPyGLCanvasNameStr ; + wxString *arg7 = (wxString *) &arg7_defvalue ; wxPalette const &arg8_defvalue = wxNullPalette ; wxPalette *arg8 = (wxPalette *) &arg8_defvalue ; wxGLCanvas *result = 0 ; @@ -2875,12 +2875,12 @@ SWIGINTERN PyObject *_wrap_new_GLCanvas(PyObject *SWIGUNUSEDPARM(self), PyObject int res1 = 0 ; int val2 ; int ecode2 = 0 ; - wxPoint temp3 ; - wxSize temp4 ; - long val5 ; - int ecode5 = 0 ; - bool temp6 = false ; - int *temp7 ; + int *temp3 ; + wxPoint temp4 ; + wxSize temp5 ; + long val6 ; + int ecode6 = 0 ; + bool temp7 = false ; void *argp8 = 0 ; int res8 = 0 ; PyObject * obj0 = 0 ; @@ -2892,7 +2892,7 @@ SWIGINTERN PyObject *_wrap_new_GLCanvas(PyObject *SWIGUNUSEDPARM(self), PyObject PyObject * obj6 = 0 ; PyObject * obj7 = 0 ; char * kwnames[] = { - (char *) "parent",(char *) "id",(char *) "pos",(char *) "size",(char *) "style",(char *) "name",(char *) "attribList",(char *) "palette", NULL + (char *) "parent",(char *) "id",(char *) "attribList",(char *) "pos",(char *) "size",(char *) "style",(char *) "name",(char *) "palette", NULL }; if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"O|OOOOOOO:new_GLCanvas",kwnames,&obj0,&obj1,&obj2,&obj3,&obj4,&obj5,&obj6,&obj7)) SWIG_fail; @@ -2910,42 +2910,42 @@ SWIGINTERN PyObject *_wrap_new_GLCanvas(PyObject *SWIGUNUSEDPARM(self), PyObject } if (obj2) { { - arg3 = &temp3; - if ( ! wxPoint_helper(obj2, &arg3)) SWIG_fail; + int i; + if (PySequence_Check(obj2)) { + int size = PyObject_Length(obj2); + temp3 = new int[size+1]; // (int*)malloc((size + 1) * sizeof(int)); + for (i = 0; i < size; i++) { + temp3[i] = PyInt_AsLong(PySequence_GetItem(obj2, i)); + } + temp3[size] = 0; + arg3 = temp3; + } } } if (obj3) { { arg4 = &temp4; - if ( ! wxSize_helper(obj3, &arg4)) SWIG_fail; + if ( ! wxPoint_helper(obj3, &arg4)) SWIG_fail; } } if (obj4) { - ecode5 = SWIG_AsVal_long(obj4, &val5); - if (!SWIG_IsOK(ecode5)) { - SWIG_exception_fail(SWIG_ArgError(ecode5), "in method '" "new_GLCanvas" "', expected argument " "5"" of type '" "long""'"); - } - arg5 = static_cast< long >(val5); - } - if (obj5) { { - arg6 = wxString_in_helper(obj5); - if (arg6 == NULL) SWIG_fail; - temp6 = true; + arg5 = &temp5; + if ( ! wxSize_helper(obj4, &arg5)) SWIG_fail; } } + if (obj5) { + ecode6 = SWIG_AsVal_long(obj5, &val6); + if (!SWIG_IsOK(ecode6)) { + SWIG_exception_fail(SWIG_ArgError(ecode6), "in method '" "new_GLCanvas" "', expected argument " "6"" of type '" "long""'"); + } + arg6 = static_cast< long >(val6); + } if (obj6) { { - int i; - if (PySequence_Check(obj6)) { - int size = PyObject_Length(obj6); - temp7 = new int[size+1]; // (int*)malloc((size + 1) * sizeof(int)); - for (i = 0; i < size; i++) { - temp7[i] = PyInt_AsLong(PySequence_GetItem(obj6, i)); - } - temp7[size] = 0; - arg7 = temp7; - } + arg7 = wxString_in_helper(obj6); + if (arg7 == NULL) SWIG_fail; + temp7 = true; } } if (obj7) { @@ -2961,26 +2961,166 @@ SWIGINTERN PyObject *_wrap_new_GLCanvas(PyObject *SWIGUNUSEDPARM(self), PyObject { if (!wxPyCheckForApp()) SWIG_fail; PyThreadState* __tstate = wxPyBeginAllowThreads(); - result = (wxGLCanvas *)new wxGLCanvas(arg1,arg2,(wxPoint const &)*arg3,(wxSize const &)*arg4,arg5,(wxString const &)*arg6,arg7,(wxPalette const &)*arg8); + result = (wxGLCanvas *)new wxGLCanvas(arg1,arg2,(int const *)arg3,(wxPoint const &)*arg4,(wxSize const &)*arg5,arg6,(wxString const &)*arg7,(wxPalette const &)*arg8); wxPyEndAllowThreads(__tstate); if (PyErr_Occurred()) SWIG_fail; } resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_wxGLCanvas, SWIG_POINTER_NEW | 0 ); { - if (temp6) - delete arg6; + delete [] arg3; + } + { + if (temp7) + delete arg7; + } + return resultobj; +fail: + { + delete [] arg3; + } + { + if (temp7) + delete arg7; + } + return NULL; +} + + +SWIGINTERN PyObject *_wrap_GLCanvas_Create(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) { + PyObject *resultobj = 0; + wxGLCanvas *arg1 = (wxGLCanvas *) 0 ; + wxWindow *arg2 = (wxWindow *) 0 ; + int arg3 = (int) wxID_ANY ; + wxPoint const &arg4_defvalue = wxDefaultPosition ; + wxPoint *arg4 = (wxPoint *) &arg4_defvalue ; + wxSize const &arg5_defvalue = wxDefaultSize ; + wxSize *arg5 = (wxSize *) &arg5_defvalue ; + long arg6 = (long) 0 ; + wxString const &arg7_defvalue = wxGLCanvasName ; + wxString *arg7 = (wxString *) &arg7_defvalue ; + int *arg8 = (int *) NULL ; + wxPalette const &arg9_defvalue = wxNullPalette ; + wxPalette *arg9 = (wxPalette *) &arg9_defvalue ; + bool result; + void *argp1 = 0 ; + int res1 = 0 ; + void *argp2 = 0 ; + int res2 = 0 ; + int val3 ; + int ecode3 = 0 ; + wxPoint temp4 ; + wxSize temp5 ; + long val6 ; + int ecode6 = 0 ; + bool temp7 = false ; + int *temp8 ; + void *argp9 = 0 ; + int res9 = 0 ; + PyObject * obj0 = 0 ; + PyObject * obj1 = 0 ; + PyObject * obj2 = 0 ; + PyObject * obj3 = 0 ; + PyObject * obj4 = 0 ; + PyObject * obj5 = 0 ; + PyObject * obj6 = 0 ; + PyObject * obj7 = 0 ; + PyObject * obj8 = 0 ; + char * kwnames[] = { + (char *) "self",(char *) "parent",(char *) "id",(char *) "pos",(char *) "size",(char *) "style",(char *) "name",(char *) "attribList",(char *) "palette", NULL + }; + + if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OO|OOOOOOO:GLCanvas_Create",kwnames,&obj0,&obj1,&obj2,&obj3,&obj4,&obj5,&obj6,&obj7,&obj8)) SWIG_fail; + res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_wxGLCanvas, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "GLCanvas_Create" "', expected argument " "1"" of type '" "wxGLCanvas *""'"); + } + arg1 = reinterpret_cast< wxGLCanvas * >(argp1); + res2 = SWIG_ConvertPtr(obj1, &argp2,SWIGTYPE_p_wxWindow, 0 | 0 ); + if (!SWIG_IsOK(res2)) { + SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "GLCanvas_Create" "', expected argument " "2"" of type '" "wxWindow *""'"); + } + arg2 = reinterpret_cast< wxWindow * >(argp2); + if (obj2) { + ecode3 = SWIG_AsVal_int(obj2, &val3); + if (!SWIG_IsOK(ecode3)) { + SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "GLCanvas_Create" "', expected argument " "3"" of type '" "int""'"); + } + arg3 = static_cast< int >(val3); + } + if (obj3) { + { + arg4 = &temp4; + if ( ! wxPoint_helper(obj3, &arg4)) SWIG_fail; + } + } + if (obj4) { + { + arg5 = &temp5; + if ( ! wxSize_helper(obj4, &arg5)) SWIG_fail; + } + } + if (obj5) { + ecode6 = SWIG_AsVal_long(obj5, &val6); + if (!SWIG_IsOK(ecode6)) { + SWIG_exception_fail(SWIG_ArgError(ecode6), "in method '" "GLCanvas_Create" "', expected argument " "6"" of type '" "long""'"); + } + arg6 = static_cast< long >(val6); + } + if (obj6) { + { + arg7 = wxString_in_helper(obj6); + if (arg7 == NULL) SWIG_fail; + temp7 = true; + } + } + if (obj7) { + { + int i; + if (PySequence_Check(obj7)) { + int size = PyObject_Length(obj7); + temp8 = new int[size+1]; // (int*)malloc((size + 1) * sizeof(int)); + for (i = 0; i < size; i++) { + temp8[i] = PyInt_AsLong(PySequence_GetItem(obj7, i)); + } + temp8[size] = 0; + arg8 = temp8; + } + } + } + if (obj8) { + res9 = SWIG_ConvertPtr(obj8, &argp9, SWIGTYPE_p_wxPalette, 0 | 0); + if (!SWIG_IsOK(res9)) { + SWIG_exception_fail(SWIG_ArgError(res9), "in method '" "GLCanvas_Create" "', expected argument " "9"" of type '" "wxPalette const &""'"); + } + if (!argp9) { + SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "GLCanvas_Create" "', expected argument " "9"" of type '" "wxPalette const &""'"); + } + arg9 = reinterpret_cast< wxPalette * >(argp9); + } + { + PyThreadState* __tstate = wxPyBeginAllowThreads(); + result = (bool)(arg1)->Create(arg2,arg3,(wxPoint const &)*arg4,(wxSize const &)*arg5,arg6,(wxString const &)*arg7,(int const *)arg8,(wxPalette const &)*arg9); + wxPyEndAllowThreads(__tstate); + if (PyErr_Occurred()) SWIG_fail; + } + { + resultobj = result ? Py_True : Py_False; Py_INCREF(resultobj); } { - delete [] arg7; + if (temp7) + delete arg7; + } + { + delete [] arg8; } return resultobj; fail: { - if (temp6) - delete arg6; + if (temp7) + delete arg7; } { - delete [] arg7; + delete [] arg8; } return NULL; } @@ -3102,7 +3242,7 @@ SWIGINTERN PyObject *_wrap_new_GLCanvasWithContext(PyObject *SWIGUNUSEDPARM(self { if (!wxPyCheckForApp()) SWIG_fail; PyThreadState* __tstate = wxPyBeginAllowThreads(); - result = (wxGLCanvas *)new wxGLCanvas(arg1,(wxGLContext const *)arg2,arg3,(wxPoint const &)*arg4,(wxSize const &)*arg5,arg6,(wxString const &)*arg7,arg8,(wxPalette const &)*arg9); + result = (wxGLCanvas *)new wxGLCanvas(arg1,(wxGLContext const *)arg2,arg3,(wxPoint const &)*arg4,(wxSize const &)*arg5,arg6,(wxString const &)*arg7,(int const *)arg8,(wxPalette const &)*arg9); wxPyEndAllowThreads(__tstate); if (PyErr_Occurred()) SWIG_fail; } @@ -3128,31 +3268,6 @@ fail: 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 ; @@ -3188,25 +3303,6 @@ 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 ; @@ -3307,6 +3403,50 @@ fail: } +SWIGINTERN PyObject *_wrap_GLCanvas_SetCurrent__SWIG_1(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(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_1(self, argc, argv); + } + if (argc == 2) { + return _wrap_GLCanvas_SetCurrent__SWIG_0(self, argc, argv); + } + +fail: + SWIG_SetErrorMsg(PyExc_NotImplementedError,"No matching function for overloaded 'GLCanvas_SetCurrent'"); + return NULL; +} + + SWIGINTERN PyObject *GLCanvas_swigregister(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *obj; if (!SWIG_Python_UnpackTuple(args,(char*)"swigregister", 1, 1,&obj)) return NULL; @@ -3325,11 +3465,12 @@ static PyMethodDef SwigMethods[] = { { (char *)"GLContext_swigregister", GLContext_swigregister, METH_VARARGS, NULL}, { (char *)"GLContext_swiginit", GLContext_swiginit, METH_VARARGS, NULL}, { (char *)"new_GLCanvas", (PyCFunction) _wrap_new_GLCanvas, METH_VARARGS | METH_KEYWORDS, NULL}, + { (char *)"GLCanvas_Create", (PyCFunction) _wrap_GLCanvas_Create, METH_VARARGS | METH_KEYWORDS, NULL}, { (char *)"new_GLCanvasWithContext", (PyCFunction) _wrap_new_GLCanvasWithContext, 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}, + { (char *)"GLCanvas_SetCurrent", _wrap_GLCanvas_SetCurrent, METH_VARARGS, NULL}, { (char *)"GLCanvas_swigregister", GLCanvas_swigregister, METH_VARARGS, NULL}, { (char *)"GLCanvas_swiginit", GLCanvas_swiginit, METH_VARARGS, NULL}, { NULL, NULL, 0, NULL } diff --git a/wxPython/contrib/glcanvas/mac/glcanvas.py b/wxPython/contrib/glcanvas/mac/glcanvas.py index 127fe8fb79..d2431e1082 100644 --- a/wxPython/contrib/glcanvas/mac/glcanvas.py +++ b/wxPython/contrib/glcanvas/mac/glcanvas.py @@ -63,10 +63,7 @@ class GLContext(_core.Object): thisown = property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc='The membership flag') __repr__ = _swig_repr def __init__(self, *args, **kwargs): - """ - __init__(self, bool isRGB, GLCanvas win, Palette palette=wxNullPalette, - GLContext other=None) -> GLContext - """ + """__init__(self, GLCanvas win, GLContext other=None) -> GLContext""" _glcanvas.GLContext_swiginit(self,_glcanvas.new_GLContext(*args, **kwargs)) __swig_destroy__ = _glcanvas.delete_GLContext __del__ = lambda self : None; @@ -96,16 +93,21 @@ class GLCanvas(_core.Window): __repr__ = _swig_repr def __init__(self, *args, **kwargs): """ - __init__(self, Window parent, int id=-1, Point pos=DefaultPosition, - Size size=DefaultSize, long style=0, String name=GLCanvasNameStr, - int attribList=None, Palette palette=wxNullPalette) -> GLCanvas + __init__(self, Window parent, int id=-1, int attribList=None, Point pos=DefaultPosition, + Size size=DefaultSize, + long style=0, String name=GLCanvasNameStr, Palette palette=wxNullPalette) -> GLCanvas """ _glcanvas.GLCanvas_swiginit(self,_glcanvas.new_GLCanvas(*args, **kwargs)) self._setOORInfo(self) - def SetCurrent(*args): - """SetCurrent(self)""" - return _glcanvas.GLCanvas_SetCurrent(*args) + def Create(*args, **kwargs): + """ + Create(self, Window parent, int id=ID_ANY, Point pos=DefaultPosition, + Size size=DefaultSize, long style=0, String name=wxGLCanvasName, + int attribList=None, + Palette palette=wxNullPalette) -> bool + """ + return _glcanvas.GLCanvas_Create(*args, **kwargs) def SetColour(*args, **kwargs): """SetColour(self, String colour)""" @@ -119,6 +121,13 @@ class GLCanvas(_core.Window): """GetContext(self) -> GLContext""" return _glcanvas.GLCanvas_GetContext(*args, **kwargs) + def SetCurrent(*args): + """ + SetCurrent(self, GLContext context) + SetCurrent(self) + """ + return _glcanvas.GLCanvas_SetCurrent(*args) + Context = property(GetContext,doc="See `GetContext`") _glcanvas.GLCanvas_swigregister(GLCanvas) diff --git a/wxPython/contrib/glcanvas/mac/glcanvas_wrap.cpp b/wxPython/contrib/glcanvas/mac/glcanvas_wrap.cpp index 243557f58a..cb985c8c60 100644 --- a/wxPython/contrib/glcanvas/mac/glcanvas_wrap.cpp +++ b/wxPython/contrib/glcanvas/mac/glcanvas_wrap.cpp @@ -2663,39 +2663,6 @@ namespace swig { static const wxString wxPyGLCanvasNameStr(wxT("GLCanvas")); static const wxString wxPyEmptyString(wxEmptyString); -SWIGINTERN int -SWIG_AsVal_long (PyObject* obj, long* val) -{ - if (PyNumber_Check(obj)) { - if (val) *val = PyInt_AsLong(obj); - return SWIG_OK; - } - return SWIG_TypeError; -} - - -SWIGINTERN int -SWIG_AsVal_bool (PyObject *obj, bool *val) -{ - if (obj == Py_True) { - if (val) *val = true; - return SWIG_OK; - } else if (obj == Py_False) { - if (val) *val = false; - return SWIG_OK; - } else { - long v = 0; - int res = SWIG_AddCast(SWIG_AsVal_long (obj, val ? &v : 0)); - if (SWIG_IsOK(res) && val) *val = v ? true : false; - return res; - } -} - -SWIGINTERN wxGLContext *new_wxGLContext(bool isRGB,wxGLCanvas *win,wxPalette const &palette=wxNullPalette,wxGLContext const *other=NULL){ - AGLPixelFormat fmt; // TODO: How should this be initialized? - return new wxGLContext(fmt, win, palette, other); - } - #define SWIG_From_long PyInt_FromLong @@ -2718,6 +2685,17 @@ SWIG_From_int (int value) #endif +SWIGINTERN int +SWIG_AsVal_long (PyObject* obj, long* val) +{ + if (PyNumber_Check(obj)) { + if (val) *val = PyInt_AsLong(obj); + return SWIG_OK; + } + return SWIG_TypeError; +} + + SWIGINTERN int SWIG_AsVal_int (PyObject * obj, int *val) { @@ -2758,60 +2736,36 @@ SWIGINTERN PyObject *GLCanvasNameStr_get(void) { SWIGINTERN PyObject *_wrap_new_GLContext(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) { PyObject *resultobj = 0; - bool arg1 ; - wxGLCanvas *arg2 = (wxGLCanvas *) 0 ; - wxPalette const &arg3_defvalue = wxNullPalette ; - wxPalette *arg3 = (wxPalette *) &arg3_defvalue ; - wxGLContext *arg4 = (wxGLContext *) NULL ; + wxGLCanvas *arg1 = (wxGLCanvas *) 0 ; + wxGLContext *arg2 = (wxGLContext *) NULL ; wxGLContext *result = 0 ; - bool val1 ; - int ecode1 = 0 ; + void *argp1 = 0 ; + int res1 = 0 ; void *argp2 = 0 ; int res2 = 0 ; - void *argp3 = 0 ; - int res3 = 0 ; - void *argp4 = 0 ; - int res4 = 0 ; PyObject * obj0 = 0 ; PyObject * obj1 = 0 ; - PyObject * obj2 = 0 ; - PyObject * obj3 = 0 ; char * kwnames[] = { - (char *) "isRGB",(char *) "win",(char *) "palette",(char *) "other", NULL + (char *) "win",(char *) "other", NULL }; - if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OO|OO:new_GLContext",kwnames,&obj0,&obj1,&obj2,&obj3)) SWIG_fail; - ecode1 = SWIG_AsVal_bool(obj0, &val1); - if (!SWIG_IsOK(ecode1)) { - SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "new_GLContext" "', expected argument " "1"" of type '" "bool""'"); - } - arg1 = static_cast< bool >(val1); - res2 = SWIG_ConvertPtr(obj1, &argp2,SWIGTYPE_p_wxGLCanvas, 0 | 0 ); - if (!SWIG_IsOK(res2)) { - SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "new_GLContext" "', expected argument " "2"" of type '" "wxGLCanvas *""'"); - } - arg2 = reinterpret_cast< wxGLCanvas * >(argp2); - if (obj2) { - res3 = SWIG_ConvertPtr(obj2, &argp3, SWIGTYPE_p_wxPalette, 0 | 0); - if (!SWIG_IsOK(res3)) { - SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "new_GLContext" "', expected argument " "3"" of type '" "wxPalette const &""'"); - } - if (!argp3) { - SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "new_GLContext" "', expected argument " "3"" of type '" "wxPalette const &""'"); - } - arg3 = reinterpret_cast< wxPalette * >(argp3); + if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"O|O:new_GLContext",kwnames,&obj0,&obj1)) SWIG_fail; + res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_wxGLCanvas, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "new_GLContext" "', expected argument " "1"" of type '" "wxGLCanvas *""'"); } - if (obj3) { - res4 = SWIG_ConvertPtr(obj3, &argp4,SWIGTYPE_p_wxGLContext, 0 | 0 ); - if (!SWIG_IsOK(res4)) { - SWIG_exception_fail(SWIG_ArgError(res4), "in method '" "new_GLContext" "', expected argument " "4"" of type '" "wxGLContext const *""'"); + arg1 = reinterpret_cast< wxGLCanvas * >(argp1); + if (obj1) { + res2 = SWIG_ConvertPtr(obj1, &argp2,SWIGTYPE_p_wxGLContext, 0 | 0 ); + if (!SWIG_IsOK(res2)) { + SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "new_GLContext" "', expected argument " "2"" of type '" "wxGLContext const *""'"); } - arg4 = reinterpret_cast< wxGLContext * >(argp4); + arg2 = reinterpret_cast< wxGLContext * >(argp2); } { if (!wxPyCheckForApp()) SWIG_fail; PyThreadState* __tstate = wxPyBeginAllowThreads(); - result = (wxGLContext *)new_wxGLContext(arg1,arg2,(wxPalette const &)*arg3,(wxGLContext const *)arg4); + result = (wxGLContext *)new wxGLContext(arg1,(wxGLContext const *)arg2); wxPyEndAllowThreads(__tstate); if (PyErr_Occurred()) SWIG_fail; } @@ -2865,14 +2819,14 @@ SWIGINTERN PyObject *_wrap_new_GLCanvas(PyObject *SWIGUNUSEDPARM(self), PyObject PyObject *resultobj = 0; wxWindow *arg1 = (wxWindow *) 0 ; int arg2 = (int) -1 ; - wxPoint const &arg3_defvalue = wxDefaultPosition ; - wxPoint *arg3 = (wxPoint *) &arg3_defvalue ; - wxSize const &arg4_defvalue = wxDefaultSize ; - wxSize *arg4 = (wxSize *) &arg4_defvalue ; - long arg5 = (long) 0 ; - wxString const &arg6_defvalue = wxPyGLCanvasNameStr ; - wxString *arg6 = (wxString *) &arg6_defvalue ; - int *arg7 = (int *) NULL ; + int *arg3 = (int *) NULL ; + wxPoint const &arg4_defvalue = wxDefaultPosition ; + wxPoint *arg4 = (wxPoint *) &arg4_defvalue ; + wxSize const &arg5_defvalue = wxDefaultSize ; + wxSize *arg5 = (wxSize *) &arg5_defvalue ; + long arg6 = (long) 0 ; + wxString const &arg7_defvalue = wxPyGLCanvasNameStr ; + wxString *arg7 = (wxString *) &arg7_defvalue ; wxPalette const &arg8_defvalue = wxNullPalette ; wxPalette *arg8 = (wxPalette *) &arg8_defvalue ; wxGLCanvas *result = 0 ; @@ -2880,12 +2834,12 @@ SWIGINTERN PyObject *_wrap_new_GLCanvas(PyObject *SWIGUNUSEDPARM(self), PyObject int res1 = 0 ; int val2 ; int ecode2 = 0 ; - wxPoint temp3 ; - wxSize temp4 ; - long val5 ; - int ecode5 = 0 ; - bool temp6 = false ; - int *temp7 ; + int *temp3 ; + wxPoint temp4 ; + wxSize temp5 ; + long val6 ; + int ecode6 = 0 ; + bool temp7 = false ; void *argp8 = 0 ; int res8 = 0 ; PyObject * obj0 = 0 ; @@ -2897,7 +2851,7 @@ SWIGINTERN PyObject *_wrap_new_GLCanvas(PyObject *SWIGUNUSEDPARM(self), PyObject PyObject * obj6 = 0 ; PyObject * obj7 = 0 ; char * kwnames[] = { - (char *) "parent",(char *) "id",(char *) "pos",(char *) "size",(char *) "style",(char *) "name",(char *) "attribList",(char *) "palette", NULL + (char *) "parent",(char *) "id",(char *) "attribList",(char *) "pos",(char *) "size",(char *) "style",(char *) "name",(char *) "palette", NULL }; if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"O|OOOOOOO:new_GLCanvas",kwnames,&obj0,&obj1,&obj2,&obj3,&obj4,&obj5,&obj6,&obj7)) SWIG_fail; @@ -2915,42 +2869,42 @@ SWIGINTERN PyObject *_wrap_new_GLCanvas(PyObject *SWIGUNUSEDPARM(self), PyObject } if (obj2) { { - arg3 = &temp3; - if ( ! wxPoint_helper(obj2, &arg3)) SWIG_fail; + int i; + if (PySequence_Check(obj2)) { + int size = PyObject_Length(obj2); + temp3 = new int[size+1]; // (int*)malloc((size + 1) * sizeof(int)); + for (i = 0; i < size; i++) { + temp3[i] = PyInt_AsLong(PySequence_GetItem(obj2, i)); + } + temp3[size] = 0; + arg3 = temp3; + } } } if (obj3) { { arg4 = &temp4; - if ( ! wxSize_helper(obj3, &arg4)) SWIG_fail; + if ( ! wxPoint_helper(obj3, &arg4)) SWIG_fail; } } if (obj4) { - ecode5 = SWIG_AsVal_long(obj4, &val5); - if (!SWIG_IsOK(ecode5)) { - SWIG_exception_fail(SWIG_ArgError(ecode5), "in method '" "new_GLCanvas" "', expected argument " "5"" of type '" "long""'"); - } - arg5 = static_cast< long >(val5); - } - if (obj5) { { - arg6 = wxString_in_helper(obj5); - if (arg6 == NULL) SWIG_fail; - temp6 = true; + arg5 = &temp5; + if ( ! wxSize_helper(obj4, &arg5)) SWIG_fail; } } + if (obj5) { + ecode6 = SWIG_AsVal_long(obj5, &val6); + if (!SWIG_IsOK(ecode6)) { + SWIG_exception_fail(SWIG_ArgError(ecode6), "in method '" "new_GLCanvas" "', expected argument " "6"" of type '" "long""'"); + } + arg6 = static_cast< long >(val6); + } if (obj6) { { - int i; - if (PySequence_Check(obj6)) { - int size = PyObject_Length(obj6); - temp7 = new int[size+1]; // (int*)malloc((size + 1) * sizeof(int)); - for (i = 0; i < size; i++) { - temp7[i] = PyInt_AsLong(PySequence_GetItem(obj6, i)); - } - temp7[size] = 0; - arg7 = temp7; - } + arg7 = wxString_in_helper(obj6); + if (arg7 == NULL) SWIG_fail; + temp7 = true; } } if (obj7) { @@ -2966,26 +2920,166 @@ SWIGINTERN PyObject *_wrap_new_GLCanvas(PyObject *SWIGUNUSEDPARM(self), PyObject { if (!wxPyCheckForApp()) SWIG_fail; PyThreadState* __tstate = wxPyBeginAllowThreads(); - result = (wxGLCanvas *)new wxGLCanvas(arg1,arg2,(wxPoint const &)*arg3,(wxSize const &)*arg4,arg5,(wxString const &)*arg6,arg7,(wxPalette const &)*arg8); + result = (wxGLCanvas *)new wxGLCanvas(arg1,arg2,(int const *)arg3,(wxPoint const &)*arg4,(wxSize const &)*arg5,arg6,(wxString const &)*arg7,(wxPalette const &)*arg8); wxPyEndAllowThreads(__tstate); if (PyErr_Occurred()) SWIG_fail; } resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_wxGLCanvas, SWIG_POINTER_NEW | 0 ); { - if (temp6) - delete arg6; + delete [] arg3; + } + { + if (temp7) + delete arg7; + } + return resultobj; +fail: + { + delete [] arg3; + } + { + if (temp7) + delete arg7; + } + return NULL; +} + + +SWIGINTERN PyObject *_wrap_GLCanvas_Create(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) { + PyObject *resultobj = 0; + wxGLCanvas *arg1 = (wxGLCanvas *) 0 ; + wxWindow *arg2 = (wxWindow *) 0 ; + int arg3 = (int) wxID_ANY ; + wxPoint const &arg4_defvalue = wxDefaultPosition ; + wxPoint *arg4 = (wxPoint *) &arg4_defvalue ; + wxSize const &arg5_defvalue = wxDefaultSize ; + wxSize *arg5 = (wxSize *) &arg5_defvalue ; + long arg6 = (long) 0 ; + wxString const &arg7_defvalue = wxGLCanvasName ; + wxString *arg7 = (wxString *) &arg7_defvalue ; + int *arg8 = (int *) NULL ; + wxPalette const &arg9_defvalue = wxNullPalette ; + wxPalette *arg9 = (wxPalette *) &arg9_defvalue ; + bool result; + void *argp1 = 0 ; + int res1 = 0 ; + void *argp2 = 0 ; + int res2 = 0 ; + int val3 ; + int ecode3 = 0 ; + wxPoint temp4 ; + wxSize temp5 ; + long val6 ; + int ecode6 = 0 ; + bool temp7 = false ; + int *temp8 ; + void *argp9 = 0 ; + int res9 = 0 ; + PyObject * obj0 = 0 ; + PyObject * obj1 = 0 ; + PyObject * obj2 = 0 ; + PyObject * obj3 = 0 ; + PyObject * obj4 = 0 ; + PyObject * obj5 = 0 ; + PyObject * obj6 = 0 ; + PyObject * obj7 = 0 ; + PyObject * obj8 = 0 ; + char * kwnames[] = { + (char *) "self",(char *) "parent",(char *) "id",(char *) "pos",(char *) "size",(char *) "style",(char *) "name",(char *) "attribList",(char *) "palette", NULL + }; + + if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OO|OOOOOOO:GLCanvas_Create",kwnames,&obj0,&obj1,&obj2,&obj3,&obj4,&obj5,&obj6,&obj7,&obj8)) SWIG_fail; + res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_wxGLCanvas, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "GLCanvas_Create" "', expected argument " "1"" of type '" "wxGLCanvas *""'"); + } + arg1 = reinterpret_cast< wxGLCanvas * >(argp1); + res2 = SWIG_ConvertPtr(obj1, &argp2,SWIGTYPE_p_wxWindow, 0 | 0 ); + if (!SWIG_IsOK(res2)) { + SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "GLCanvas_Create" "', expected argument " "2"" of type '" "wxWindow *""'"); + } + arg2 = reinterpret_cast< wxWindow * >(argp2); + if (obj2) { + ecode3 = SWIG_AsVal_int(obj2, &val3); + if (!SWIG_IsOK(ecode3)) { + SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "GLCanvas_Create" "', expected argument " "3"" of type '" "int""'"); + } + arg3 = static_cast< int >(val3); + } + if (obj3) { + { + arg4 = &temp4; + if ( ! wxPoint_helper(obj3, &arg4)) SWIG_fail; + } + } + if (obj4) { + { + arg5 = &temp5; + if ( ! wxSize_helper(obj4, &arg5)) SWIG_fail; + } + } + if (obj5) { + ecode6 = SWIG_AsVal_long(obj5, &val6); + if (!SWIG_IsOK(ecode6)) { + SWIG_exception_fail(SWIG_ArgError(ecode6), "in method '" "GLCanvas_Create" "', expected argument " "6"" of type '" "long""'"); + } + arg6 = static_cast< long >(val6); + } + if (obj6) { + { + arg7 = wxString_in_helper(obj6); + if (arg7 == NULL) SWIG_fail; + temp7 = true; + } + } + if (obj7) { + { + int i; + if (PySequence_Check(obj7)) { + int size = PyObject_Length(obj7); + temp8 = new int[size+1]; // (int*)malloc((size + 1) * sizeof(int)); + for (i = 0; i < size; i++) { + temp8[i] = PyInt_AsLong(PySequence_GetItem(obj7, i)); + } + temp8[size] = 0; + arg8 = temp8; + } + } + } + if (obj8) { + res9 = SWIG_ConvertPtr(obj8, &argp9, SWIGTYPE_p_wxPalette, 0 | 0); + if (!SWIG_IsOK(res9)) { + SWIG_exception_fail(SWIG_ArgError(res9), "in method '" "GLCanvas_Create" "', expected argument " "9"" of type '" "wxPalette const &""'"); + } + if (!argp9) { + SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "GLCanvas_Create" "', expected argument " "9"" of type '" "wxPalette const &""'"); + } + arg9 = reinterpret_cast< wxPalette * >(argp9); + } + { + PyThreadState* __tstate = wxPyBeginAllowThreads(); + result = (bool)(arg1)->Create(arg2,arg3,(wxPoint const &)*arg4,(wxSize const &)*arg5,arg6,(wxString const &)*arg7,(int const *)arg8,(wxPalette const &)*arg9); + wxPyEndAllowThreads(__tstate); + if (PyErr_Occurred()) SWIG_fail; + } + { + resultobj = result ? Py_True : Py_False; Py_INCREF(resultobj); + } + { + if (temp7) + delete arg7; } { - delete [] arg7; + delete [] arg8; } return resultobj; fail: { - if (temp6) - delete arg6; + if (temp7) + delete arg7; } { - delete [] arg7; + delete [] arg8; } return NULL; } @@ -3107,7 +3201,7 @@ SWIGINTERN PyObject *_wrap_new_GLCanvasWithContext(PyObject *SWIGUNUSEDPARM(self { if (!wxPyCheckForApp()) SWIG_fail; PyThreadState* __tstate = wxPyBeginAllowThreads(); - result = (wxGLCanvas *)new wxGLCanvas(arg1,(wxGLContext const *)arg2,arg3,(wxPoint const &)*arg4,(wxSize const &)*arg5,arg6,(wxString const &)*arg7,arg8,(wxPalette const &)*arg9); + result = (wxGLCanvas *)new wxGLCanvas(arg1,(wxGLContext const *)arg2,arg3,(wxPoint const &)*arg4,(wxSize const &)*arg5,arg6,(wxString const &)*arg7,(int const *)arg8,(wxPalette const &)*arg9); wxPyEndAllowThreads(__tstate); if (PyErr_Occurred()) SWIG_fail; } @@ -3132,23 +3226,32 @@ fail: } -SWIGINTERN PyObject *_wrap_GLCanvas_SetCurrent(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { +SWIGINTERN PyObject *_wrap_GLCanvas_SetCurrent__SWIG_0(PyObject *SWIGUNUSEDPARM(self), int nobjs, PyObject **swig_obj) { PyObject *resultobj = 0; wxGLCanvas *arg1 = (wxGLCanvas *) 0 ; + wxGLContext *arg2 = 0 ; void *argp1 = 0 ; int res1 = 0 ; - PyObject *swig_obj[1] ; + void *argp2 = 0 ; + int res2 = 0 ; - if (!args) SWIG_fail; - swig_obj[0] = args; + 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(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 &""'"); + } + if (!argp2) { + SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "GLCanvas_SetCurrent" "', expected argument " "2"" of type '" "wxGLContext const &""'"); + } + arg2 = reinterpret_cast< wxGLContext * >(argp2); { PyThreadState* __tstate = wxPyBeginAllowThreads(); - (arg1)->SetCurrent(); + (arg1)->SetCurrent((wxGLContext const &)*arg2); wxPyEndAllowThreads(__tstate); if (PyErr_Occurred()) SWIG_fail; } @@ -3259,6 +3362,50 @@ fail: } +SWIGINTERN PyObject *_wrap_GLCanvas_SetCurrent__SWIG_1(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(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_1(self, argc, argv); + } + if (argc == 2) { + return _wrap_GLCanvas_SetCurrent__SWIG_0(self, argc, argv); + } + +fail: + SWIG_SetErrorMsg(PyExc_NotImplementedError,"No matching function for overloaded 'GLCanvas_SetCurrent'"); + return NULL; +} + + SWIGINTERN PyObject *GLCanvas_swigregister(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *obj; if (!SWIG_Python_UnpackTuple(args,(char*)"swigregister", 1, 1,&obj)) return NULL; @@ -3276,11 +3423,12 @@ static PyMethodDef SwigMethods[] = { { (char *)"GLContext_swigregister", GLContext_swigregister, METH_VARARGS, NULL}, { (char *)"GLContext_swiginit", GLContext_swiginit, METH_VARARGS, NULL}, { (char *)"new_GLCanvas", (PyCFunction) _wrap_new_GLCanvas, METH_VARARGS | METH_KEYWORDS, NULL}, + { (char *)"GLCanvas_Create", (PyCFunction) _wrap_GLCanvas_Create, 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_O, 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}, + { (char *)"GLCanvas_SetCurrent", _wrap_GLCanvas_SetCurrent, METH_VARARGS, NULL}, { (char *)"GLCanvas_swigregister", GLCanvas_swigregister, METH_VARARGS, NULL}, { (char *)"GLCanvas_swiginit", GLCanvas_swiginit, METH_VARARGS, NULL}, { NULL, NULL, 0, NULL } diff --git a/wxPython/contrib/glcanvas/msw/glcanvas.py b/wxPython/contrib/glcanvas/msw/glcanvas.py index dabff1a972..55eb961e27 100644 --- a/wxPython/contrib/glcanvas/msw/glcanvas.py +++ b/wxPython/contrib/glcanvas/msw/glcanvas.py @@ -97,19 +97,21 @@ class GLCanvas(_core.Window): __repr__ = _swig_repr def __init__(self, *args, **kwargs): """ - __init__(self, Window parent, int id=-1, Point pos=DefaultPosition, - Size size=DefaultSize, long style=0, String name=GLCanvasNameStr, - int attribList=None, Palette palette=wxNullPalette) -> GLCanvas + __init__(self, Window parent, int id=-1, int attribList=None, Point pos=DefaultPosition, + Size size=DefaultSize, + long style=0, String name=GLCanvasNameStr, Palette palette=wxNullPalette) -> GLCanvas """ _glcanvas.GLCanvas_swiginit(self,_glcanvas.new_GLCanvas(*args, **kwargs)) self._setOORInfo(self) - def SetCurrent(*args): + def Create(*args, **kwargs): """ - SetCurrent(self) - SetCurrent(self, GLContext RC) + Create(self, Window parent, int id=ID_ANY, Point pos=DefaultPosition, + Size size=DefaultSize, long style=0, String name=wxGLCanvasName, + int attribList=None, + Palette palette=wxNullPalette) -> bool """ - return _glcanvas.GLCanvas_SetCurrent(*args) + return _glcanvas.GLCanvas_Create(*args, **kwargs) def SetColour(*args, **kwargs): """SetColour(self, String colour)""" @@ -123,9 +125,12 @@ class GLCanvas(_core.Window): """GetContext(self) -> GLContext""" return _glcanvas.GLCanvas_GetContext(*args, **kwargs) - def SetupPixelFormat(*args, **kwargs): - """SetupPixelFormat(self, int attribList=None)""" - return _glcanvas.GLCanvas_SetupPixelFormat(*args, **kwargs) + def SetCurrent(*args): + """ + SetCurrent(self, GLContext context) + SetCurrent(self) + """ + return _glcanvas.GLCanvas_SetCurrent(*args) def SetupPalette(*args, **kwargs): """SetupPalette(self, Palette palette)""" diff --git a/wxPython/contrib/glcanvas/msw/glcanvas_wrap.cpp b/wxPython/contrib/glcanvas/msw/glcanvas_wrap.cpp index e79be157d2..14b026282d 100644 --- a/wxPython/contrib/glcanvas/msw/glcanvas_wrap.cpp +++ b/wxPython/contrib/glcanvas/msw/glcanvas_wrap.cpp @@ -2860,14 +2860,14 @@ SWIGINTERN PyObject *_wrap_new_GLCanvas(PyObject *SWIGUNUSEDPARM(self), PyObject PyObject *resultobj = 0; wxWindow *arg1 = (wxWindow *) 0 ; int arg2 = (int) -1 ; - wxPoint const &arg3_defvalue = wxDefaultPosition ; - wxPoint *arg3 = (wxPoint *) &arg3_defvalue ; - wxSize const &arg4_defvalue = wxDefaultSize ; - wxSize *arg4 = (wxSize *) &arg4_defvalue ; - long arg5 = (long) 0 ; - wxString const &arg6_defvalue = wxPyGLCanvasNameStr ; - wxString *arg6 = (wxString *) &arg6_defvalue ; - int *arg7 = (int *) NULL ; + int *arg3 = (int *) NULL ; + wxPoint const &arg4_defvalue = wxDefaultPosition ; + wxPoint *arg4 = (wxPoint *) &arg4_defvalue ; + wxSize const &arg5_defvalue = wxDefaultSize ; + wxSize *arg5 = (wxSize *) &arg5_defvalue ; + long arg6 = (long) 0 ; + wxString const &arg7_defvalue = wxPyGLCanvasNameStr ; + wxString *arg7 = (wxString *) &arg7_defvalue ; wxPalette const &arg8_defvalue = wxNullPalette ; wxPalette *arg8 = (wxPalette *) &arg8_defvalue ; wxGLCanvas *result = 0 ; @@ -2875,12 +2875,12 @@ SWIGINTERN PyObject *_wrap_new_GLCanvas(PyObject *SWIGUNUSEDPARM(self), PyObject int res1 = 0 ; int val2 ; int ecode2 = 0 ; - wxPoint temp3 ; - wxSize temp4 ; - long val5 ; - int ecode5 = 0 ; - bool temp6 = false ; - int *temp7 ; + int *temp3 ; + wxPoint temp4 ; + wxSize temp5 ; + long val6 ; + int ecode6 = 0 ; + bool temp7 = false ; void *argp8 = 0 ; int res8 = 0 ; PyObject * obj0 = 0 ; @@ -2892,7 +2892,7 @@ SWIGINTERN PyObject *_wrap_new_GLCanvas(PyObject *SWIGUNUSEDPARM(self), PyObject PyObject * obj6 = 0 ; PyObject * obj7 = 0 ; char * kwnames[] = { - (char *) "parent",(char *) "id",(char *) "pos",(char *) "size",(char *) "style",(char *) "name",(char *) "attribList",(char *) "palette", NULL + (char *) "parent",(char *) "id",(char *) "attribList",(char *) "pos",(char *) "size",(char *) "style",(char *) "name",(char *) "palette", NULL }; if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"O|OOOOOOO:new_GLCanvas",kwnames,&obj0,&obj1,&obj2,&obj3,&obj4,&obj5,&obj6,&obj7)) SWIG_fail; @@ -2910,42 +2910,42 @@ SWIGINTERN PyObject *_wrap_new_GLCanvas(PyObject *SWIGUNUSEDPARM(self), PyObject } if (obj2) { { - arg3 = &temp3; - if ( ! wxPoint_helper(obj2, &arg3)) SWIG_fail; + int i; + if (PySequence_Check(obj2)) { + int size = PyObject_Length(obj2); + temp3 = new int[size+1]; // (int*)malloc((size + 1) * sizeof(int)); + for (i = 0; i < size; i++) { + temp3[i] = PyInt_AsLong(PySequence_GetItem(obj2, i)); + } + temp3[size] = 0; + arg3 = temp3; + } } } if (obj3) { { arg4 = &temp4; - if ( ! wxSize_helper(obj3, &arg4)) SWIG_fail; + if ( ! wxPoint_helper(obj3, &arg4)) SWIG_fail; } } if (obj4) { - ecode5 = SWIG_AsVal_long(obj4, &val5); - if (!SWIG_IsOK(ecode5)) { - SWIG_exception_fail(SWIG_ArgError(ecode5), "in method '" "new_GLCanvas" "', expected argument " "5"" of type '" "long""'"); - } - arg5 = static_cast< long >(val5); - } - if (obj5) { { - arg6 = wxString_in_helper(obj5); - if (arg6 == NULL) SWIG_fail; - temp6 = true; + arg5 = &temp5; + if ( ! wxSize_helper(obj4, &arg5)) SWIG_fail; } } + if (obj5) { + ecode6 = SWIG_AsVal_long(obj5, &val6); + if (!SWIG_IsOK(ecode6)) { + SWIG_exception_fail(SWIG_ArgError(ecode6), "in method '" "new_GLCanvas" "', expected argument " "6"" of type '" "long""'"); + } + arg6 = static_cast< long >(val6); + } if (obj6) { { - int i; - if (PySequence_Check(obj6)) { - int size = PyObject_Length(obj6); - temp7 = new int[size+1]; // (int*)malloc((size + 1) * sizeof(int)); - for (i = 0; i < size; i++) { - temp7[i] = PyInt_AsLong(PySequence_GetItem(obj6, i)); - } - temp7[size] = 0; - arg7 = temp7; - } + arg7 = wxString_in_helper(obj6); + if (arg7 == NULL) SWIG_fail; + temp7 = true; } } if (obj7) { @@ -2961,26 +2961,166 @@ SWIGINTERN PyObject *_wrap_new_GLCanvas(PyObject *SWIGUNUSEDPARM(self), PyObject { if (!wxPyCheckForApp()) SWIG_fail; PyThreadState* __tstate = wxPyBeginAllowThreads(); - result = (wxGLCanvas *)new wxGLCanvas(arg1,arg2,(wxPoint const &)*arg3,(wxSize const &)*arg4,arg5,(wxString const &)*arg6,arg7,(wxPalette const &)*arg8); + result = (wxGLCanvas *)new wxGLCanvas(arg1,arg2,(int const *)arg3,(wxPoint const &)*arg4,(wxSize const &)*arg5,arg6,(wxString const &)*arg7,(wxPalette const &)*arg8); wxPyEndAllowThreads(__tstate); if (PyErr_Occurred()) SWIG_fail; } resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_wxGLCanvas, SWIG_POINTER_NEW | 0 ); { - if (temp6) - delete arg6; + delete [] arg3; } { - delete [] arg7; + if (temp7) + delete arg7; } return resultobj; fail: { - if (temp6) - delete arg6; + delete [] arg3; } { - delete [] arg7; + if (temp7) + delete arg7; + } + return NULL; +} + + +SWIGINTERN PyObject *_wrap_GLCanvas_Create(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) { + PyObject *resultobj = 0; + wxGLCanvas *arg1 = (wxGLCanvas *) 0 ; + wxWindow *arg2 = (wxWindow *) 0 ; + int arg3 = (int) wxID_ANY ; + wxPoint const &arg4_defvalue = wxDefaultPosition ; + wxPoint *arg4 = (wxPoint *) &arg4_defvalue ; + wxSize const &arg5_defvalue = wxDefaultSize ; + wxSize *arg5 = (wxSize *) &arg5_defvalue ; + long arg6 = (long) 0 ; + wxString const &arg7_defvalue = wxGLCanvasName ; + wxString *arg7 = (wxString *) &arg7_defvalue ; + int *arg8 = (int *) NULL ; + wxPalette const &arg9_defvalue = wxNullPalette ; + wxPalette *arg9 = (wxPalette *) &arg9_defvalue ; + bool result; + void *argp1 = 0 ; + int res1 = 0 ; + void *argp2 = 0 ; + int res2 = 0 ; + int val3 ; + int ecode3 = 0 ; + wxPoint temp4 ; + wxSize temp5 ; + long val6 ; + int ecode6 = 0 ; + bool temp7 = false ; + int *temp8 ; + void *argp9 = 0 ; + int res9 = 0 ; + PyObject * obj0 = 0 ; + PyObject * obj1 = 0 ; + PyObject * obj2 = 0 ; + PyObject * obj3 = 0 ; + PyObject * obj4 = 0 ; + PyObject * obj5 = 0 ; + PyObject * obj6 = 0 ; + PyObject * obj7 = 0 ; + PyObject * obj8 = 0 ; + char * kwnames[] = { + (char *) "self",(char *) "parent",(char *) "id",(char *) "pos",(char *) "size",(char *) "style",(char *) "name",(char *) "attribList",(char *) "palette", NULL + }; + + if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OO|OOOOOOO:GLCanvas_Create",kwnames,&obj0,&obj1,&obj2,&obj3,&obj4,&obj5,&obj6,&obj7,&obj8)) SWIG_fail; + res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_wxGLCanvas, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "GLCanvas_Create" "', expected argument " "1"" of type '" "wxGLCanvas *""'"); + } + arg1 = reinterpret_cast< wxGLCanvas * >(argp1); + res2 = SWIG_ConvertPtr(obj1, &argp2,SWIGTYPE_p_wxWindow, 0 | 0 ); + if (!SWIG_IsOK(res2)) { + SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "GLCanvas_Create" "', expected argument " "2"" of type '" "wxWindow *""'"); + } + arg2 = reinterpret_cast< wxWindow * >(argp2); + if (obj2) { + ecode3 = SWIG_AsVal_int(obj2, &val3); + if (!SWIG_IsOK(ecode3)) { + SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "GLCanvas_Create" "', expected argument " "3"" of type '" "int""'"); + } + arg3 = static_cast< int >(val3); + } + if (obj3) { + { + arg4 = &temp4; + if ( ! wxPoint_helper(obj3, &arg4)) SWIG_fail; + } + } + if (obj4) { + { + arg5 = &temp5; + if ( ! wxSize_helper(obj4, &arg5)) SWIG_fail; + } + } + if (obj5) { + ecode6 = SWIG_AsVal_long(obj5, &val6); + if (!SWIG_IsOK(ecode6)) { + SWIG_exception_fail(SWIG_ArgError(ecode6), "in method '" "GLCanvas_Create" "', expected argument " "6"" of type '" "long""'"); + } + arg6 = static_cast< long >(val6); + } + if (obj6) { + { + arg7 = wxString_in_helper(obj6); + if (arg7 == NULL) SWIG_fail; + temp7 = true; + } + } + if (obj7) { + { + int i; + if (PySequence_Check(obj7)) { + int size = PyObject_Length(obj7); + temp8 = new int[size+1]; // (int*)malloc((size + 1) * sizeof(int)); + for (i = 0; i < size; i++) { + temp8[i] = PyInt_AsLong(PySequence_GetItem(obj7, i)); + } + temp8[size] = 0; + arg8 = temp8; + } + } + } + if (obj8) { + res9 = SWIG_ConvertPtr(obj8, &argp9, SWIGTYPE_p_wxPalette, 0 | 0); + if (!SWIG_IsOK(res9)) { + SWIG_exception_fail(SWIG_ArgError(res9), "in method '" "GLCanvas_Create" "', expected argument " "9"" of type '" "wxPalette const &""'"); + } + if (!argp9) { + SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "GLCanvas_Create" "', expected argument " "9"" of type '" "wxPalette const &""'"); + } + arg9 = reinterpret_cast< wxPalette * >(argp9); + } + { + PyThreadState* __tstate = wxPyBeginAllowThreads(); + result = (bool)(arg1)->Create(arg2,arg3,(wxPoint const &)*arg4,(wxSize const &)*arg5,arg6,(wxString const &)*arg7,(int const *)arg8,(wxPalette const &)*arg9); + wxPyEndAllowThreads(__tstate); + if (PyErr_Occurred()) SWIG_fail; + } + { + resultobj = result ? Py_True : Py_False; Py_INCREF(resultobj); + } + { + if (temp7) + delete arg7; + } + { + delete [] arg8; + } + return resultobj; +fail: + { + if (temp7) + delete arg7; + } + { + delete [] arg8; } return NULL; } @@ -3102,7 +3242,7 @@ SWIGINTERN PyObject *_wrap_new_GLCanvasWithContext(PyObject *SWIGUNUSEDPARM(self { if (!wxPyCheckForApp()) SWIG_fail; PyThreadState* __tstate = wxPyBeginAllowThreads(); - result = (wxGLCanvas *)new wxGLCanvas(arg1,(wxGLContext const *)arg2,arg3,(wxPoint const &)*arg4,(wxSize const &)*arg5,arg6,(wxString const &)*arg7,arg8,(wxPalette const &)*arg9); + result = (wxGLCanvas *)new wxGLCanvas(arg1,(wxGLContext const *)arg2,arg3,(wxPoint const &)*arg4,(wxSize const &)*arg5,arg6,(wxString const &)*arg7,(int const *)arg8,(wxPalette const &)*arg9); wxPyEndAllowThreads(__tstate); if (PyErr_Occurred()) SWIG_fail; } @@ -3128,31 +3268,6 @@ fail: 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 ; @@ -3188,25 +3303,6 @@ 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 ; @@ -3307,54 +3403,46 @@ fail: } -SWIGINTERN PyObject *_wrap_GLCanvas_SetupPixelFormat(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) { +SWIGINTERN PyObject *_wrap_GLCanvas_SetCurrent__SWIG_1(PyObject *SWIGUNUSEDPARM(self), int nobjs, PyObject **swig_obj) { PyObject *resultobj = 0; wxGLCanvas *arg1 = (wxGLCanvas *) 0 ; - int *arg2 = (int *) NULL ; void *argp1 = 0 ; int res1 = 0 ; - int *temp2 ; - PyObject * obj0 = 0 ; - PyObject * obj1 = 0 ; - char * kwnames[] = { - (char *) "self",(char *) "attribList", NULL - }; - if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"O|O:GLCanvas_SetupPixelFormat",kwnames,&obj0,&obj1)) SWIG_fail; - res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_wxGLCanvas, 0 | 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_SetupPixelFormat" "', expected argument " "1"" of type '" "wxGLCanvas *""'"); + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "GLCanvas_SetCurrent" "', expected argument " "1"" of type '" "wxGLCanvas *""'"); } arg1 = reinterpret_cast< wxGLCanvas * >(argp1); - if (obj1) { - { - int i; - if (PySequence_Check(obj1)) { - int size = PyObject_Length(obj1); - temp2 = new int[size+1]; // (int*)malloc((size + 1) * sizeof(int)); - for (i = 0; i < size; i++) { - temp2[i] = PyInt_AsLong(PySequence_GetItem(obj1, i)); - } - temp2[size] = 0; - arg2 = temp2; - } - } - } { PyThreadState* __tstate = wxPyBeginAllowThreads(); - (arg1)->SetupPixelFormat(arg2); + (arg1)->SetCurrent(); wxPyEndAllowThreads(__tstate); if (PyErr_Occurred()) SWIG_fail; } resultobj = SWIG_Py_Void(); - { - delete [] arg2; - } return resultobj; fail: - { - delete [] arg2; + return NULL; +} + + +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_1(self, argc, argv); } + if (argc == 2) { + return _wrap_GLCanvas_SetCurrent__SWIG_0(self, argc, argv); + } + +fail: + SWIG_SetErrorMsg(PyExc_NotImplementedError,"No matching function for overloaded 'GLCanvas_SetCurrent'"); return NULL; } @@ -3474,12 +3562,12 @@ static PyMethodDef SwigMethods[] = { { (char *)"GLContext_swigregister", GLContext_swigregister, METH_VARARGS, NULL}, { (char *)"GLContext_swiginit", GLContext_swiginit, METH_VARARGS, NULL}, { (char *)"new_GLCanvas", (PyCFunction) _wrap_new_GLCanvas, METH_VARARGS | METH_KEYWORDS, NULL}, + { (char *)"GLCanvas_Create", (PyCFunction) _wrap_GLCanvas_Create, METH_VARARGS | METH_KEYWORDS, NULL}, { (char *)"new_GLCanvasWithContext", (PyCFunction) _wrap_new_GLCanvasWithContext, 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}, - { (char *)"GLCanvas_SetupPixelFormat", (PyCFunction) _wrap_GLCanvas_SetupPixelFormat, METH_VARARGS | METH_KEYWORDS, NULL}, + { (char *)"GLCanvas_SetCurrent", _wrap_GLCanvas_SetCurrent, METH_VARARGS, NULL}, { (char *)"GLCanvas_SetupPalette", (PyCFunction) _wrap_GLCanvas_SetupPalette, METH_VARARGS | METH_KEYWORDS, NULL}, { (char *)"GLCanvas_CreateDefaultPalette", (PyCFunction)_wrap_GLCanvas_CreateDefaultPalette, METH_O, NULL}, { (char *)"GLCanvas_GetPalette", (PyCFunction)_wrap_GLCanvas_GetPalette, METH_O, NULL}, -- 2.45.2