SWIGged updates for wxGTK
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@14367 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -3182,19 +3182,23 @@ static PyObject *_wrap_wxListCtrl_SetBackgroundColour(PyObject *self, PyObject *
|
||||
return _resultobj;
|
||||
}
|
||||
|
||||
#define wxListCtrl_GetColumn(_swigobj,_swigarg0,_swigarg1) (_swigobj->GetColumn(_swigarg0,_swigarg1))
|
||||
static wxListItem * wxPyListCtrl_GetColumn(wxPyListCtrl *self,int col) {
|
||||
wxListItem item;
|
||||
if (self->GetColumn(col, item))
|
||||
return new wxListItem(item);
|
||||
else
|
||||
return NULL;
|
||||
}
|
||||
static PyObject *_wrap_wxListCtrl_GetColumn(PyObject *self, PyObject *args, PyObject *kwargs) {
|
||||
PyObject * _resultobj;
|
||||
bool _result;
|
||||
wxListItem * _result;
|
||||
wxPyListCtrl * _arg0;
|
||||
int _arg1;
|
||||
wxListItem * _arg2;
|
||||
PyObject * _argo0 = 0;
|
||||
PyObject * _argo2 = 0;
|
||||
char *_kwnames[] = { "self","col","item", NULL };
|
||||
char *_kwnames[] = { "self","col", NULL };
|
||||
|
||||
self = self;
|
||||
if(!PyArg_ParseTupleAndKeywords(args,kwargs,"OiO:wxListCtrl_GetColumn",_kwnames,&_argo0,&_arg1,&_argo2))
|
||||
if(!PyArg_ParseTupleAndKeywords(args,kwargs,"Oi:wxListCtrl_GetColumn",_kwnames,&_argo0,&_arg1))
|
||||
return NULL;
|
||||
if (_argo0) {
|
||||
if (_argo0 == Py_None) { _arg0 = NULL; }
|
||||
@@ -3203,20 +3207,13 @@ static PyObject *_wrap_wxListCtrl_GetColumn(PyObject *self, PyObject *args, PyOb
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
if (_argo2) {
|
||||
if (_argo2 == Py_None) { _arg2 = NULL; }
|
||||
else if (SWIG_GetPtrObj(_argo2,(void **) &_arg2,"_wxListItem_p")) {
|
||||
PyErr_SetString(PyExc_TypeError,"Type error in argument 3 of wxListCtrl_GetColumn. Expected _wxListItem_p.");
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
{
|
||||
PyThreadState* __tstate = wxPyBeginAllowThreads();
|
||||
_result = (bool )wxListCtrl_GetColumn(_arg0,_arg1,*_arg2);
|
||||
_result = (wxListItem *)wxPyListCtrl_GetColumn(_arg0,_arg1);
|
||||
|
||||
wxPyEndAllowThreads(__tstate);
|
||||
if (PyErr_Occurred()) return NULL;
|
||||
} _resultobj = Py_BuildValue("i",_result);
|
||||
}{ _resultobj = wxPyMake_wxObject(_result); }
|
||||
return _resultobj;
|
||||
}
|
||||
|
||||
|
@@ -612,6 +612,12 @@ class wxListCtrlPtr(wxControlPtr):
|
||||
def __repr__(self):
|
||||
return "<C wxListCtrl instance at %s>" % (self.this,)
|
||||
|
||||
def GetItem(self, *_args, **_kwargs):
|
||||
val = apply(controls2c.wxListCtrl_GetColumn,(self,) + _args, _kwargs)
|
||||
if val is not None: val.thisown = 1
|
||||
return val
|
||||
|
||||
|
||||
def GetItem(self, *_args, **_kwargs):
|
||||
val = apply(controls2c.wxListCtrl_GetItem,(self,) + _args, _kwargs)
|
||||
val.thisown = 1
|
||||
|
@@ -329,6 +329,8 @@ static PyObject *_wrap_new_wxFSFile(PyObject *self, PyObject *args, PyObject *kw
|
||||
wxString * _arg2;
|
||||
wxString * _arg3;
|
||||
wxDateTime * _arg4;
|
||||
wxPyInputStream * temp;
|
||||
bool created;
|
||||
PyObject * _obj0 = 0;
|
||||
PyObject * _obj1 = 0;
|
||||
PyObject * _obj2 = 0;
|
||||
@@ -341,16 +343,16 @@ static PyObject *_wrap_new_wxFSFile(PyObject *self, PyObject *args, PyObject *kw
|
||||
if(!PyArg_ParseTupleAndKeywords(args,kwargs,"OOOOO:new_wxFSFile",_kwnames,&_obj0,&_obj1,&_obj2,&_obj3,&_argo4))
|
||||
return NULL;
|
||||
{
|
||||
if (PyInstance_Check(_obj0)) {
|
||||
wxPyInputStream* ptr;
|
||||
if (SWIG_GetPtrObj(_obj0, (void **) &ptr,"_wxPyInputStream_p")) {
|
||||
PyErr_SetString(PyExc_TypeError,"Expected _wxInputStream_p.");
|
||||
if (SWIG_GetPtrObj(_obj0, (void **) &temp, "_wxPyInputStream_p") == 0) {
|
||||
_arg0 = temp->m_wxis;
|
||||
created = FALSE;
|
||||
} else {
|
||||
_arg0 = wxPyCBInputStream::create(_obj0, FALSE);
|
||||
if (_arg0 == NULL) {
|
||||
PyErr_SetString(PyExc_TypeError,"Expected _wxInputStream_p or Python file-like object.");
|
||||
return NULL;
|
||||
}
|
||||
_arg0 = ptr->wxi;
|
||||
} else {
|
||||
PyErr_SetString(PyExc_TypeError,"Expected _wxInputStream_p.");
|
||||
return NULL;
|
||||
created = TRUE;
|
||||
}
|
||||
}
|
||||
{
|
||||
@@ -427,6 +429,10 @@ static PyObject *_wrap_new_wxFSFile(PyObject *self, PyObject *args, PyObject *kw
|
||||
Py_INCREF(Py_None);
|
||||
_resultobj = Py_None;
|
||||
}
|
||||
{
|
||||
if (created)
|
||||
delete _arg0;
|
||||
}
|
||||
{
|
||||
if (_obj1)
|
||||
delete _arg1;
|
||||
|
@@ -98,14 +98,17 @@ static PyObject* t_output_helper(PyObject* target, PyObject* o) {
|
||||
return new wxImage(width, height);
|
||||
}
|
||||
|
||||
|
||||
wxImage* wxImageFromMime(const wxString& name, const wxString& mimetype, int index) {
|
||||
return new wxImage(name, mimetype, index);
|
||||
}
|
||||
|
||||
|
||||
wxImage* wxImageFromBitmap(const wxBitmap &bitmap) {
|
||||
return new wxImage(bitmap);
|
||||
}
|
||||
|
||||
|
||||
wxImage* wxImageFromData(int width, int height, unsigned char* data) {
|
||||
// Copy the source data so the wxImage can clean it up later
|
||||
unsigned char* copy = (unsigned char*)malloc(width*height*3);
|
||||
@@ -117,6 +120,18 @@ static PyObject* t_output_helper(PyObject* target, PyObject* o) {
|
||||
return new wxImage(width, height, copy, FALSE);
|
||||
}
|
||||
|
||||
|
||||
wxImage* wxImageFromStream(wxInputStream& stream,
|
||||
long type = wxBITMAP_TYPE_ANY, int index = -1) {
|
||||
return new wxImage(stream, type, index);
|
||||
}
|
||||
|
||||
|
||||
wxImage* wxImageFromStreamMime(wxInputStream& stream,
|
||||
const wxString& mimetype, int index = -1 ) {
|
||||
return new wxImage(stream, mimetype, index);
|
||||
}
|
||||
|
||||
#if 0
|
||||
extern wxImage wxNullImage;
|
||||
|
||||
@@ -300,6 +315,125 @@ static PyObject *_wrap_wxImageFromData(PyObject *self, PyObject *args, PyObject
|
||||
return _resultobj;
|
||||
}
|
||||
|
||||
static PyObject *_wrap_wxImageFromStream(PyObject *self, PyObject *args, PyObject *kwargs) {
|
||||
PyObject * _resultobj;
|
||||
wxImage * _result;
|
||||
wxInputStream * _arg0;
|
||||
long _arg1 = (long ) wxBITMAP_TYPE_ANY;
|
||||
int _arg2 = (int ) -1;
|
||||
wxPyInputStream * temp;
|
||||
bool created;
|
||||
PyObject * _obj0 = 0;
|
||||
char *_kwnames[] = { "stream","type","index", NULL };
|
||||
char _ptemp[128];
|
||||
|
||||
self = self;
|
||||
if(!PyArg_ParseTupleAndKeywords(args,kwargs,"O|li:wxImageFromStream",_kwnames,&_obj0,&_arg1,&_arg2))
|
||||
return NULL;
|
||||
{
|
||||
if (SWIG_GetPtrObj(_obj0, (void **) &temp, "_wxPyInputStream_p") == 0) {
|
||||
_arg0 = temp->m_wxis;
|
||||
created = FALSE;
|
||||
} else {
|
||||
_arg0 = wxPyCBInputStream::create(_obj0, FALSE);
|
||||
if (_arg0 == NULL) {
|
||||
PyErr_SetString(PyExc_TypeError,"Expected _wxInputStream_p or Python file-like object.");
|
||||
return NULL;
|
||||
}
|
||||
created = TRUE;
|
||||
}
|
||||
}
|
||||
{
|
||||
PyThreadState* __tstate = wxPyBeginAllowThreads();
|
||||
_result = (wxImage *)wxImageFromStream(*_arg0,_arg1,_arg2);
|
||||
|
||||
wxPyEndAllowThreads(__tstate);
|
||||
if (PyErr_Occurred()) return NULL;
|
||||
} if (_result) {
|
||||
SWIG_MakePtr(_ptemp, (char *) _result,"_wxImage_p");
|
||||
_resultobj = Py_BuildValue("s",_ptemp);
|
||||
} else {
|
||||
Py_INCREF(Py_None);
|
||||
_resultobj = Py_None;
|
||||
}
|
||||
{
|
||||
if (created)
|
||||
delete _arg0;
|
||||
}
|
||||
return _resultobj;
|
||||
}
|
||||
|
||||
static PyObject *_wrap_wxImageFromStreamMime(PyObject *self, PyObject *args, PyObject *kwargs) {
|
||||
PyObject * _resultobj;
|
||||
wxImage * _result;
|
||||
wxInputStream * _arg0;
|
||||
wxString * _arg1;
|
||||
int _arg2 = (int ) -1;
|
||||
wxPyInputStream * temp;
|
||||
bool created;
|
||||
PyObject * _obj0 = 0;
|
||||
PyObject * _obj1 = 0;
|
||||
char *_kwnames[] = { "stream","mimetype","index", NULL };
|
||||
char _ptemp[128];
|
||||
|
||||
self = self;
|
||||
if(!PyArg_ParseTupleAndKeywords(args,kwargs,"OO|i:wxImageFromStreamMime",_kwnames,&_obj0,&_obj1,&_arg2))
|
||||
return NULL;
|
||||
{
|
||||
if (SWIG_GetPtrObj(_obj0, (void **) &temp, "_wxPyInputStream_p") == 0) {
|
||||
_arg0 = temp->m_wxis;
|
||||
created = FALSE;
|
||||
} else {
|
||||
_arg0 = wxPyCBInputStream::create(_obj0, FALSE);
|
||||
if (_arg0 == NULL) {
|
||||
PyErr_SetString(PyExc_TypeError,"Expected _wxInputStream_p or Python file-like object.");
|
||||
return NULL;
|
||||
}
|
||||
created = TRUE;
|
||||
}
|
||||
}
|
||||
{
|
||||
#if PYTHON_API_VERSION >= 1009
|
||||
char* tmpPtr; int tmpSize;
|
||||
if (!PyString_Check(_obj1) && !PyUnicode_Check(_obj1)) {
|
||||
PyErr_SetString(PyExc_TypeError, wxStringErrorMsg);
|
||||
return NULL;
|
||||
}
|
||||
if (PyString_AsStringAndSize(_obj1, &tmpPtr, &tmpSize) == -1)
|
||||
return NULL;
|
||||
_arg1 = new wxString(tmpPtr, tmpSize);
|
||||
#else
|
||||
if (!PyString_Check(_obj1)) {
|
||||
PyErr_SetString(PyExc_TypeError, wxStringErrorMsg);
|
||||
return NULL;
|
||||
}
|
||||
_arg1 = new wxString(PyString_AS_STRING(_obj1), PyString_GET_SIZE(_obj1));
|
||||
#endif
|
||||
}
|
||||
{
|
||||
PyThreadState* __tstate = wxPyBeginAllowThreads();
|
||||
_result = (wxImage *)wxImageFromStreamMime(*_arg0,*_arg1,_arg2);
|
||||
|
||||
wxPyEndAllowThreads(__tstate);
|
||||
if (PyErr_Occurred()) return NULL;
|
||||
} if (_result) {
|
||||
SWIG_MakePtr(_ptemp, (char *) _result,"_wxImage_p");
|
||||
_resultobj = Py_BuildValue("s",_ptemp);
|
||||
} else {
|
||||
Py_INCREF(Py_None);
|
||||
_resultobj = Py_None;
|
||||
}
|
||||
{
|
||||
if (created)
|
||||
delete _arg0;
|
||||
}
|
||||
{
|
||||
if (_obj1)
|
||||
delete _arg1;
|
||||
}
|
||||
return _resultobj;
|
||||
}
|
||||
|
||||
static PyObject *_wrap_wxInitAllImageHandlers(PyObject *self, PyObject *args, PyObject *kwargs) {
|
||||
PyObject * _resultobj;
|
||||
char *_kwnames[] = { NULL };
|
||||
@@ -1955,6 +2089,170 @@ static PyObject *_wrap_wxImage_SaveMimeFile(PyObject *self, PyObject *args, PyOb
|
||||
return _resultobj;
|
||||
}
|
||||
|
||||
static PyObject *_wrap_wxImage_CanReadStream(PyObject *self, PyObject *args, PyObject *kwargs) {
|
||||
PyObject * _resultobj;
|
||||
bool _result;
|
||||
wxInputStream * _arg0;
|
||||
wxPyInputStream * temp;
|
||||
bool created;
|
||||
PyObject * _obj0 = 0;
|
||||
char *_kwnames[] = { "stream", NULL };
|
||||
|
||||
self = self;
|
||||
if(!PyArg_ParseTupleAndKeywords(args,kwargs,"O:wxImage_CanReadStream",_kwnames,&_obj0))
|
||||
return NULL;
|
||||
{
|
||||
if (SWIG_GetPtrObj(_obj0, (void **) &temp, "_wxPyInputStream_p") == 0) {
|
||||
_arg0 = temp->m_wxis;
|
||||
created = FALSE;
|
||||
} else {
|
||||
_arg0 = wxPyCBInputStream::create(_obj0, FALSE);
|
||||
if (_arg0 == NULL) {
|
||||
PyErr_SetString(PyExc_TypeError,"Expected _wxInputStream_p or Python file-like object.");
|
||||
return NULL;
|
||||
}
|
||||
created = TRUE;
|
||||
}
|
||||
}
|
||||
{
|
||||
PyThreadState* __tstate = wxPyBeginAllowThreads();
|
||||
_result = (bool )wxImage::CanRead(*_arg0);
|
||||
|
||||
wxPyEndAllowThreads(__tstate);
|
||||
if (PyErr_Occurred()) return NULL;
|
||||
} _resultobj = Py_BuildValue("i",_result);
|
||||
{
|
||||
if (created)
|
||||
delete _arg0;
|
||||
}
|
||||
return _resultobj;
|
||||
}
|
||||
|
||||
#define wxImage_LoadStream(_swigobj,_swigarg0,_swigarg1,_swigarg2) (_swigobj->LoadFile(_swigarg0,_swigarg1,_swigarg2))
|
||||
static PyObject *_wrap_wxImage_LoadStream(PyObject *self, PyObject *args, PyObject *kwargs) {
|
||||
PyObject * _resultobj;
|
||||
bool _result;
|
||||
wxImage * _arg0;
|
||||
wxInputStream * _arg1;
|
||||
long _arg2 = (long ) wxBITMAP_TYPE_ANY;
|
||||
int _arg3 = (int ) -1;
|
||||
PyObject * _argo0 = 0;
|
||||
wxPyInputStream * temp;
|
||||
bool created;
|
||||
PyObject * _obj1 = 0;
|
||||
char *_kwnames[] = { "self","stream","type","index", NULL };
|
||||
|
||||
self = self;
|
||||
if(!PyArg_ParseTupleAndKeywords(args,kwargs,"OO|li:wxImage_LoadStream",_kwnames,&_argo0,&_obj1,&_arg2,&_arg3))
|
||||
return NULL;
|
||||
if (_argo0) {
|
||||
if (_argo0 == Py_None) { _arg0 = NULL; }
|
||||
else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxImage_p")) {
|
||||
PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxImage_LoadStream. Expected _wxImage_p.");
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
{
|
||||
if (SWIG_GetPtrObj(_obj1, (void **) &temp, "_wxPyInputStream_p") == 0) {
|
||||
_arg1 = temp->m_wxis;
|
||||
created = FALSE;
|
||||
} else {
|
||||
_arg1 = wxPyCBInputStream::create(_obj1, FALSE);
|
||||
if (_arg1 == NULL) {
|
||||
PyErr_SetString(PyExc_TypeError,"Expected _wxInputStream_p or Python file-like object.");
|
||||
return NULL;
|
||||
}
|
||||
created = TRUE;
|
||||
}
|
||||
}
|
||||
{
|
||||
PyThreadState* __tstate = wxPyBeginAllowThreads();
|
||||
_result = (bool )wxImage_LoadStream(_arg0,*_arg1,_arg2,_arg3);
|
||||
|
||||
wxPyEndAllowThreads(__tstate);
|
||||
if (PyErr_Occurred()) return NULL;
|
||||
} _resultobj = Py_BuildValue("i",_result);
|
||||
{
|
||||
if (created)
|
||||
delete _arg1;
|
||||
}
|
||||
return _resultobj;
|
||||
}
|
||||
|
||||
#define wxImage_LoadMimeStream(_swigobj,_swigarg0,_swigarg1,_swigarg2) (_swigobj->LoadFile(_swigarg0,_swigarg1,_swigarg2))
|
||||
static PyObject *_wrap_wxImage_LoadMimeStream(PyObject *self, PyObject *args, PyObject *kwargs) {
|
||||
PyObject * _resultobj;
|
||||
bool _result;
|
||||
wxImage * _arg0;
|
||||
wxInputStream * _arg1;
|
||||
wxString * _arg2;
|
||||
int _arg3 = (int ) -1;
|
||||
PyObject * _argo0 = 0;
|
||||
wxPyInputStream * temp;
|
||||
bool created;
|
||||
PyObject * _obj1 = 0;
|
||||
PyObject * _obj2 = 0;
|
||||
char *_kwnames[] = { "self","stream","mimetype","index", NULL };
|
||||
|
||||
self = self;
|
||||
if(!PyArg_ParseTupleAndKeywords(args,kwargs,"OOO|i:wxImage_LoadMimeStream",_kwnames,&_argo0,&_obj1,&_obj2,&_arg3))
|
||||
return NULL;
|
||||
if (_argo0) {
|
||||
if (_argo0 == Py_None) { _arg0 = NULL; }
|
||||
else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxImage_p")) {
|
||||
PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxImage_LoadMimeStream. Expected _wxImage_p.");
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
{
|
||||
if (SWIG_GetPtrObj(_obj1, (void **) &temp, "_wxPyInputStream_p") == 0) {
|
||||
_arg1 = temp->m_wxis;
|
||||
created = FALSE;
|
||||
} else {
|
||||
_arg1 = wxPyCBInputStream::create(_obj1, FALSE);
|
||||
if (_arg1 == NULL) {
|
||||
PyErr_SetString(PyExc_TypeError,"Expected _wxInputStream_p or Python file-like object.");
|
||||
return NULL;
|
||||
}
|
||||
created = TRUE;
|
||||
}
|
||||
}
|
||||
{
|
||||
#if PYTHON_API_VERSION >= 1009
|
||||
char* tmpPtr; int tmpSize;
|
||||
if (!PyString_Check(_obj2) && !PyUnicode_Check(_obj2)) {
|
||||
PyErr_SetString(PyExc_TypeError, wxStringErrorMsg);
|
||||
return NULL;
|
||||
}
|
||||
if (PyString_AsStringAndSize(_obj2, &tmpPtr, &tmpSize) == -1)
|
||||
return NULL;
|
||||
_arg2 = new wxString(tmpPtr, tmpSize);
|
||||
#else
|
||||
if (!PyString_Check(_obj2)) {
|
||||
PyErr_SetString(PyExc_TypeError, wxStringErrorMsg);
|
||||
return NULL;
|
||||
}
|
||||
_arg2 = new wxString(PyString_AS_STRING(_obj2), PyString_GET_SIZE(_obj2));
|
||||
#endif
|
||||
}
|
||||
{
|
||||
PyThreadState* __tstate = wxPyBeginAllowThreads();
|
||||
_result = (bool )wxImage_LoadMimeStream(_arg0,*_arg1,*_arg2,_arg3);
|
||||
|
||||
wxPyEndAllowThreads(__tstate);
|
||||
if (PyErr_Occurred()) return NULL;
|
||||
} _resultobj = Py_BuildValue("i",_result);
|
||||
{
|
||||
if (created)
|
||||
delete _arg1;
|
||||
}
|
||||
{
|
||||
if (_obj2)
|
||||
delete _arg2;
|
||||
}
|
||||
return _resultobj;
|
||||
}
|
||||
|
||||
#define wxImage_Ok(_swigobj) (_swigobj->Ok())
|
||||
static PyObject *_wrap_wxImage_Ok(PyObject *self, PyObject *args, PyObject *kwargs) {
|
||||
PyObject * _resultobj;
|
||||
@@ -3027,6 +3325,9 @@ static PyMethodDef imagecMethods[] = {
|
||||
{ "wxImage_GetHeight", (PyCFunction) _wrap_wxImage_GetHeight, METH_VARARGS | METH_KEYWORDS },
|
||||
{ "wxImage_GetWidth", (PyCFunction) _wrap_wxImage_GetWidth, METH_VARARGS | METH_KEYWORDS },
|
||||
{ "wxImage_Ok", (PyCFunction) _wrap_wxImage_Ok, METH_VARARGS | METH_KEYWORDS },
|
||||
{ "wxImage_LoadMimeStream", (PyCFunction) _wrap_wxImage_LoadMimeStream, METH_VARARGS | METH_KEYWORDS },
|
||||
{ "wxImage_LoadStream", (PyCFunction) _wrap_wxImage_LoadStream, METH_VARARGS | METH_KEYWORDS },
|
||||
{ "wxImage_CanReadStream", (PyCFunction) _wrap_wxImage_CanReadStream, METH_VARARGS | METH_KEYWORDS },
|
||||
{ "wxImage_SaveMimeFile", (PyCFunction) _wrap_wxImage_SaveMimeFile, METH_VARARGS | METH_KEYWORDS },
|
||||
{ "wxImage_SaveFile", (PyCFunction) _wrap_wxImage_SaveFile, METH_VARARGS | METH_KEYWORDS },
|
||||
{ "wxImage_LoadMimeFile", (PyCFunction) _wrap_wxImage_LoadMimeFile, METH_VARARGS | METH_KEYWORDS },
|
||||
@@ -3066,6 +3367,8 @@ static PyMethodDef imagecMethods[] = {
|
||||
{ "wxImageHandler_GetName", (PyCFunction) _wrap_wxImageHandler_GetName, METH_VARARGS | METH_KEYWORDS },
|
||||
{ "wxBitmapFromImage", (PyCFunction) _wrap_wxBitmapFromImage, METH_VARARGS | METH_KEYWORDS },
|
||||
{ "wxInitAllImageHandlers", (PyCFunction) _wrap_wxInitAllImageHandlers, METH_VARARGS | METH_KEYWORDS },
|
||||
{ "wxImageFromStreamMime", (PyCFunction) _wrap_wxImageFromStreamMime, METH_VARARGS | METH_KEYWORDS },
|
||||
{ "wxImageFromStream", (PyCFunction) _wrap_wxImageFromStream, METH_VARARGS | METH_KEYWORDS },
|
||||
{ "wxImageFromData", (PyCFunction) _wrap_wxImageFromData, METH_VARARGS | METH_KEYWORDS },
|
||||
{ "wxImageFromBitmap", (PyCFunction) _wrap_wxImageFromBitmap, METH_VARARGS | METH_KEYWORDS },
|
||||
{ "wxImageFromMime", (PyCFunction) _wrap_wxImageFromMime, METH_VARARGS | METH_KEYWORDS },
|
||||
|
@@ -4,6 +4,8 @@ import imagec
|
||||
from misc import *
|
||||
|
||||
from gdi import *
|
||||
|
||||
from streams import *
|
||||
class wxImageHandlerPtr(wxObjectPtr):
|
||||
def __init__(self,this):
|
||||
self.this = this
|
||||
@@ -237,6 +239,12 @@ class wxImagePtr(wxObjectPtr):
|
||||
def SaveMimeFile(self, *_args, **_kwargs):
|
||||
val = apply(imagec.wxImage_SaveMimeFile,(self,) + _args, _kwargs)
|
||||
return val
|
||||
def LoadStream(self, *_args, **_kwargs):
|
||||
val = apply(imagec.wxImage_LoadStream,(self,) + _args, _kwargs)
|
||||
return val
|
||||
def LoadMimeStream(self, *_args, **_kwargs):
|
||||
val = apply(imagec.wxImage_LoadMimeStream,(self,) + _args, _kwargs)
|
||||
return val
|
||||
def Ok(self, *_args, **_kwargs):
|
||||
val = apply(imagec.wxImage_Ok,(self,) + _args, _kwargs)
|
||||
return val
|
||||
@@ -352,6 +360,16 @@ def wxImageFromData(*_args, **_kwargs):
|
||||
if val: val = wxImagePtr(val); val.thisown = 1
|
||||
return val
|
||||
|
||||
def wxImageFromStream(*_args, **_kwargs):
|
||||
val = apply(imagec.wxImageFromStream,_args,_kwargs)
|
||||
if val: val = wxImagePtr(val); val.thisown = 1
|
||||
return val
|
||||
|
||||
def wxImageFromStreamMime(*_args, **_kwargs):
|
||||
val = apply(imagec.wxImageFromStreamMime,_args,_kwargs)
|
||||
if val: val = wxImagePtr(val); val.thisown = 1
|
||||
return val
|
||||
|
||||
wxInitAllImageHandlers = imagec.wxInitAllImageHandlers
|
||||
|
||||
def wxBitmapFromImage(*_args, **_kwargs):
|
||||
@@ -363,6 +381,8 @@ wxImage_CanRead = imagec.wxImage_CanRead
|
||||
|
||||
wxImage_GetImageCount = imagec.wxImage_GetImageCount
|
||||
|
||||
wxImage_CanReadStream = imagec.wxImage_CanReadStream
|
||||
|
||||
wxImage_AddHandler = imagec.wxImage_AddHandler
|
||||
|
||||
wxImage_InsertHandler = imagec.wxImage_InsertHandler
|
||||
|
@@ -91,310 +91,13 @@ static PyObject* t_output_helper(PyObject* target, PyObject* o) {
|
||||
#else
|
||||
static char* wxStringErrorMsg = "String type required";
|
||||
#endif
|
||||
// C++
|
||||
// definitions of wxStringPtrList and wxPyInputStream
|
||||
#include <wx/listimpl.cpp>
|
||||
WX_DEFINE_LIST(wxStringPtrList);
|
||||
|
||||
|
||||
void wxPyInputStream::close() {
|
||||
/* do nothing */
|
||||
}
|
||||
|
||||
void wxPyInputStream::flush() {
|
||||
/*do nothing*/
|
||||
}
|
||||
|
||||
bool wxPyInputStream::eof() {
|
||||
if (wxi)
|
||||
return wxi->Eof();
|
||||
else
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
wxPyInputStream::~wxPyInputStream() {
|
||||
/*do nothing*/
|
||||
}
|
||||
|
||||
wxString* wxPyInputStream::read(int size) {
|
||||
wxString* s = NULL;
|
||||
const int BUFSIZE = 1024;
|
||||
|
||||
// check if we have a real wxInputStream to work with
|
||||
if (!wxi) {
|
||||
PyErr_SetString(PyExc_IOError,"no valid C-wxInputStream below");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if (size < 0) {
|
||||
// init buffers
|
||||
char * buf = new char[BUFSIZE];
|
||||
if (!buf) {
|
||||
PyErr_NoMemory();
|
||||
return NULL;
|
||||
}
|
||||
|
||||
s = new wxString();
|
||||
if (!s) {
|
||||
delete buf;
|
||||
PyErr_NoMemory();
|
||||
return NULL;
|
||||
}
|
||||
|
||||
// read until EOF
|
||||
while (! wxi->Eof()) {
|
||||
wxi->Read(buf, BUFSIZE);
|
||||
//*s += wxString(buf, wxi->LastRead());
|
||||
s->Append(buf, wxi->LastRead());
|
||||
}
|
||||
delete buf;
|
||||
|
||||
// error check
|
||||
if (wxi->LastError() == wxSTREAM_READ_ERROR) {
|
||||
delete s;
|
||||
PyErr_SetString(PyExc_IOError,"IOError in wxInputStream");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
} else { // Read only size number of characters
|
||||
s = new wxString;
|
||||
if (!s) {
|
||||
PyErr_NoMemory();
|
||||
return NULL;
|
||||
}
|
||||
|
||||
// read size bytes
|
||||
wxi->Read(s->GetWriteBuf(size+1), size);
|
||||
s->UngetWriteBuf(wxi->LastRead());
|
||||
|
||||
// error check
|
||||
if (wxi->LastError() == wxSTREAM_READ_ERROR) {
|
||||
delete s;
|
||||
PyErr_SetString(PyExc_IOError,"IOError in wxInputStream");
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
return s;
|
||||
}
|
||||
|
||||
|
||||
wxString* wxPyInputStream::readline (int size) {
|
||||
// check if we have a real wxInputStream to work with
|
||||
if (!wxi) {
|
||||
PyErr_SetString(PyExc_IOError,"no valid C-wxInputStream below");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
// init buffer
|
||||
int i;
|
||||
char ch;
|
||||
wxString* s = new wxString;
|
||||
if (!s) {
|
||||
PyErr_NoMemory();
|
||||
return NULL;
|
||||
}
|
||||
|
||||
// read until \n or byte limit reached
|
||||
for (i=ch=0; (ch != '\n') && (!wxi->Eof()) && ((size < 0) || (i < size)); i++) {
|
||||
*s += ch = wxi->GetC();
|
||||
}
|
||||
|
||||
// errorcheck
|
||||
if (wxi->LastError() == wxSTREAM_READ_ERROR) {
|
||||
delete s;
|
||||
PyErr_SetString(PyExc_IOError,"IOError in wxInputStream");
|
||||
return NULL;
|
||||
}
|
||||
return s;
|
||||
}
|
||||
|
||||
|
||||
wxStringPtrList* wxPyInputStream::readlines (int sizehint) {
|
||||
// check if we have a real wxInputStream to work with
|
||||
if (!wxi) {
|
||||
PyErr_SetString(PyExc_IOError,"no valid C-wxInputStream below");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
// init list
|
||||
wxStringPtrList* l = new wxStringPtrList();
|
||||
if (!l) {
|
||||
PyErr_NoMemory();
|
||||
return NULL;
|
||||
}
|
||||
|
||||
// read sizehint bytes or until EOF
|
||||
int i;
|
||||
for (i=0; (!wxi->Eof()) && ((sizehint < 0) || (i < sizehint));) {
|
||||
wxString* s = readline();
|
||||
if (s == NULL) {
|
||||
l->DeleteContents(TRUE);
|
||||
l->Clear();
|
||||
return NULL;
|
||||
}
|
||||
l->Append(s);
|
||||
i = i + s->Length();
|
||||
}
|
||||
|
||||
// error check
|
||||
if (wxi->LastError() == wxSTREAM_READ_ERROR) {
|
||||
l->DeleteContents(TRUE);
|
||||
l->Clear();
|
||||
PyErr_SetString(PyExc_IOError,"IOError in wxInputStream");
|
||||
return NULL;
|
||||
}
|
||||
return l;
|
||||
}
|
||||
|
||||
|
||||
void wxPyInputStream::seek(int offset, int whence) {
|
||||
if (wxi)
|
||||
wxi->SeekI(offset, wxSeekMode(whence));
|
||||
}
|
||||
|
||||
int wxPyInputStream::tell(){
|
||||
if (wxi)
|
||||
return wxi->TellI();
|
||||
}
|
||||
|
||||
|
||||
|
||||
// wxInputStream which operates on a Python file-like object
|
||||
class wxPyCBInputStream : public wxInputStream {
|
||||
protected:
|
||||
PyObject* read;
|
||||
PyObject* seek;
|
||||
PyObject* tell;
|
||||
PyObject* py;
|
||||
|
||||
virtual size_t OnSysRead(void *buffer, size_t bufsize) {
|
||||
if (bufsize == 0)
|
||||
return 0;
|
||||
|
||||
wxPyBeginBlockThreads();
|
||||
PyObject* arglist = Py_BuildValue("(i)", bufsize);
|
||||
PyObject* result = PyEval_CallObject(read, arglist);
|
||||
Py_DECREF(arglist);
|
||||
|
||||
size_t o = 0;
|
||||
if ((result != NULL) && PyString_Check(result)) {
|
||||
o = PyString_Size(result);
|
||||
if (o == 0)
|
||||
m_lasterror = wxSTREAM_EOF;
|
||||
if (o > bufsize)
|
||||
o = bufsize;
|
||||
strncpy((char*)buffer, PyString_AsString(result), o);
|
||||
Py_DECREF(result);
|
||||
|
||||
}
|
||||
else
|
||||
m_lasterror = wxSTREAM_READ_ERROR;
|
||||
wxPyEndBlockThreads();
|
||||
m_lastcount = o;
|
||||
return o;
|
||||
}
|
||||
|
||||
virtual size_t OnSysWrite(const void *buffer, size_t bufsize){
|
||||
m_lasterror = wxSTREAM_WRITE_ERROR;
|
||||
return 0;
|
||||
}
|
||||
|
||||
virtual off_t OnSysSeek(off_t off, wxSeekMode mode){
|
||||
wxPyBeginBlockThreads();
|
||||
PyObject*arglist = Py_BuildValue("(ii)", off, mode);
|
||||
PyObject*result = PyEval_CallObject(seek, arglist);
|
||||
Py_DECREF(arglist);
|
||||
Py_XDECREF(result);
|
||||
wxPyEndBlockThreads();
|
||||
return OnSysTell();
|
||||
}
|
||||
|
||||
virtual off_t OnSysTell() const{
|
||||
wxPyBeginBlockThreads();
|
||||
PyObject* arglist = Py_BuildValue("()");
|
||||
PyObject* result = PyEval_CallObject(tell, arglist);
|
||||
Py_DECREF(arglist);
|
||||
off_t o = 0;
|
||||
if (result != NULL) {
|
||||
o = PyInt_AsLong(result);
|
||||
Py_DECREF(result);
|
||||
};
|
||||
wxPyEndBlockThreads();
|
||||
return o;
|
||||
}
|
||||
|
||||
wxPyCBInputStream(PyObject *p, PyObject *r, PyObject *s, PyObject *t)
|
||||
: py(p), read(r), seek(s), tell(t)
|
||||
{}
|
||||
|
||||
public:
|
||||
~wxPyCBInputStream() {
|
||||
wxPyBeginBlockThreads();
|
||||
Py_XDECREF(py);
|
||||
Py_XDECREF(read);
|
||||
Py_XDECREF(seek);
|
||||
Py_XDECREF(tell);
|
||||
wxPyEndBlockThreads();
|
||||
}
|
||||
|
||||
virtual size_t GetSize() {
|
||||
if (seek && tell) {
|
||||
off_t temp = OnSysTell();
|
||||
off_t ret = OnSysSeek(0, wxFromEnd);
|
||||
OnSysSeek(temp, wxFromStart);
|
||||
return ret;
|
||||
}
|
||||
else
|
||||
return 0;
|
||||
}
|
||||
|
||||
static wxPyCBInputStream* create(PyObject *py) {
|
||||
PyObject* read;
|
||||
PyObject* seek;
|
||||
PyObject* tell;
|
||||
|
||||
if (!PyInstance_Check(py) && !PyFile_Check(py)) {
|
||||
PyErr_SetString(PyExc_TypeError, "Not a file-like object");
|
||||
Py_XDECREF(py);
|
||||
return NULL;
|
||||
}
|
||||
read = getMethod(py, "read");
|
||||
seek = getMethod(py, "seek");
|
||||
tell = getMethod(py, "tell");
|
||||
|
||||
if (!read) {
|
||||
PyErr_SetString(PyExc_TypeError, "Not a file-like object");
|
||||
Py_XDECREF(py);
|
||||
Py_XDECREF(read);
|
||||
Py_XDECREF(seek);
|
||||
Py_XDECREF(tell);
|
||||
return NULL;
|
||||
}
|
||||
return new wxPyCBInputStream(py, read, seek, tell);
|
||||
}
|
||||
|
||||
static PyObject* getMethod(PyObject* py, char* name) {
|
||||
if (!PyObject_HasAttrString(py, name))
|
||||
return NULL;
|
||||
PyObject* o = PyObject_GetAttrString(py, name);
|
||||
if (!PyMethod_Check(o) && !PyCFunction_Check(o)) {
|
||||
Py_DECREF(o);
|
||||
return NULL;
|
||||
}
|
||||
return o;
|
||||
}
|
||||
|
||||
protected:
|
||||
|
||||
};
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
static wxPyInputStream *new_wxPyInputStream(PyObject *p) {
|
||||
wxInputStream* wxi = wxPyCBInputStream::create(p);
|
||||
if (wxi)
|
||||
return new wxPyInputStream(wxi);
|
||||
wxInputStream* wxis = wxPyCBInputStream::create(p);
|
||||
if (wxis)
|
||||
return new wxPyInputStream(wxis);
|
||||
else
|
||||
return NULL;
|
||||
}
|
||||
|
@@ -5225,6 +5225,71 @@ static PyObject *_wrap_wxWindow_GetSizer(PyObject *self, PyObject *args, PyObjec
|
||||
return _resultobj;
|
||||
}
|
||||
|
||||
#define wxWindow_SetContainingSizer(_swigobj,_swigarg0) (_swigobj->SetContainingSizer(_swigarg0))
|
||||
static PyObject *_wrap_wxWindow_SetContainingSizer(PyObject *self, PyObject *args, PyObject *kwargs) {
|
||||
PyObject * _resultobj;
|
||||
wxWindow * _arg0;
|
||||
wxSizer * _arg1;
|
||||
PyObject * _argo0 = 0;
|
||||
PyObject * _argo1 = 0;
|
||||
char *_kwnames[] = { "self","sizer", NULL };
|
||||
|
||||
self = self;
|
||||
if(!PyArg_ParseTupleAndKeywords(args,kwargs,"OO:wxWindow_SetContainingSizer",_kwnames,&_argo0,&_argo1))
|
||||
return NULL;
|
||||
if (_argo0) {
|
||||
if (_argo0 == Py_None) { _arg0 = NULL; }
|
||||
else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxWindow_p")) {
|
||||
PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxWindow_SetContainingSizer. Expected _wxWindow_p.");
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
if (_argo1) {
|
||||
if (_argo1 == Py_None) { _arg1 = NULL; }
|
||||
else if (SWIG_GetPtrObj(_argo1,(void **) &_arg1,"_wxSizer_p")) {
|
||||
PyErr_SetString(PyExc_TypeError,"Type error in argument 2 of wxWindow_SetContainingSizer. Expected _wxSizer_p.");
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
{
|
||||
PyThreadState* __tstate = wxPyBeginAllowThreads();
|
||||
wxWindow_SetContainingSizer(_arg0,_arg1);
|
||||
|
||||
wxPyEndAllowThreads(__tstate);
|
||||
if (PyErr_Occurred()) return NULL;
|
||||
} Py_INCREF(Py_None);
|
||||
_resultobj = Py_None;
|
||||
return _resultobj;
|
||||
}
|
||||
|
||||
#define wxWindow_GetContainingSizer(_swigobj) (_swigobj->GetContainingSizer())
|
||||
static PyObject *_wrap_wxWindow_GetContainingSizer(PyObject *self, PyObject *args, PyObject *kwargs) {
|
||||
PyObject * _resultobj;
|
||||
wxSizer * _result;
|
||||
wxWindow * _arg0;
|
||||
PyObject * _argo0 = 0;
|
||||
char *_kwnames[] = { "self", NULL };
|
||||
|
||||
self = self;
|
||||
if(!PyArg_ParseTupleAndKeywords(args,kwargs,"O:wxWindow_GetContainingSizer",_kwnames,&_argo0))
|
||||
return NULL;
|
||||
if (_argo0) {
|
||||
if (_argo0 == Py_None) { _arg0 = NULL; }
|
||||
else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxWindow_p")) {
|
||||
PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxWindow_GetContainingSizer. Expected _wxWindow_p.");
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
{
|
||||
PyThreadState* __tstate = wxPyBeginAllowThreads();
|
||||
_result = (wxSizer *)wxWindow_GetContainingSizer(_arg0);
|
||||
|
||||
wxPyEndAllowThreads(__tstate);
|
||||
if (PyErr_Occurred()) return NULL;
|
||||
}{ _resultobj = wxPyMake_wxSizer(_result); }
|
||||
return _resultobj;
|
||||
}
|
||||
|
||||
#define wxWindow_GetValidator(_swigobj) (_swigobj->GetValidator())
|
||||
static PyObject *_wrap_wxWindow_GetValidator(PyObject *self, PyObject *args, PyObject *kwargs) {
|
||||
PyObject * _resultobj;
|
||||
@@ -10341,6 +10406,8 @@ static PyMethodDef windowscMethods[] = {
|
||||
{ "wxWindow_SetDropTarget", (PyCFunction) _wrap_wxWindow_SetDropTarget, METH_VARARGS | METH_KEYWORDS },
|
||||
{ "wxWindow_SetValidator", (PyCFunction) _wrap_wxWindow_SetValidator, METH_VARARGS | METH_KEYWORDS },
|
||||
{ "wxWindow_GetValidator", (PyCFunction) _wrap_wxWindow_GetValidator, METH_VARARGS | METH_KEYWORDS },
|
||||
{ "wxWindow_GetContainingSizer", (PyCFunction) _wrap_wxWindow_GetContainingSizer, METH_VARARGS | METH_KEYWORDS },
|
||||
{ "wxWindow_SetContainingSizer", (PyCFunction) _wrap_wxWindow_SetContainingSizer, METH_VARARGS | METH_KEYWORDS },
|
||||
{ "wxWindow_GetSizer", (PyCFunction) _wrap_wxWindow_GetSizer, METH_VARARGS | METH_KEYWORDS },
|
||||
{ "wxWindow_SetSizer", (PyCFunction) _wrap_wxWindow_SetSizer, METH_VARARGS | METH_KEYWORDS },
|
||||
{ "wxWindow_GetToolTip", (PyCFunction) _wrap_wxWindow_GetToolTip, METH_VARARGS | METH_KEYWORDS },
|
||||
|
@@ -511,6 +511,12 @@ class wxWindowPtr(wxEvtHandlerPtr):
|
||||
def GetSizer(self, *_args, **_kwargs):
|
||||
val = apply(windowsc.wxWindow_GetSizer,(self,) + _args, _kwargs)
|
||||
return val
|
||||
def SetContainingSizer(self, *_args, **_kwargs):
|
||||
val = apply(windowsc.wxWindow_SetContainingSizer,(self,) + _args, _kwargs)
|
||||
return val
|
||||
def GetContainingSizer(self, *_args, **_kwargs):
|
||||
val = apply(windowsc.wxWindow_GetContainingSizer,(self,) + _args, _kwargs)
|
||||
return val
|
||||
def GetValidator(self, *_args, **_kwargs):
|
||||
val = apply(windowsc.wxWindow_GetValidator,(self,) + _args, _kwargs)
|
||||
return val
|
||||
|
Reference in New Issue
Block a user