X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/9fd4be5571cbbbeaa6c4f7dabcc2ba69fe1e3471..a333120784e3b3af222c4dd95ed383288bd1a2e0:/wxPython/contrib/glcanvas/mac/glcanvas_wrap.cpp diff --git a/wxPython/contrib/glcanvas/mac/glcanvas_wrap.cpp b/wxPython/contrib/glcanvas/mac/glcanvas_wrap.cpp index cfed0a4f53..6aad6de89e 100644 --- a/wxPython/contrib/glcanvas/mac/glcanvas_wrap.cpp +++ b/wxPython/contrib/glcanvas/mac/glcanvas_wrap.cpp @@ -1,6 +1,6 @@ /* ---------------------------------------------------------------------------- * This file was automatically generated by SWIG (http://www.swig.org). - * Version 1.3.20 + * Version 1.3.22 * * This file is not intended to be easily readable and contains a number of * coding conventions designed to improve portability and efficiency. Do not make @@ -137,6 +137,178 @@ SWIGIMPORT(char *) SWIG_UnpackData(char *, void *, int); #include "Python.h" +#include +#include + +#ifdef __cplusplus +#define SWIG_STATIC_INLINE static inline +#else +#define SWIG_STATIC_INLINE static +#endif + +SWIG_STATIC_INLINE long +SPyObj_AsLong(PyObject * obj) +{ + return PyInt_Check(obj) ? PyInt_AsLong(obj) : PyLong_AsLong(obj); +} + +SWIG_STATIC_INLINE unsigned long +SPyObj_AsUnsignedLong(PyObject * obj) +{ + if (PyLong_Check(obj)) { + return PyLong_AsUnsignedLong(obj); + } else { + long i = PyInt_AsLong(obj); + if ( !PyErr_Occurred() && (i < 0)) { + PyErr_SetString(PyExc_TypeError, "negative value for unsigned type"); + } + return i; + } +} + +#if !defined(_MSC_VER) +SWIG_STATIC_INLINE PyObject* +SPyObj_FromLongLong(long long value) +{ + return (value > (long)(LONG_MAX)) ? + PyLong_FromLongLong(value) : PyInt_FromLong((long)value); +} +#endif + +SWIG_STATIC_INLINE PyObject* +SPyObj_FromUnsignedLong(unsigned long value) +{ + return (value > (unsigned long)(LONG_MAX)) ? + PyLong_FromUnsignedLong(value) : PyInt_FromLong((long)value); +} + +#if !defined(_MSC_VER) +SWIG_STATIC_INLINE PyObject* +SPyObj_FromUnsignedLongLong(unsigned long long value) +{ + return (value > (unsigned long long)(LONG_MAX)) ? + PyLong_FromUnsignedLongLong(value) : PyInt_FromLong((long)value); +} +#endif + +SWIG_STATIC_INLINE long +SPyObj_AsLongInRange(PyObject * obj, long min_value, long max_value) +{ + long value = SPyObj_AsLong(obj); + if (!PyErr_Occurred()) { + if (value < min_value) { + PyErr_SetString(PyExc_OverflowError,"value is smaller than type minimum"); + } else if (value > max_value) { + PyErr_SetString(PyExc_OverflowError,"value is greater than type maximum"); + } + } + return value; +} + +SWIG_STATIC_INLINE unsigned long +SPyObj_AsUnsignedLongInRange(PyObject *obj, unsigned long max_value) +{ + unsigned long value = SPyObj_AsUnsignedLong(obj); + if (!PyErr_Occurred()) { + if (value > max_value) { + PyErr_SetString(PyExc_OverflowError,"value is greater than type maximum"); + } + } + return value; +} + +SWIG_STATIC_INLINE signed char +SPyObj_AsSignedChar(PyObject *obj) { + return (signed char)SPyObj_AsLongInRange(obj, SCHAR_MIN, SCHAR_MAX); +} + +SWIG_STATIC_INLINE short +SPyObj_AsShort(PyObject *obj) { + return (short)SPyObj_AsLongInRange(obj, SHRT_MIN, SHRT_MAX); +} + +SWIG_STATIC_INLINE int +SPyObj_AsInt(PyObject *obj) { + return SPyObj_AsLongInRange(obj, INT_MIN, INT_MAX); +} + +SWIG_STATIC_INLINE unsigned char +SPyObj_AsUnsignedChar(PyObject *obj) { + return (unsigned char)SPyObj_AsUnsignedLongInRange(obj, UCHAR_MAX); +} + +SWIG_STATIC_INLINE unsigned short +SPyObj_AsUnsignedShort(PyObject *obj) { + return (unsigned short)SPyObj_AsUnsignedLongInRange(obj, USHRT_MAX); +} + +SWIG_STATIC_INLINE unsigned int +SPyObj_AsUnsignedInt(PyObject *obj) { + return SPyObj_AsUnsignedLongInRange(obj, UINT_MAX); +} + +#if !defined(_MSC_VER) +SWIG_STATIC_INLINE long long +SPyObj_AsLongLong(PyObject *obj) { + return PyInt_Check(obj) ? + PyInt_AsLong(obj) : PyLong_AsLongLong(obj); +} + +SWIG_STATIC_INLINE unsigned long long +SPyObj_AsUnsignedLongLong(PyObject *obj) { + return PyLong_Check(obj) ? + PyLong_AsUnsignedLongLong(obj) : SPyObj_AsUnsignedLong(obj); +} +#endif + +SWIG_STATIC_INLINE double +SPyObj_AsDouble(PyObject *obj) { + return (PyFloat_Check(obj)) ? PyFloat_AsDouble(obj) : + (double)((PyInt_Check(obj)) ? PyInt_AsLong(obj) : PyLong_AsLongLong(obj)); +} + +SWIG_STATIC_INLINE float +SPyObj_AsFloat(PyObject *obj) { + double value = SPyObj_AsDouble(obj); + if (!PyErr_Occurred()) { + if (value < FLT_MIN) { + PyErr_SetString(PyExc_OverflowError,"float is smaller than flt_min"); + } else if (value > FLT_MAX) { + PyErr_SetString(PyExc_OverflowError,"float is greater than flt_max"); + } + } + return (float) value; +} + +SWIG_STATIC_INLINE char +SPyObj_AsChar(PyObject *obj) { + char c = (PyString_Check(obj) && PyString_Size(obj) == 1) ? + PyString_AsString(obj)[0] + : (char) SPyObj_AsLongInRange(obj, CHAR_MIN, CHAR_MAX); + if (PyErr_Occurred()) { + PyErr_Clear(); + PyErr_SetString(PyExc_TypeError, "a char is required"); + } + return c; +} + +SWIG_STATIC_INLINE PyObject * +SPyObj_FromChar(char c) { + return PyString_FromStringAndSize(&c,1); +} + +SWIG_STATIC_INLINE PyObject * +SPyObj_FromCharPtr(const char* cptr) { + return cptr ? PyString_FromString(cptr) : Py_BuildValue((char*)""); +} + +SWIG_STATIC_INLINE int +SPyObj_AsBool(PyObject *obj) { + return SPyObj_AsLong/*Long*/(obj) ? 1 : 0; +} + + + #ifdef __cplusplus extern "C" { #endif @@ -172,7 +344,7 @@ typedef struct swig_const_info { SWIG_Python_NewPointerObj(p, type, flags) #define SWIG_MustGetPtr(p, type, argnum, flags) \ SWIG_Python_MustGetPtr(p, type, argnum, flags) - + /* Python-specific SWIG API */ #define SWIG_newvarlink() \ SWIG_Python_newvarlink() @@ -234,9 +406,9 @@ static swig_type_info *swig_types[9]; #include - static const wxString wxPyGLCanvasNameStr(wxT("GLCanvas")); - static const wxString wxPyEmptyString(wxT("")); + static const wxString wxPyGLCanvasNameStr(wxT("GLCanvas")); + static const wxString wxPyEmptyString(wxEmptyString); wxGLContext *new_wxGLContext(bool isRGB,wxGLCanvas *win,wxPalette const &palette,wxGLContext const *other){ AGLPixelFormat fmt; // TODO: How should this be initialized? return new wxGLContext(fmt, win, palette, other); @@ -244,6 +416,26 @@ wxGLContext *new_wxGLContext(bool isRGB,wxGLCanvas *win,wxPalette const &palette #ifdef __cplusplus extern "C" { #endif +static int _wrap_GLCanvasNameStr_set(PyObject *_val) { + PyErr_SetString(PyExc_TypeError,"Variable GLCanvasNameStr is read-only."); + return 1; +} + + +static PyObject *_wrap_GLCanvasNameStr_get() { + PyObject *pyobj; + + { +#if wxUSE_UNICODE + pyobj = PyUnicode_FromWideChar((&wxPyGLCanvasNameStr)->c_str(), (&wxPyGLCanvasNameStr)->Len()); +#else + pyobj = PyString_FromStringAndSize((&wxPyGLCanvasNameStr)->c_str(), (&wxPyGLCanvasNameStr)->Len()); +#endif + } + return pyobj; +} + + static PyObject *_wrap_new_GLContext(PyObject *self, PyObject *args, PyObject *kwargs) { PyObject *resultobj; bool arg1 ; @@ -261,8 +453,10 @@ static PyObject *_wrap_new_GLContext(PyObject *self, PyObject *args, PyObject *k }; if(!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OO|OO:new_GLContext",kwnames,&obj0,&obj1,&obj2,&obj3)) goto fail; - arg1 = PyInt_AsLong(obj0) ? true : false; - if (PyErr_Occurred()) SWIG_fail; + { + arg1 = (bool) SPyObj_AsBool(obj0); + if (PyErr_Occurred()) SWIG_fail; + } if ((SWIG_ConvertPtr(obj1,(void **) &arg2, SWIGTYPE_p_wxGLCanvas,SWIG_POINTER_EXCEPTION | 0 )) == -1) SWIG_fail; if (obj2) { if ((SWIG_ConvertPtr(obj2,(void **) &arg3, SWIGTYPE_p_wxPalette,SWIG_POINTER_EXCEPTION | 0 )) == -1) SWIG_fail; @@ -531,7 +725,7 @@ static PyObject *_wrap_new_GLCanvas(PyObject *self, PyObject *args, PyObject *kw } -static PyObject *_wrap_new_wxGLCanvasWithContext(PyObject *self, PyObject *args, PyObject *kwargs) { +static PyObject *_wrap_new_GLCanvasWithContext(PyObject *self, PyObject *args, PyObject *kwargs) { PyObject *resultobj; wxWindow *arg1 = (wxWindow *) 0 ; wxGLContext *arg2 = (wxGLContext *) NULL ; @@ -562,7 +756,7 @@ static PyObject *_wrap_new_wxGLCanvasWithContext(PyObject *self, PyObject *args, (char *) "parent",(char *) "shared",(char *) "id",(char *) "pos",(char *) "size",(char *) "style",(char *) "name",(char *) "attribList",(char *) "palette", NULL }; - if(!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"O|OiOOlOOO:new_wxGLCanvasWithContext",kwnames,&obj0,&obj1,&arg3,&obj3,&obj4,&arg6,&obj6,&obj7,&obj8)) goto fail; + if(!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"O|OiOOlOOO:new_GLCanvasWithContext",kwnames,&obj0,&obj1,&arg3,&obj3,&obj4,&arg6,&obj6,&obj7,&obj8)) goto fail; if ((SWIG_ConvertPtr(obj0,(void **) &arg1, SWIGTYPE_p_wxWindow,SWIG_POINTER_EXCEPTION | 0 )) == -1) SWIG_fail; if (obj1) { if ((SWIG_ConvertPtr(obj1,(void **) &arg2, SWIGTYPE_p_wxGLContext,SWIG_POINTER_EXCEPTION | 0 )) == -1) SWIG_fail; @@ -763,7 +957,7 @@ static PyMethodDef SwigMethods[] = { { (char *)"GLContext_GetWindow", (PyCFunction) _wrap_GLContext_GetWindow, METH_VARARGS | METH_KEYWORDS }, { (char *)"GLContext_swigregister", GLContext_swigregister, METH_VARARGS }, { (char *)"new_GLCanvas", (PyCFunction) _wrap_new_GLCanvas, METH_VARARGS | METH_KEYWORDS }, - { (char *)"new_wxGLCanvasWithContext", (PyCFunction) _wrap_new_wxGLCanvasWithContext, METH_VARARGS | METH_KEYWORDS }, + { (char *)"new_GLCanvasWithContext", (PyCFunction) _wrap_new_GLCanvasWithContext, METH_VARARGS | METH_KEYWORDS }, { (char *)"GLCanvas_SetCurrent", (PyCFunction) _wrap_GLCanvas_SetCurrent, METH_VARARGS | METH_KEYWORDS }, { (char *)"GLCanvas_SetColour", (PyCFunction) _wrap_GLCanvas_SetColour, METH_VARARGS | METH_KEYWORDS }, { (char *)"GLCanvas_SwapBuffers", (PyCFunction) _wrap_GLCanvas_SwapBuffers, METH_VARARGS | METH_KEYWORDS }, @@ -1106,6 +1300,8 @@ SWIGEXPORT(void) SWIG_init(void) { } SWIG_InstallConstants(d,swig_const_table); + PyDict_SetItemString(d,(char*)"cvar", SWIG_globals); + SWIG_addvarlink(SWIG_globals,(char*)"GLCanvasNameStr",_wrap_GLCanvasNameStr_get, _wrap_GLCanvasNameStr_set);