Images can now be embedded in Python source files.

Added tools to do the embedding.
Added Constructors/methods where needed.
Updated the demo to use mostly embedded images.


git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@9693 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Robin Dunn
2001-04-09 19:36:36 +00:00
parent 28af3deb9f
commit 96bfd05319
50 changed files with 6077 additions and 156 deletions

View File

@@ -105,18 +105,60 @@ public:
};
// Declarations of some alternate "constructors"
%new wxBitmap* wxEmptyBitmap(int width, int height, int depth=-1);
%new wxBitmap* wxBitmapFromXPMData(PyObject* listOfStrings);
%new wxBitmap* wxBitmapFromIcon(const wxIcon& icon);
#ifdef __WXMSW__
%new wxBitmap* wxBitmapFromData(PyObject* data, long type,
int width, int height, int depth = 1);
#endif
%{ // Alternate 'constructor'
%{ // Implementations of some alternate "constructors"
wxBitmap* wxEmptyBitmap(int width, int height, int depth=-1) {
return new wxBitmap(width, height, depth);
}
static char** ConvertListOfStrings(PyObject* listOfStrings) {
char** cArray = NULL;
int count;
if (!PyList_Check(listOfStrings)) {
PyErr_SetString(PyExc_TypeError, "Expected a list of strings.");
return NULL;
}
count = PyList_Size(listOfStrings);
cArray = new char*[count];
for(int x=0; x<count; x++) {
// TODO: Need some validation and error checking here
cArray[x] = PyString_AsString(PyList_GET_ITEM(listOfStrings, x));
}
return cArray;
}
wxBitmap* wxBitmapFromXPMData(PyObject* listOfStrings) {
char** cArray = NULL;
wxBitmap* bmp;
cArray = ConvertListOfStrings(listOfStrings);
if (! cArray)
return NULL;
bmp = new wxBitmap(cArray);
delete [] cArray;
return bmp;
}
wxBitmap* wxBitmapFromIcon(const wxIcon& icon) {
return new wxBitmap(icon);
}
#ifdef __WXMSW__
wxBitmap* wxBitmapFromData(PyObject* data, long type,
int width, int height, int depth = 1) {
@@ -136,6 +178,8 @@ class wxMask {
public:
wxMask(const wxBitmap& bitmap);
//~wxMask();
%addmethods { void Destroy() { delete self; } }
};
%new wxMask* wxMaskColour(const wxBitmap& bitmap, const wxColour& colour);
@@ -174,6 +218,8 @@ public:
#ifdef __WXMSW__
void SetSize(const wxSize& size);
#endif
void CopyFromBitmap(const wxBitmap& bmp);
%pragma(python) addtoclass = "
def __del__(self,gdic=gdic):
try:
@@ -182,10 +228,31 @@ public:
except:
pass
"
};
// Declarations of some alternate "constructors"
%new wxIcon* wxEmptyIcon();
%new wxIcon* wxIconFromXPMData(PyObject* listOfStrings);
%{ // Implementations of some alternate "constructors"
wxIcon* wxEmptyIcon() {
return new wxIcon();
}
wxIcon* wxIconFromXPMData(PyObject* listOfStrings) {
char** cArray = NULL;
wxIcon* icon;
cArray = ConvertListOfStrings(listOfStrings);
if (! cArray)
return NULL;
icon = new wxIcon(cArray);
delete [] cArray;
return icon;
}
%}
//---------------------------------------------------------------------------
class wxCursor

View File

@@ -106,7 +106,8 @@ public:
unsigned char GetGreen( int x, int y );
unsigned char GetBlue( int x, int y );
bool LoadFile( const wxString& name, long type = wxBITMAP_TYPE_PNG );
static bool CanRead( const wxString& name );
bool LoadFile( const wxString& name, long type = wxBITMAP_TYPE_ANY );
%name(LoadMimeFile)bool LoadFile( const wxString& name, const wxString& mimetype );
bool SaveFile( const wxString& name, int type );
@@ -163,6 +164,9 @@ public:
unsigned long CountColours( unsigned long stopafter = (unsigned long) -1 );
// TODO: unsigned long ComputeHistogram( wxHashTable &h );
static void AddHandler( wxImageHandler *handler );
static void InsertHandler( wxImageHandler *handler );
static bool RemoveHandler( const wxString& name );
};
// Alternate constructors
@@ -188,13 +192,6 @@ public:
}
%}
// Static Methods
void wxImage_AddHandler(wxImageHandler *handler);
%{
void wxImage_AddHandler(wxImageHandler *handler) {
wxImage::AddHandler(handler);
}
%}
void wxInitAllImageHandlers();

View File

@@ -111,11 +111,48 @@ static PyObject* t_output_helper(PyObject* target, PyObject* o) {
static char* wxStringErrorMsg = "string type is required for parameter";
static wxString wxPyEmptyStr("");
// Alternate 'constructor'
// Implementations of some alternate "constructors"
wxBitmap* wxEmptyBitmap(int width, int height, int depth=-1) {
return new wxBitmap(width, height, depth);
}
static char** ConvertListOfStrings(PyObject* listOfStrings) {
char** cArray = NULL;
int count;
if (!PyList_Check(listOfStrings)) {
PyErr_SetString(PyExc_TypeError, "Expected a list of strings.");
return NULL;
}
count = PyList_Size(listOfStrings);
cArray = new char*[count];
for(int x=0; x<count; x++) {
// TODO: Need some validation and error checking here
cArray[x] = PyString_AsString(PyList_GET_ITEM(listOfStrings, x));
}
return cArray;
}
wxBitmap* wxBitmapFromXPMData(PyObject* listOfStrings) {
char** cArray = NULL;
wxBitmap* bmp;
cArray = ConvertListOfStrings(listOfStrings);
if (! cArray)
return NULL;
bmp = new wxBitmap(cArray);
delete [] cArray;
return bmp;
}
wxBitmap* wxBitmapFromIcon(const wxIcon& icon) {
return new wxBitmap(icon);
}
#ifdef __WXMSW__
wxBitmap* wxBitmapFromData(PyObject* data, long type,
int width, int height, int depth = 1) {
@@ -130,6 +167,22 @@ static char* wxStringErrorMsg = "string type is required for parameter";
wxMask* wxMaskColour(const wxBitmap& bitmap, const wxColour& colour) {
return new wxMask(bitmap, colour);
}
// Implementations of some alternate "constructors"
wxIcon* wxEmptyIcon() {
return new wxIcon();
}
wxIcon* wxIconFromXPMData(PyObject* listOfStrings) {
char** cArray = NULL;
wxIcon* icon;
cArray = ConvertListOfStrings(listOfStrings);
if (! cArray)
return NULL;
icon = new wxIcon(cArray);
delete [] cArray;
return icon;
}
// Alternate 'constructor'
wxCursor* wxPyStockCursor(int id) {
@@ -231,6 +284,68 @@ static PyObject *_wrap_wxEmptyBitmap(PyObject *self, PyObject *args, PyObject *k
return _resultobj;
}
static PyObject *_wrap_wxBitmapFromXPMData(PyObject *self, PyObject *args, PyObject *kwargs) {
PyObject * _resultobj;
wxBitmap * _result;
PyObject * _arg0;
PyObject * _obj0 = 0;
char *_kwnames[] = { "listOfStrings", NULL };
char _ptemp[128];
self = self;
if(!PyArg_ParseTupleAndKeywords(args,kwargs,"O:wxBitmapFromXPMData",_kwnames,&_obj0))
return NULL;
{
_arg0 = _obj0;
}
{
wxPy_BEGIN_ALLOW_THREADS;
_result = (wxBitmap *)wxBitmapFromXPMData(_arg0);
wxPy_END_ALLOW_THREADS;
} if (_result) {
SWIG_MakePtr(_ptemp, (char *) _result,"_wxBitmap_p");
_resultobj = Py_BuildValue("s",_ptemp);
} else {
Py_INCREF(Py_None);
_resultobj = Py_None;
}
return _resultobj;
}
static PyObject *_wrap_wxBitmapFromIcon(PyObject *self, PyObject *args, PyObject *kwargs) {
PyObject * _resultobj;
wxBitmap * _result;
wxIcon * _arg0;
PyObject * _argo0 = 0;
char *_kwnames[] = { "icon", NULL };
char _ptemp[128];
self = self;
if(!PyArg_ParseTupleAndKeywords(args,kwargs,"O:wxBitmapFromIcon",_kwnames,&_argo0))
return NULL;
if (_argo0) {
if (_argo0 == Py_None) { _arg0 = NULL; }
else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxIcon_p")) {
PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxBitmapFromIcon. Expected _wxIcon_p.");
return NULL;
}
}
{
wxPy_BEGIN_ALLOW_THREADS;
_result = (wxBitmap *)wxBitmapFromIcon(*_arg0);
wxPy_END_ALLOW_THREADS;
} if (_result) {
SWIG_MakePtr(_ptemp, (char *) _result,"_wxBitmap_p");
_resultobj = Py_BuildValue("s",_ptemp);
} else {
Py_INCREF(Py_None);
_resultobj = Py_None;
}
return _resultobj;
}
static PyObject *_wrap_wxBitmapFromData(PyObject *self, PyObject *args, PyObject *kwargs) {
PyObject * _resultobj;
wxBitmap * _result;
@@ -305,6 +420,59 @@ static PyObject *_wrap_wxMaskColour(PyObject *self, PyObject *args, PyObject *kw
return _resultobj;
}
static PyObject *_wrap_wxEmptyIcon(PyObject *self, PyObject *args, PyObject *kwargs) {
PyObject * _resultobj;
wxIcon * _result;
char *_kwnames[] = { NULL };
char _ptemp[128];
self = self;
if(!PyArg_ParseTupleAndKeywords(args,kwargs,":wxEmptyIcon",_kwnames))
return NULL;
{
wxPy_BEGIN_ALLOW_THREADS;
_result = (wxIcon *)wxEmptyIcon();
wxPy_END_ALLOW_THREADS;
} if (_result) {
SWIG_MakePtr(_ptemp, (char *) _result,"_wxIcon_p");
_resultobj = Py_BuildValue("s",_ptemp);
} else {
Py_INCREF(Py_None);
_resultobj = Py_None;
}
return _resultobj;
}
static PyObject *_wrap_wxIconFromXPMData(PyObject *self, PyObject *args, PyObject *kwargs) {
PyObject * _resultobj;
wxIcon * _result;
PyObject * _arg0;
PyObject * _obj0 = 0;
char *_kwnames[] = { "listOfStrings", NULL };
char _ptemp[128];
self = self;
if(!PyArg_ParseTupleAndKeywords(args,kwargs,"O:wxIconFromXPMData",_kwnames,&_obj0))
return NULL;
{
_arg0 = _obj0;
}
{
wxPy_BEGIN_ALLOW_THREADS;
_result = (wxIcon *)wxIconFromXPMData(_arg0);
wxPy_END_ALLOW_THREADS;
} if (_result) {
SWIG_MakePtr(_ptemp, (char *) _result,"_wxIcon_p");
_resultobj = Py_BuildValue("s",_ptemp);
} else {
Py_INCREF(Py_None);
_resultobj = Py_None;
}
return _resultobj;
}
static PyObject *_wrap_wxStockCursor(PyObject *self, PyObject *args, PyObject *kwargs) {
PyObject * _resultobj;
wxCursor * _result;
@@ -1946,6 +2114,33 @@ static PyObject *_wrap_new_wxMask(PyObject *self, PyObject *args, PyObject *kwar
return _resultobj;
}
static void wxMask_Destroy(wxMask *self) { delete self; }
static PyObject *_wrap_wxMask_Destroy(PyObject *self, PyObject *args, PyObject *kwargs) {
PyObject * _resultobj;
wxMask * _arg0;
PyObject * _argo0 = 0;
char *_kwnames[] = { "self", NULL };
self = self;
if(!PyArg_ParseTupleAndKeywords(args,kwargs,"O:wxMask_Destroy",_kwnames,&_argo0))
return NULL;
if (_argo0) {
if (_argo0 == Py_None) { _arg0 = NULL; }
else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxMask_p")) {
PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxMask_Destroy. Expected _wxMask_p.");
return NULL;
}
}
{
wxPy_BEGIN_ALLOW_THREADS;
wxMask_Destroy(_arg0);
wxPy_END_ALLOW_THREADS;
} Py_INCREF(Py_None);
_resultobj = Py_None;
return _resultobj;
}
#define new_wxIcon(_swigarg0,_swigarg1,_swigarg2,_swigarg3) (new wxIcon(_swigarg0,_swigarg1,_swigarg2,_swigarg3))
static PyObject *_wrap_new_wxIcon(PyObject *self, PyObject *args, PyObject *kwargs) {
PyObject * _resultobj;
@@ -2359,6 +2554,42 @@ static PyObject *_wrap_wxIcon_SetSize(PyObject *self, PyObject *args, PyObject *
return _resultobj;
}
#define wxIcon_CopyFromBitmap(_swigobj,_swigarg0) (_swigobj->CopyFromBitmap(_swigarg0))
static PyObject *_wrap_wxIcon_CopyFromBitmap(PyObject *self, PyObject *args, PyObject *kwargs) {
PyObject * _resultobj;
wxIcon * _arg0;
wxBitmap * _arg1;
PyObject * _argo0 = 0;
PyObject * _argo1 = 0;
char *_kwnames[] = { "self","bmp", NULL };
self = self;
if(!PyArg_ParseTupleAndKeywords(args,kwargs,"OO:wxIcon_CopyFromBitmap",_kwnames,&_argo0,&_argo1))
return NULL;
if (_argo0) {
if (_argo0 == Py_None) { _arg0 = NULL; }
else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxIcon_p")) {
PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxIcon_CopyFromBitmap. Expected _wxIcon_p.");
return NULL;
}
}
if (_argo1) {
if (_argo1 == Py_None) { _arg1 = NULL; }
else if (SWIG_GetPtrObj(_argo1,(void **) &_arg1,"_wxBitmap_p")) {
PyErr_SetString(PyExc_TypeError,"Type error in argument 2 of wxIcon_CopyFromBitmap. Expected _wxBitmap_p.");
return NULL;
}
}
{
wxPy_BEGIN_ALLOW_THREADS;
wxIcon_CopyFromBitmap(_arg0,*_arg1);
wxPy_END_ALLOW_THREADS;
} Py_INCREF(Py_None);
_resultobj = Py_None;
return _resultobj;
}
#define new_wxCursor(_swigarg0,_swigarg1,_swigarg2,_swigarg3) (new wxCursor(_swigarg0,_swigarg1,_swigarg2,_swigarg3))
static PyObject *_wrap_new_wxCursor(PyObject *self, PyObject *args, PyObject *kwargs) {
PyObject * _resultobj;
@@ -9033,6 +9264,7 @@ static PyMethodDef gdicMethods[] = {
{ "wxCursor_GetHandle", (PyCFunction) _wrap_wxCursor_GetHandle, METH_VARARGS | METH_KEYWORDS },
{ "delete_wxCursor", (PyCFunction) _wrap_delete_wxCursor, METH_VARARGS | METH_KEYWORDS },
{ "new_wxCursor", (PyCFunction) _wrap_new_wxCursor, METH_VARARGS | METH_KEYWORDS },
{ "wxIcon_CopyFromBitmap", (PyCFunction) _wrap_wxIcon_CopyFromBitmap, METH_VARARGS | METH_KEYWORDS },
{ "wxIcon_SetSize", (PyCFunction) _wrap_wxIcon_SetSize, METH_VARARGS | METH_KEYWORDS },
{ "wxIcon_SetDepth", (PyCFunction) _wrap_wxIcon_SetDepth, METH_VARARGS | METH_KEYWORDS },
{ "wxIcon_SetHeight", (PyCFunction) _wrap_wxIcon_SetHeight, METH_VARARGS | METH_KEYWORDS },
@@ -9046,6 +9278,7 @@ static PyMethodDef gdicMethods[] = {
{ "wxIcon_LoadFile", (PyCFunction) _wrap_wxIcon_LoadFile, METH_VARARGS | METH_KEYWORDS },
{ "delete_wxIcon", (PyCFunction) _wrap_delete_wxIcon, METH_VARARGS | METH_KEYWORDS },
{ "new_wxIcon", (PyCFunction) _wrap_new_wxIcon, METH_VARARGS | METH_KEYWORDS },
{ "wxMask_Destroy", (PyCFunction) _wrap_wxMask_Destroy, METH_VARARGS | METH_KEYWORDS },
{ "new_wxMask", (PyCFunction) _wrap_new_wxMask, METH_VARARGS | METH_KEYWORDS },
{ "wxBitmap_SetQuality", (PyCFunction) _wrap_wxBitmap_SetQuality, METH_VARARGS | METH_KEYWORDS },
{ "wxBitmap_GetQuality", (PyCFunction) _wrap_wxBitmap_GetQuality, METH_VARARGS | METH_KEYWORDS },
@@ -9075,8 +9308,12 @@ static PyMethodDef gdicMethods[] = {
{ "wxFont_SetDefaultEncoding", (PyCFunction) _wrap_wxFont_SetDefaultEncoding, METH_VARARGS | METH_KEYWORDS },
{ "wxFont_GetDefaultEncoding", (PyCFunction) _wrap_wxFont_GetDefaultEncoding, METH_VARARGS | METH_KEYWORDS },
{ "wxStockCursor", (PyCFunction) _wrap_wxStockCursor, METH_VARARGS | METH_KEYWORDS },
{ "wxIconFromXPMData", (PyCFunction) _wrap_wxIconFromXPMData, METH_VARARGS | METH_KEYWORDS },
{ "wxEmptyIcon", (PyCFunction) _wrap_wxEmptyIcon, METH_VARARGS | METH_KEYWORDS },
{ "wxMaskColour", (PyCFunction) _wrap_wxMaskColour, METH_VARARGS | METH_KEYWORDS },
{ "wxBitmapFromData", (PyCFunction) _wrap_wxBitmapFromData, METH_VARARGS | METH_KEYWORDS },
{ "wxBitmapFromIcon", (PyCFunction) _wrap_wxBitmapFromIcon, METH_VARARGS | METH_KEYWORDS },
{ "wxBitmapFromXPMData", (PyCFunction) _wrap_wxBitmapFromXPMData, METH_VARARGS | METH_KEYWORDS },
{ "wxEmptyBitmap", (PyCFunction) _wrap_wxEmptyBitmap, METH_VARARGS | METH_KEYWORDS },
{ NULL, NULL }
};

View File

@@ -97,6 +97,9 @@ class wxMaskPtr :
def __init__(self,this):
self.this = this
self.thisown = 0
def Destroy(self, *_args, **_kwargs):
val = apply(gdic.wxMask_Destroy,(self,) + _args, _kwargs)
return val
def __repr__(self):
return "<C wxMask instance at %s>" % (self.this,)
class wxMask(wxMaskPtr):
@@ -147,6 +150,9 @@ class wxIconPtr :
def SetSize(self, *_args, **_kwargs):
val = apply(gdic.wxIcon_SetSize,(self,) + _args, _kwargs)
return val
def CopyFromBitmap(self, *_args, **_kwargs):
val = apply(gdic.wxIcon_CopyFromBitmap,(self,) + _args, _kwargs)
return val
def __repr__(self):
return "<C wxIcon instance at %s>" % (self.this,)
@@ -976,6 +982,16 @@ def wxEmptyBitmap(*_args, **_kwargs):
if val: val = wxBitmapPtr(val); val.thisown = 1
return val
def wxBitmapFromXPMData(*_args, **_kwargs):
val = apply(gdic.wxBitmapFromXPMData,_args,_kwargs)
if val: val = wxBitmapPtr(val); val.thisown = 1
return val
def wxBitmapFromIcon(*_args, **_kwargs):
val = apply(gdic.wxBitmapFromIcon,_args,_kwargs)
if val: val = wxBitmapPtr(val); val.thisown = 1
return val
def wxBitmapFromData(*_args, **_kwargs):
val = apply(gdic.wxBitmapFromData,_args,_kwargs)
if val: val = wxBitmapPtr(val); val.thisown = 1
@@ -986,6 +1002,16 @@ def wxMaskColour(*_args, **_kwargs):
if val: val = wxMaskPtr(val); val.thisown = 1
return val
def wxEmptyIcon(*_args, **_kwargs):
val = apply(gdic.wxEmptyIcon,_args,_kwargs)
if val: val = wxIconPtr(val); val.thisown = 1
return val
def wxIconFromXPMData(*_args, **_kwargs):
val = apply(gdic.wxIconFromXPMData,_args,_kwargs)
if val: val = wxIconPtr(val); val.thisown = 1
return val
def wxStockCursor(*_args, **_kwargs):
val = apply(gdic.wxStockCursor,_args,_kwargs)
if val: val = wxCursorPtr(val); val.thisown = 1

View File

@@ -121,10 +121,6 @@ static char* wxStringErrorMsg = "string type is required for parameter";
wxImage* wxImageFromBitmap(const wxBitmap &bitmap) {
return new wxImage(bitmap);
}
void wxImage_AddHandler(wxImageHandler *handler) {
wxImage::AddHandler(handler);
}
#ifdef __cplusplus
extern "C" {
#endif
@@ -283,32 +279,6 @@ static PyObject *_wrap_wxImageFromBitmap(PyObject *self, PyObject *args, PyObjec
return _resultobj;
}
static PyObject *_wrap_wxImage_AddHandler(PyObject *self, PyObject *args, PyObject *kwargs) {
PyObject * _resultobj;
wxImageHandler * _arg0;
PyObject * _argo0 = 0;
char *_kwnames[] = { "handler", NULL };
self = self;
if(!PyArg_ParseTupleAndKeywords(args,kwargs,"O:wxImage_AddHandler",_kwnames,&_argo0))
return NULL;
if (_argo0) {
if (_argo0 == Py_None) { _arg0 = NULL; }
else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxImageHandler_p")) {
PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxImage_AddHandler. Expected _wxImageHandler_p.");
return NULL;
}
}
{
wxPy_BEGIN_ALLOW_THREADS;
wxImage_AddHandler(_arg0);
wxPy_END_ALLOW_THREADS;
} Py_INCREF(Py_None);
_resultobj = Py_None;
return _resultobj;
}
static PyObject *_wrap_wxInitAllImageHandlers(PyObject *self, PyObject *args, PyObject *kwargs) {
PyObject * _resultobj;
char *_kwnames[] = { NULL };
@@ -1210,13 +1180,54 @@ static PyObject *_wrap_wxImage_GetBlue(PyObject *self, PyObject *args, PyObject
return _resultobj;
}
static PyObject *_wrap_wxImage_CanRead(PyObject *self, PyObject *args, PyObject *kwargs) {
PyObject * _resultobj;
bool _result;
wxString * _arg0;
PyObject * _obj0 = 0;
char *_kwnames[] = { "name", NULL };
self = self;
if(!PyArg_ParseTupleAndKeywords(args,kwargs,"O:wxImage_CanRead",_kwnames,&_obj0))
return NULL;
{
#if PYTHON_API_VERSION >= 1009
char* tmpPtr; int tmpSize;
if (!PyString_Check(_obj0) && !PyUnicode_Check(_obj0)) {
PyErr_SetString(PyExc_TypeError, "String or Unicode type required");
return NULL;
}
if (PyString_AsStringAndSize(_obj0, &tmpPtr, &tmpSize) == -1)
return NULL;
_arg0 = new wxString(tmpPtr, tmpSize);
#else
if (!PyString_Check(_obj0)) {
PyErr_SetString(PyExc_TypeError, wxStringErrorMsg);
return NULL;
}
_arg0 = new wxString(PyString_AS_STRING(_obj0), PyString_GET_SIZE(_obj0));
#endif
}
{
wxPy_BEGIN_ALLOW_THREADS;
_result = (bool )wxImage::CanRead(*_arg0);
wxPy_END_ALLOW_THREADS;
} _resultobj = Py_BuildValue("i",_result);
{
if (_obj0)
delete _arg0;
}
return _resultobj;
}
#define wxImage_LoadFile(_swigobj,_swigarg0,_swigarg1) (_swigobj->LoadFile(_swigarg0,_swigarg1))
static PyObject *_wrap_wxImage_LoadFile(PyObject *self, PyObject *args, PyObject *kwargs) {
PyObject * _resultobj;
bool _result;
wxImage * _arg0;
wxString * _arg1;
long _arg2 = (long ) wxBITMAP_TYPE_PNG;
long _arg2 = (long ) wxBITMAP_TYPE_ANY;
PyObject * _argo0 = 0;
PyObject * _obj1 = 0;
char *_kwnames[] = { "self","name","type", NULL };
@@ -2069,7 +2080,103 @@ static PyObject *_wrap_wxImage_CountColours(PyObject *self, PyObject *args, PyOb
return _resultobj;
}
static PyObject *_wrap_wxImage_AddHandler(PyObject *self, PyObject *args, PyObject *kwargs) {
PyObject * _resultobj;
wxImageHandler * _arg0;
PyObject * _argo0 = 0;
char *_kwnames[] = { "handler", NULL };
self = self;
if(!PyArg_ParseTupleAndKeywords(args,kwargs,"O:wxImage_AddHandler",_kwnames,&_argo0))
return NULL;
if (_argo0) {
if (_argo0 == Py_None) { _arg0 = NULL; }
else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxImageHandler_p")) {
PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxImage_AddHandler. Expected _wxImageHandler_p.");
return NULL;
}
}
{
wxPy_BEGIN_ALLOW_THREADS;
wxImage::AddHandler(_arg0);
wxPy_END_ALLOW_THREADS;
} Py_INCREF(Py_None);
_resultobj = Py_None;
return _resultobj;
}
static PyObject *_wrap_wxImage_InsertHandler(PyObject *self, PyObject *args, PyObject *kwargs) {
PyObject * _resultobj;
wxImageHandler * _arg0;
PyObject * _argo0 = 0;
char *_kwnames[] = { "handler", NULL };
self = self;
if(!PyArg_ParseTupleAndKeywords(args,kwargs,"O:wxImage_InsertHandler",_kwnames,&_argo0))
return NULL;
if (_argo0) {
if (_argo0 == Py_None) { _arg0 = NULL; }
else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxImageHandler_p")) {
PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxImage_InsertHandler. Expected _wxImageHandler_p.");
return NULL;
}
}
{
wxPy_BEGIN_ALLOW_THREADS;
wxImage::InsertHandler(_arg0);
wxPy_END_ALLOW_THREADS;
} Py_INCREF(Py_None);
_resultobj = Py_None;
return _resultobj;
}
static PyObject *_wrap_wxImage_RemoveHandler(PyObject *self, PyObject *args, PyObject *kwargs) {
PyObject * _resultobj;
bool _result;
wxString * _arg0;
PyObject * _obj0 = 0;
char *_kwnames[] = { "name", NULL };
self = self;
if(!PyArg_ParseTupleAndKeywords(args,kwargs,"O:wxImage_RemoveHandler",_kwnames,&_obj0))
return NULL;
{
#if PYTHON_API_VERSION >= 1009
char* tmpPtr; int tmpSize;
if (!PyString_Check(_obj0) && !PyUnicode_Check(_obj0)) {
PyErr_SetString(PyExc_TypeError, "String or Unicode type required");
return NULL;
}
if (PyString_AsStringAndSize(_obj0, &tmpPtr, &tmpSize) == -1)
return NULL;
_arg0 = new wxString(tmpPtr, tmpSize);
#else
if (!PyString_Check(_obj0)) {
PyErr_SetString(PyExc_TypeError, wxStringErrorMsg);
return NULL;
}
_arg0 = new wxString(PyString_AS_STRING(_obj0), PyString_GET_SIZE(_obj0));
#endif
}
{
wxPy_BEGIN_ALLOW_THREADS;
_result = (bool )wxImage::RemoveHandler(*_arg0);
wxPy_END_ALLOW_THREADS;
} _resultobj = Py_BuildValue("i",_result);
{
if (_obj0)
delete _arg0;
}
return _resultobj;
}
static PyMethodDef imagecMethods[] = {
{ "wxImage_RemoveHandler", (PyCFunction) _wrap_wxImage_RemoveHandler, METH_VARARGS | METH_KEYWORDS },
{ "wxImage_InsertHandler", (PyCFunction) _wrap_wxImage_InsertHandler, METH_VARARGS | METH_KEYWORDS },
{ "wxImage_AddHandler", (PyCFunction) _wrap_wxImage_AddHandler, METH_VARARGS | METH_KEYWORDS },
{ "wxImage_CountColours", (PyCFunction) _wrap_wxImage_CountColours, METH_VARARGS | METH_KEYWORDS },
{ "wxImage_Replace", (PyCFunction) _wrap_wxImage_Replace, METH_VARARGS | METH_KEYWORDS },
{ "wxImage_Mirror", (PyCFunction) _wrap_wxImage_Mirror, METH_VARARGS | METH_KEYWORDS },
@@ -2093,6 +2200,7 @@ static PyMethodDef imagecMethods[] = {
{ "wxImage_SaveFile", (PyCFunction) _wrap_wxImage_SaveFile, METH_VARARGS | METH_KEYWORDS },
{ "wxImage_LoadMimeFile", (PyCFunction) _wrap_wxImage_LoadMimeFile, METH_VARARGS | METH_KEYWORDS },
{ "wxImage_LoadFile", (PyCFunction) _wrap_wxImage_LoadFile, METH_VARARGS | METH_KEYWORDS },
{ "wxImage_CanRead", (PyCFunction) _wrap_wxImage_CanRead, METH_VARARGS | METH_KEYWORDS },
{ "wxImage_GetBlue", (PyCFunction) _wrap_wxImage_GetBlue, METH_VARARGS | METH_KEYWORDS },
{ "wxImage_GetGreen", (PyCFunction) _wrap_wxImage_GetGreen, METH_VARARGS | METH_KEYWORDS },
{ "wxImage_GetRed", (PyCFunction) _wrap_wxImage_GetRed, METH_VARARGS | METH_KEYWORDS },
@@ -2120,7 +2228,6 @@ static PyMethodDef imagecMethods[] = {
{ "wxImageHandler_GetExtension", (PyCFunction) _wrap_wxImageHandler_GetExtension, METH_VARARGS | METH_KEYWORDS },
{ "wxImageHandler_GetName", (PyCFunction) _wrap_wxImageHandler_GetName, METH_VARARGS | METH_KEYWORDS },
{ "wxInitAllImageHandlers", (PyCFunction) _wrap_wxInitAllImageHandlers, METH_VARARGS | METH_KEYWORDS },
{ "wxImage_AddHandler", (PyCFunction) _wrap_wxImage_AddHandler, METH_VARARGS | METH_KEYWORDS },
{ "wxImageFromBitmap", (PyCFunction) _wrap_wxImageFromBitmap, METH_VARARGS | METH_KEYWORDS },
{ "wxImageFromMime", (PyCFunction) _wrap_wxImageFromMime, METH_VARARGS | METH_KEYWORDS },
{ "wxEmptyImage", (PyCFunction) _wrap_wxEmptyImage, METH_VARARGS | METH_KEYWORDS },

View File

@@ -284,9 +284,15 @@ def wxImageFromBitmap(*_args, **_kwargs):
if val: val = wxImagePtr(val); val.thisown = 1
return val
wxInitAllImageHandlers = imagec.wxInitAllImageHandlers
wxImage_CanRead = imagec.wxImage_CanRead
wxImage_AddHandler = imagec.wxImage_AddHandler
wxInitAllImageHandlers = imagec.wxInitAllImageHandlers
wxImage_InsertHandler = imagec.wxImage_InsertHandler
wxImage_RemoveHandler = imagec.wxImage_RemoveHandler