X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/fc71d09b42c69406f1b5da07cef9924807557a23..94fd5e4dc14c5de8a0a787eda125987616ace638:/wxPython/src/gtk/_core_wrap.cpp diff --git a/wxPython/src/gtk/_core_wrap.cpp b/wxPython/src/gtk/_core_wrap.cpp index fe199b7149..397b3dee31 100644 --- a/wxPython/src/gtk/_core_wrap.cpp +++ b/wxPython/src/gtk/_core_wrap.cpp @@ -1256,6 +1256,23 @@ wxImage *new_wxImage(int width,int height,unsigned char *data){ memcpy(copy, data, width*height*3); return new wxImage(width, height, copy, false); } +wxImage *new_wxImage(int width,int height,unsigned char *data,unsigned char *alpha){ + // Copy the source data so the wxImage can clean it up later + unsigned char* dcopy = (unsigned char*)malloc(width*height*3); + if (dcopy == NULL) { + PyErr_NoMemory(); + return NULL; + } + memcpy(dcopy, data, width*height*3); + unsigned char* acopy = (unsigned char*)malloc(width*height); + if (acopy == NULL) { + PyErr_NoMemory(); + return NULL; + } + memcpy(acopy, alpha, width*height); + + return new wxImage(width, height, dcopy, acopy, false); + } wxSize wxImage_GetSize(wxImage *self){ wxSize size(self->GetWidth(), self->GetHeight()); return size; @@ -1539,6 +1556,42 @@ int PyApp_GetComCtl32Version(){ wxPyRaiseNotImplemented(); return 0; } wxPyApp* wxPyGetApp() { return (wxPyApp*)wxTheApp; } +SWIGSTATICINLINE(int) +SWIG_AsCharPtr(PyObject *obj, char **val) +{ + char* cptr = 0; + if (SWIG_AsCharPtrAndSize(obj, &cptr, (size_t*)(0))) { + if (val) *val = cptr; + return 1; + } + if (val) { + PyErr_SetString(PyExc_TypeError, "a char* is expected"); + } + return 0; +} + + +SWIGSTATICINLINE(PyObject *) +SWIG_FromCharPtr(const char* cptr) +{ + if (cptr) { + size_t size = strlen(cptr); + if (size > INT_MAX) { + return SWIG_NewPointerObj(swig_const_cast(cptr,char*), + SWIG_TypeQuery("char *"), 0); + } else { + if (size != 0) { + return PyString_FromStringAndSize(cptr, size); + } else { + return PyString_FromString(cptr); + } + } + } + Py_INCREF(Py_None); + return Py_None; +} + + #ifdef __WXMAC__ // A dummy class that raises an exception if used... @@ -4566,7 +4619,7 @@ static PyObject *_wrap_Rect_Intersect(PyObject *, PyObject *args, PyObject *kwar PyObject *resultobj; wxRect *arg1 = (wxRect *) 0 ; wxRect *arg2 = 0 ; - wxRect *result; + wxRect result; wxRect temp2 ; PyObject * obj0 = 0 ; PyObject * obj1 = 0 ; @@ -4583,15 +4636,53 @@ static PyObject *_wrap_Rect_Intersect(PyObject *, PyObject *args, PyObject *kwar } { PyThreadState* __tstate = wxPyBeginAllowThreads(); - { - wxRect &_result_ref = (arg1)->Intersect((wxRect const &)*arg2); - result = (wxRect *) &_result_ref; - } + result = (arg1)->Intersect((wxRect const &)*arg2); wxPyEndAllowThreads(__tstate); if (PyErr_Occurred()) SWIG_fail; } - resultobj = SWIG_NewPointerObj((void*)(result), SWIGTYPE_p_wxRect, 0); + { + wxRect * resultptr; + resultptr = new wxRect((wxRect &) result); + resultobj = SWIG_NewPointerObj((void *)(resultptr), SWIGTYPE_p_wxRect, 1); + } + return resultobj; + fail: + return NULL; +} + + +static PyObject *_wrap_Rect_Union(PyObject *, PyObject *args, PyObject *kwargs) { + PyObject *resultobj; + wxRect *arg1 = (wxRect *) 0 ; + wxRect *arg2 = 0 ; + wxRect result; + wxRect temp2 ; + PyObject * obj0 = 0 ; + PyObject * obj1 = 0 ; + char *kwnames[] = { + (char *) "self",(char *) "rect", NULL + }; + + if(!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OO:Rect_Union",kwnames,&obj0,&obj1)) goto fail; + if ((SWIG_ConvertPtr(obj0,(void **)(&arg1),SWIGTYPE_p_wxRect, + SWIG_POINTER_EXCEPTION | 0)) == -1) SWIG_fail; + { + arg2 = &temp2; + if ( ! wxRect_helper(obj1, &arg2)) SWIG_fail; + } + { + PyThreadState* __tstate = wxPyBeginAllowThreads(); + result = (arg1)->Union((wxRect const &)*arg2); + + wxPyEndAllowThreads(__tstate); + if (PyErr_Occurred()) SWIG_fail; + } + { + wxRect * resultptr; + resultptr = new wxRect((wxRect &) result); + resultobj = SWIG_NewPointerObj((void *)(resultptr), SWIGTYPE_p_wxRect, 1); + } return resultobj; fail: return NULL; @@ -9278,6 +9369,44 @@ static PyObject *_wrap_new_ImageFromData(PyObject *, PyObject *args, PyObject *k } +static PyObject *_wrap_new_ImageFromDataWithAlpha(PyObject *, PyObject *args, PyObject *kwargs) { + PyObject *resultobj; + int arg1 ; + int arg2 ; + unsigned char *arg3 = (unsigned char *) 0 ; + unsigned char *arg4 = (unsigned char *) 0 ; + wxImage *result; + PyObject * obj0 = 0 ; + PyObject * obj1 = 0 ; + PyObject * obj2 = 0 ; + PyObject * obj3 = 0 ; + char *kwnames[] = { + (char *) "width",(char *) "height",(char *) "data",(char *) "alpha", NULL + }; + + if(!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OOOO:new_ImageFromDataWithAlpha",kwnames,&obj0,&obj1,&obj2,&obj3)) goto fail; + arg1 = (int)SWIG_As_int(obj0); + if (PyErr_Occurred()) SWIG_fail; + arg2 = (int)SWIG_As_int(obj1); + if (PyErr_Occurred()) SWIG_fail; + if ((SWIG_ConvertPtr(obj2,(void **)(&arg3),SWIGTYPE_p_unsigned_char, + SWIG_POINTER_EXCEPTION | 0)) == -1) SWIG_fail; + if ((SWIG_ConvertPtr(obj3,(void **)(&arg4),SWIGTYPE_p_unsigned_char, + SWIG_POINTER_EXCEPTION | 0)) == -1) SWIG_fail; + { + PyThreadState* __tstate = wxPyBeginAllowThreads(); + result = (wxImage *)new_wxImage(arg1,arg2,arg3,arg4); + + wxPyEndAllowThreads(__tstate); + if (PyErr_Occurred()) SWIG_fail; + } + resultobj = SWIG_NewPointerObj((void*)(result), SWIGTYPE_p_wxImage, 1); + return resultobj; + fail: + return NULL; +} + + static PyObject *_wrap_Image_Create(PyObject *, PyObject *args, PyObject *kwargs) { PyObject *resultobj; wxImage *arg1 = (wxImage *) 0 ; @@ -21376,6 +21505,52 @@ static PyObject *_wrap_GetApp(PyObject *, PyObject *args, PyObject *kwargs) { } +static PyObject *_wrap_SetDefaultPyEncoding(PyObject *, PyObject *args, PyObject *kwargs) { + PyObject *resultobj; + char *arg1 ; + PyObject * obj0 = 0 ; + char *kwnames[] = { + (char *) "encoding", NULL + }; + + if(!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"O:SetDefaultPyEncoding",kwnames,&obj0)) goto fail; + if (!SWIG_AsCharPtr(obj0, (char**)&arg1)) SWIG_fail; + { + PyThreadState* __tstate = wxPyBeginAllowThreads(); + wxSetDefaultPyEncoding((char const *)arg1); + + wxPyEndAllowThreads(__tstate); + if (PyErr_Occurred()) SWIG_fail; + } + Py_INCREF(Py_None); resultobj = Py_None; + return resultobj; + fail: + return NULL; +} + + +static PyObject *_wrap_GetDefaultPyEncoding(PyObject *, PyObject *args, PyObject *kwargs) { + PyObject *resultobj; + char *result; + char *kwnames[] = { + NULL + }; + + if(!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)":GetDefaultPyEncoding",kwnames)) goto fail; + { + PyThreadState* __tstate = wxPyBeginAllowThreads(); + result = (char *)wxGetDefaultPyEncoding(); + + wxPyEndAllowThreads(__tstate); + if (PyErr_Occurred()) SWIG_fail; + } + resultobj = SWIG_FromCharPtr(result); + return resultobj; + fail: + return NULL; +} + + static PyObject *_wrap_new_EventLoop(PyObject *, PyObject *args, PyObject *kwargs) { PyObject *resultobj; wxEventLoop *result; @@ -40930,6 +41105,7 @@ static PyMethodDef SwigMethods[] = { { (char *)"Rect_OffsetXY", (PyCFunction) _wrap_Rect_OffsetXY, METH_VARARGS | METH_KEYWORDS, NULL }, { (char *)"Rect_Offset", (PyCFunction) _wrap_Rect_Offset, METH_VARARGS | METH_KEYWORDS, NULL }, { (char *)"Rect_Intersect", (PyCFunction) _wrap_Rect_Intersect, METH_VARARGS | METH_KEYWORDS, NULL }, + { (char *)"Rect_Union", (PyCFunction) _wrap_Rect_Union, METH_VARARGS | METH_KEYWORDS, NULL }, { (char *)"Rect___add__", (PyCFunction) _wrap_Rect___add__, METH_VARARGS | METH_KEYWORDS, NULL }, { (char *)"Rect___iadd__", (PyCFunction) _wrap_Rect___iadd__, METH_VARARGS | METH_KEYWORDS, NULL }, { (char *)"Rect___eq__", (PyCFunction) _wrap_Rect___eq__, METH_VARARGS | METH_KEYWORDS, NULL }, @@ -41072,6 +41248,7 @@ static PyMethodDef SwigMethods[] = { { (char *)"new_EmptyImage", (PyCFunction) _wrap_new_EmptyImage, METH_VARARGS | METH_KEYWORDS, NULL }, { (char *)"new_ImageFromBitmap", (PyCFunction) _wrap_new_ImageFromBitmap, METH_VARARGS | METH_KEYWORDS, NULL }, { (char *)"new_ImageFromData", (PyCFunction) _wrap_new_ImageFromData, METH_VARARGS | METH_KEYWORDS, NULL }, + { (char *)"new_ImageFromDataWithAlpha", (PyCFunction) _wrap_new_ImageFromDataWithAlpha, METH_VARARGS | METH_KEYWORDS, NULL }, { (char *)"Image_Create", (PyCFunction) _wrap_Image_Create, METH_VARARGS | METH_KEYWORDS, NULL }, { (char *)"Image_Destroy", (PyCFunction) _wrap_Image_Destroy, METH_VARARGS | METH_KEYWORDS, NULL }, { (char *)"Image_Scale", (PyCFunction) _wrap_Image_Scale, METH_VARARGS | METH_KEYWORDS, NULL }, @@ -41520,6 +41697,8 @@ static PyMethodDef SwigMethods[] = { { (char *)"PostEvent", (PyCFunction) _wrap_PostEvent, METH_VARARGS | METH_KEYWORDS, NULL }, { (char *)"App_CleanUp", (PyCFunction) _wrap_App_CleanUp, METH_VARARGS | METH_KEYWORDS, NULL }, { (char *)"GetApp", (PyCFunction) _wrap_GetApp, METH_VARARGS | METH_KEYWORDS, NULL }, + { (char *)"SetDefaultPyEncoding", (PyCFunction) _wrap_SetDefaultPyEncoding, METH_VARARGS | METH_KEYWORDS, NULL }, + { (char *)"GetDefaultPyEncoding", (PyCFunction) _wrap_GetDefaultPyEncoding, METH_VARARGS | METH_KEYWORDS, NULL }, { (char *)"new_EventLoop", (PyCFunction) _wrap_new_EventLoop, METH_VARARGS | METH_KEYWORDS, NULL }, { (char *)"delete_EventLoop", (PyCFunction) _wrap_delete_EventLoop, METH_VARARGS | METH_KEYWORDS, NULL }, { (char *)"EventLoop_Run", (PyCFunction) _wrap_EventLoop_Run, METH_VARARGS | METH_KEYWORDS, NULL },