return _misc_.GetTopLevelParent(*args, **kwargs)
def GetKeyState(*args, **kwargs):
- """GetKeyState(int key) -> bool"""
+ """
+ GetKeyState(int key) -> bool
+
+ Get the state of a key (true if pressed or toggled on, false if not.)
+ This is generally most useful getting the state of the modifier or
+ toggle keys. On some platforms those may be the only keys that work.
+
+ """
return _misc_.GetKeyState(*args, **kwargs)
def WakeUpMainThread(*args, **kwargs):
class DataObject(object):
"""
- A wxDataObject represents data that can be copied to or from the
+ A wx.DataObject represents data that can be copied to or from the
clipboard, or dragged and dropped. The important thing about
- wxDataObject is that this is a 'smart' piece of data unlike usual
+ wx.DataObject is that this is a 'smart' piece of data unlike usual
'dumb' data containers such as memory buffers or files. Being 'smart'
here means that the data object itself should know what data formats
it supports and how to render itself in each of supported formats.
+ **NOTE**: This class is an abstract base class and can not be used
+ directly from Python. If you need a custom type of data object then
+ you should instead derive from `wx.PyDataObjectSimple` or use
+ `wx.CustomDataObject`.
"""
def __init__(self): raise RuntimeError, "No constructor defined"
except: pass
def GetPreferredFormat(*args, **kwargs):
- """GetPreferredFormat(self, int dir=Get) -> DataFormat"""
+ """
+ GetPreferredFormat(self, int dir=Get) -> DataFormat
+
+ Returns the preferred format for either rendering the data (if dir is
+ Get, its default value) or for setting it. Usually this will be the
+ native format of the wx.DataObject.
+ """
return _misc_.DataObject_GetPreferredFormat(*args, **kwargs)
def GetFormatCount(*args, **kwargs):
- """GetFormatCount(self, int dir=Get) -> size_t"""
+ """
+ GetFormatCount(self, int dir=Get) -> size_t
+
+ Returns the number of available formats for rendering or setting the
+ data.
+ """
return _misc_.DataObject_GetFormatCount(*args, **kwargs)
def IsSupported(*args, **kwargs):
- """IsSupported(self, DataFormat format, int dir=Get) -> bool"""
+ """
+ IsSupported(self, DataFormat format, int dir=Get) -> bool
+
+ Returns True if this format is supported.
+ """
return _misc_.DataObject_IsSupported(*args, **kwargs)
def GetDataSize(*args, **kwargs):
- """GetDataSize(self, DataFormat format) -> size_t"""
+ """
+ GetDataSize(self, DataFormat format) -> size_t
+
+ Get the (total) size of data for the given format
+ """
return _misc_.DataObject_GetDataSize(*args, **kwargs)
def GetAllFormats(*args, **kwargs):
- """GetAllFormats(self, DataFormat formats, int dir=Get)"""
+ """
+ GetAllFormats(self, int dir=Get) -> [formats]
+
+ Returns a list of all the wx.DataFormats that this dataobject supports
+ in the given direction.
+ """
return _misc_.DataObject_GetAllFormats(*args, **kwargs)
def GetDataHere(*args, **kwargs):
- """GetDataHere(self, DataFormat format, void buf) -> bool"""
+ """
+ GetDataHere(self, DataFormat format) -> String
+
+ Get the data bytes in the specified format, returns None on failure.
+
+ """
return _misc_.DataObject_GetDataHere(*args, **kwargs)
def SetData(*args, **kwargs):
- """SetData(self, DataFormat format, size_t len, void buf) -> bool"""
+ """
+ SetData(self, DataFormat format, String data) -> bool
+
+ Set the data in the specified format from the bytes in the the data string.
+
+ """
return _misc_.DataObject_SetData(*args, **kwargs)
FormatInvalid = cvar.FormatInvalid
class DataObjectSimple(DataObject):
+ """
+ wx.DataObjectSimple is a `wx.DataObject` which only supports one
+ format. This is the simplest possible `wx.DataObject` implementation.
+
+ This is still an "abstract base class" meaning that you can't use it
+ directly. You either need to use one of the predefined base classes,
+ or derive your own class from `wx.PyDataObjectSimple`.
+
+ """
def __repr__(self):
return "<%s.%s; proxy of C++ wxDataObjectSimple instance at %s>" % (self.__class__.__module__, self.__class__.__name__, self.this,)
def __init__(self, *args, **kwargs):
- """__init__(self, DataFormat format=FormatInvalid) -> DataObjectSimple"""
+ """
+ __init__(self, DataFormat format=FormatInvalid) -> DataObjectSimple
+
+ Constructor accepts the supported format (none by default) which may
+ also be set later with `SetFormat`.
+ """
newobj = _misc_.new_DataObjectSimple(*args, **kwargs)
self.this = newobj.this
self.thisown = 1
del newobj.thisown
def GetFormat(*args, **kwargs):
- """GetFormat(self) -> DataFormat"""
+ """
+ GetFormat(self) -> DataFormat
+
+ Returns the (one and only one) format supported by this object. It is
+ assumed that the format is supported in both directions.
+ """
return _misc_.DataObjectSimple_GetFormat(*args, **kwargs)
def SetFormat(*args, **kwargs):
- """SetFormat(self, DataFormat format)"""
+ """
+ SetFormat(self, DataFormat format)
+
+ Sets the supported format.
+ """
return _misc_.DataObjectSimple_SetFormat(*args, **kwargs)
+ def GetDataSize(*args, **kwargs):
+ """
+ GetDataSize(self) -> size_t
+
+ Get the size of our data.
+ """
+ return _misc_.DataObjectSimple_GetDataSize(*args, **kwargs)
+
+ def GetDataHere(*args, **kwargs):
+ """
+ GetDataHere(self) -> String
+
+ Returns the data bytes from the data object as a string, returns None
+ on failure. Must be implemented in the derived class if the object
+ supports rendering its data.
+ """
+ return _misc_.DataObjectSimple_GetDataHere(*args, **kwargs)
+
+ def SetData(*args, **kwargs):
+ """
+ SetData(self, String data) -> bool
+
+ Copy the data value to the data object. Must be implemented in the
+ derived class if the object supports setting its data.
+
+ """
+ return _misc_.DataObjectSimple_SetData(*args, **kwargs)
+
class DataObjectSimplePtr(DataObjectSimple):
def __init__(self, this):
_misc_.DataObjectSimple_swigregister(DataObjectSimplePtr)
class PyDataObjectSimple(DataObjectSimple):
+ """
+ wx.PyDataObjectSimple is a version of `wx.DataObjectSimple` that is
+ Python-aware and knows how to reflect calls to its C++ virtual methods
+ to methods in the Python derived class. You should derive from this
+ class and overload `GetDataSize`, `GetDataHere` and `SetData` when you
+ need to create your own simple single-format type of `wx.DataObject`.
+
+ """
def __repr__(self):
return "<%s.%s; proxy of C++ wxPyDataObjectSimple instance at %s>" % (self.__class__.__module__, self.__class__.__name__, self.this,)
def __init__(self, *args, **kwargs):
- """__init__(self, DataFormat format=FormatInvalid) -> PyDataObjectSimple"""
+ """
+ __init__(self, DataFormat format=FormatInvalid) -> PyDataObjectSimple
+
+ wx.PyDataObjectSimple is a version of `wx.DataObjectSimple` that is
+ Python-aware and knows how to reflect calls to its C++ virtual methods
+ to methods in the Python derived class. You should derive from this
+ class and overload `GetDataSize`, `GetDataHere` and `SetData` when you
+ need to create your own simple single-format type of `wx.DataObject`.
+
+ """
newobj = _misc_.new_PyDataObjectSimple(*args, **kwargs)
self.this = newobj.this
self.thisown = 1
_misc_.PyDataObjectSimple_swigregister(PyDataObjectSimplePtr)
class DataObjectComposite(DataObject):
+ """
+ wx.DataObjectComposite is the simplest `wx.DataObject` derivation
+ which may be sued to support multiple formats. It contains several
+ 'wx.DataObjectSimple` objects and supports any format supported by at
+ least one of them. Only one of these data objects is *preferred* (the
+ first one if not explicitly changed by using the second parameter of
+ `Add`) and its format determines the preferred format of the composite
+ data object as well.
+
+ See `wx.DataObject` documentation for the reasons why you might prefer
+ to use wx.DataObject directly instead of wx.DataObjectComposite for
+ efficiency reasons.
+
+ """
def __repr__(self):
return "<%s.%s; proxy of C++ wxDataObjectComposite instance at %s>" % (self.__class__.__module__, self.__class__.__name__, self.this,)
def __init__(self, *args, **kwargs):
- """__init__(self) -> DataObjectComposite"""
+ """
+ __init__(self) -> DataObjectComposite
+
+ wx.DataObjectComposite is the simplest `wx.DataObject` derivation
+ which may be sued to support multiple formats. It contains several
+ 'wx.DataObjectSimple` objects and supports any format supported by at
+ least one of them. Only one of these data objects is *preferred* (the
+ first one if not explicitly changed by using the second parameter of
+ `Add`) and its format determines the preferred format of the composite
+ data object as well.
+
+ See `wx.DataObject` documentation for the reasons why you might prefer
+ to use wx.DataObject directly instead of wx.DataObjectComposite for
+ efficiency reasons.
+
+ """
newobj = _misc_.new_DataObjectComposite(*args, **kwargs)
self.this = newobj.this
self.thisown = 1
del newobj.thisown
def Add(*args, **kwargs):
- """Add(self, DataObjectSimple dataObject, int preferred=False)"""
+ """
+ Add(self, DataObjectSimple dataObject, bool preferred=False)
+
+ Adds the dataObject to the list of supported objects and it becomes
+ the preferred object if preferred is True.
+ """
return _misc_.DataObjectComposite_Add(*args, **kwargs)
_misc_.DataObjectComposite_swigregister(DataObjectCompositePtr)
class TextDataObject(DataObjectSimple):
+ """
+ wx.TextDataObject is a specialization of `wx.DataObject` for text
+ data. It can be used without change to paste data into the `wx.Clipboard`
+ or a `wx.DropSource`.
+
+ Alternativly, you may wish to derive a new class from the
+ `wx.PyTextDataObject` class for providing text on-demand in order to
+ minimize memory consumption when offering data in several formats,
+ such as plain text and RTF, because by default the text is stored in a
+ string in this class, but it might as well be generated on demand when
+ requested. For this, `GetTextLength` and `GetText` will have to be
+ overridden.
+ """
def __repr__(self):
return "<%s.%s; proxy of C++ wxTextDataObject instance at %s>" % (self.__class__.__module__, self.__class__.__name__, self.this,)
def __init__(self, *args, **kwargs):
- """__init__(self, String text=EmptyString) -> TextDataObject"""
+ """
+ __init__(self, String text=EmptyString) -> TextDataObject
+
+ Constructor, may be used to initialise the text (otherwise `SetText`
+ should be used later).
+ """
newobj = _misc_.new_TextDataObject(*args, **kwargs)
self.this = newobj.this
self.thisown = 1
del newobj.thisown
def GetTextLength(*args, **kwargs):
- """GetTextLength(self) -> size_t"""
+ """
+ GetTextLength(self) -> size_t
+
+ Returns the data size. By default, returns the size of the text data
+ set in the constructor or using `SetText`. This can be overridden (via
+ `wx.PyTextDataObject`) to provide text size data on-demand. It is
+ recommended to return the text length plus 1 for a trailing zero, but
+ this is not strictly required.
+ """
return _misc_.TextDataObject_GetTextLength(*args, **kwargs)
def GetText(*args, **kwargs):
- """GetText(self) -> String"""
+ """
+ GetText(self) -> String
+
+ Returns the text associated with the data object.
+ """
return _misc_.TextDataObject_GetText(*args, **kwargs)
def SetText(*args, **kwargs):
- """SetText(self, String text)"""
+ """
+ SetText(self, String text)
+
+ Sets the text associated with the data object. This method is called
+ when the data object receives the data and, by default, copies the
+ text into the member variable. If you want to process the text on the
+ fly you may wish to override this function (via
+ `wx.PyTextDataObject`.)
+ """
return _misc_.TextDataObject_SetText(*args, **kwargs)
_misc_.TextDataObject_swigregister(TextDataObjectPtr)
class PyTextDataObject(TextDataObject):
+ """
+ wx.PyTextDataObject is a version of `wx.TextDataObject` that is
+ Python-aware and knows how to reflect calls to its C++ virtual methods
+ to methods in the Python derived class. You should derive from this
+ class and overload `GetTextLength`, `GetText`, and `SetText` when you
+ want to be able to provide text on demand instead of preloading it
+ into the data object.
+ """
def __repr__(self):
return "<%s.%s; proxy of C++ wxPyTextDataObject instance at %s>" % (self.__class__.__module__, self.__class__.__name__, self.this,)
def __init__(self, *args, **kwargs):
- """__init__(self, String text=EmptyString) -> PyTextDataObject"""
+ """
+ __init__(self, String text=EmptyString) -> PyTextDataObject
+
+ wx.PyTextDataObject is a version of `wx.TextDataObject` that is
+ Python-aware and knows how to reflect calls to its C++ virtual methods
+ to methods in the Python derived class. You should derive from this
+ class and overload `GetTextLength`, `GetText`, and `SetText` when you
+ want to be able to provide text on demand instead of preloading it
+ into the data object.
+ """
newobj = _misc_.new_PyTextDataObject(*args, **kwargs)
self.this = newobj.this
self.thisown = 1
_misc_.PyTextDataObject_swigregister(PyTextDataObjectPtr)
class BitmapDataObject(DataObjectSimple):
+ """
+ wx.BitmapDataObject is a specialization of wxDataObject for bitmap
+ data. It can be used without change to paste data into the `wx.Clipboard`
+ or a `wx.DropSource`.
+
+ """
def __repr__(self):
return "<%s.%s; proxy of C++ wxBitmapDataObject instance at %s>" % (self.__class__.__module__, self.__class__.__name__, self.this,)
def __init__(self, *args, **kwargs):
- """__init__(self, Bitmap bitmap=wxNullBitmap) -> BitmapDataObject"""
+ """
+ __init__(self, Bitmap bitmap=wxNullBitmap) -> BitmapDataObject
+
+ Constructor, optionally passing a bitmap (otherwise use `SetBitmap`
+ later).
+ """
newobj = _misc_.new_BitmapDataObject(*args, **kwargs)
self.this = newobj.this
self.thisown = 1
del newobj.thisown
def GetBitmap(*args, **kwargs):
- """GetBitmap(self) -> Bitmap"""
+ """
+ GetBitmap(self) -> Bitmap
+
+ Returns the bitmap associated with the data object. You may wish to
+ override this method (by deriving from `wx.PyBitmapDataObject`) when
+ offering data on-demand, but this is not required by wxWidgets'
+ internals. Use this method to get data in bitmap form from the
+ `wx.Clipboard`.
+ """
return _misc_.BitmapDataObject_GetBitmap(*args, **kwargs)
def SetBitmap(*args, **kwargs):
- """SetBitmap(self, Bitmap bitmap)"""
+ """
+ SetBitmap(self, Bitmap bitmap)
+
+ Sets the bitmap associated with the data object. This method is called
+ when the data object receives data. Usually there will be no reason to
+ override this function.
+ """
return _misc_.BitmapDataObject_SetBitmap(*args, **kwargs)
_misc_.BitmapDataObject_swigregister(BitmapDataObjectPtr)
class PyBitmapDataObject(BitmapDataObject):
+ """
+ wx.PyBitmapDataObject is a version of `wx.BitmapDataObject` that is
+ Python-aware and knows how to reflect calls to its C++ virtual methods
+ to methods in the Python derived class. To be able to provide bitmap
+ data on demand derive from this class and overload `GetBitmap`.
+ """
def __repr__(self):
return "<%s.%s; proxy of C++ wxPyBitmapDataObject instance at %s>" % (self.__class__.__module__, self.__class__.__name__, self.this,)
def __init__(self, *args, **kwargs):
- """__init__(self, Bitmap bitmap=wxNullBitmap) -> PyBitmapDataObject"""
+ """
+ __init__(self, Bitmap bitmap=wxNullBitmap) -> PyBitmapDataObject
+
+ wx.PyBitmapDataObject is a version of `wx.BitmapDataObject` that is
+ Python-aware and knows how to reflect calls to its C++ virtual methods
+ to methods in the Python derived class. To be able to provide bitmap
+ data on demand derive from this class and overload `GetBitmap`.
+ """
newobj = _misc_.new_PyBitmapDataObject(*args, **kwargs)
self.this = newobj.this
self.thisown = 1
_misc_.PyBitmapDataObject_swigregister(PyBitmapDataObjectPtr)
class FileDataObject(DataObjectSimple):
+ """
+ wx.FileDataObject is a specialization of `wx.DataObjectSimple` for
+ file names. The program works with it just as if it were a list of
+ absolute file names, but internally it uses the same format as
+ Explorer and other compatible programs under Windows or GNOME/KDE
+ filemanager under Unix which makes it possible to receive files from
+ them using this class.
+
+ :Warning: Under all non-Windows platforms this class is currently
+ "input-only", i.e. you can receive the files from another
+ application, but copying (or dragging) file(s) from a wxWidgets
+ application is not currently supported.
+
+ """
def __repr__(self):
return "<%s.%s; proxy of C++ wxFileDataObject instance at %s>" % (self.__class__.__module__, self.__class__.__name__, self.this,)
def __init__(self, *args, **kwargs):
self.thisown = 1
del newobj.thisown
def GetFilenames(*args, **kwargs):
- """GetFilenames(self) -> wxArrayString"""
+ """GetFilenames(self) -> [names]"""
return _misc_.FileDataObject_GetFilenames(*args, **kwargs)
def AddFile(*args, **kwargs):
- """AddFile(self, String filename)"""
+ """
+ AddFile(self, String filename)
+
+ Adds a file to the list of files represented by this data object.
+ """
return _misc_.FileDataObject_AddFile(*args, **kwargs)
_misc_.FileDataObject_swigregister(FileDataObjectPtr)
class CustomDataObject(DataObjectSimple):
+ """
+ wx.CustomDataObject is a specialization of `wx.DataObjectSimple` for
+ some application-specific data in arbitrary format. Python strings
+ are used for getting and setting data, but any picklable object can
+ easily be transfered via strings. A copy of the data is stored in the
+ data object.
+ """
def __repr__(self):
return "<%s.%s; proxy of C++ wxCustomDataObject instance at %s>" % (self.__class__.__module__, self.__class__.__name__, self.this,)
def __init__(self, *args, **kwargs):
- """__init__(self, DataFormat format=FormatInvalid) -> CustomDataObject"""
+ """
+ __init__(self, DataFormat format=FormatInvalid) -> CustomDataObject
+
+ wx.CustomDataObject is a specialization of `wx.DataObjectSimple` for
+ some application-specific data in arbitrary format. Python strings
+ are used for getting and setting data, but any picklable object can
+ easily be transfered via strings. A copy of the data is stored in the
+ data object.
+ """
newobj = _misc_.new_CustomDataObject(*args, **kwargs)
self.this = newobj.this
self.thisown = 1
del newobj.thisown
- def TakeData(*args, **kwargs):
- """TakeData(self, PyObject data)"""
- return _misc_.CustomDataObject_TakeData(*args, **kwargs)
-
def SetData(*args, **kwargs):
- """SetData(self, PyObject data) -> bool"""
+ """
+ SetData(self, String data) -> bool
+
+ Copy the data value to the data object.
+ """
return _misc_.CustomDataObject_SetData(*args, **kwargs)
+ TakeData = SetData
def GetSize(*args, **kwargs):
- """GetSize(self) -> size_t"""
+ """
+ GetSize(self) -> size_t
+
+ Get the size of the data.
+ """
return _misc_.CustomDataObject_GetSize(*args, **kwargs)
def GetData(*args, **kwargs):
- """GetData(self) -> PyObject"""
+ """
+ GetData(self) -> String
+
+ Returns the data bytes from the data object as a string.
+ """
return _misc_.CustomDataObject_GetData(*args, **kwargs)
_misc_.CustomDataObject_swigregister(CustomDataObjectPtr)
class URLDataObject(DataObjectComposite):
+ """
+ This data object holds a URL in a format that is compatible with some
+ browsers such that it is able to be dragged to or from them.
+ """
def __repr__(self):
return "<%s.%s; proxy of C++ wxURLDataObject instance at %s>" % (self.__class__.__module__, self.__class__.__name__, self.this,)
def __init__(self, *args, **kwargs):
- """__init__(self) -> URLDataObject"""
+ """
+ __init__(self) -> URLDataObject
+
+ This data object holds a URL in a format that is compatible with some
+ browsers such that it is able to be dragged to or from them.
+ """
newobj = _misc_.new_URLDataObject(*args, **kwargs)
self.this = newobj.this
self.thisown = 1
del newobj.thisown
def GetURL(*args, **kwargs):
- """GetURL(self) -> String"""
+ """
+ GetURL(self) -> String
+
+ Returns a string containing the current URL.
+ """
return _misc_.URLDataObject_GetURL(*args, **kwargs)
def SetURL(*args, **kwargs):
- """SetURL(self, String url)"""
+ """
+ SetURL(self, String url)
+
+ Set the URL.
+ """
return _misc_.URLDataObject_SetURL(*args, **kwargs)
#include <wx/dataobj.h>
+PyObject *wxDataObject_GetAllFormats(wxDataObject *self,wxDataObject::Direction dir){
+ size_t count = self->GetFormatCount(dir);
+ wxDataFormat* formats = new wxDataFormat[count];
+ self->GetAllFormats(formats, dir);
+
+ bool blocked = wxPyBeginBlockThreads();
+ PyObject* list = PyList_New(count);
+ for (size_t i=0; i<count; i++) {
+ wxDataFormat* format = new wxDataFormat(formats[i]);
+ PyObject* obj = wxPyConstructObject((void*)format, wxT("wxDataFormat"), True);
+ PyList_Append(list, obj);
+ Py_DECREF(obj);
+ }
+ wxPyEndBlockThreads(blocked);
+ delete [] formats;
+ return list;
+ }
+PyObject *wxDataObject_GetDataHere(wxDataObject *self,wxDataFormat const &format){
+ PyObject* rval = NULL;
+ size_t size = self->GetDataSize(format);
+ bool blocked = wxPyBeginBlockThreads();
+ if (size) {
+ char* buf = new char[size];
+ if (self->GetDataHere(format, buf))
+ rval = PyString_FromStringAndSize(buf, size);
+ delete [] buf;
+ }
+ if (! rval) {
+ rval = Py_None;
+ Py_INCREF(rval);
+ }
+ wxPyEndBlockThreads(blocked);
+ return rval;
+ }
+bool wxDataObject_SetData(wxDataObject *self,wxDataFormat const &format,PyObject *data){
+ bool rval;
+ bool blocked = wxPyBeginBlockThreads();
+ if (PyString_Check(data)) {
+ rval = self->SetData(format, PyString_Size(data), PyString_AsString(data));
+ }
+ else {
+ // raise a TypeError if not a string
+ PyErr_SetString(PyExc_TypeError, "String expected.");
+ rval = False;
+ }
+ wxPyEndBlockThreads(blocked);
+ return rval;
+ }
+PyObject *wxDataObjectSimple_GetDataHere(wxDataObjectSimple *self){
+ PyObject* rval = NULL;
+ size_t size = self->GetDataSize();
+ bool blocked = wxPyBeginBlockThreads();
+ if (size) {
+ char* buf = new char[size];
+ if (self->GetDataHere(buf))
+ rval = PyString_FromStringAndSize(buf, size);
+ delete [] buf;
+ }
+ if (! rval) {
+ rval = Py_None;
+ Py_INCREF(rval);
+ }
+ wxPyEndBlockThreads(blocked);
+ return rval;
+ }
+bool wxDataObjectSimple_SetData(wxDataObjectSimple *self,PyObject *data){
+ bool rval;
+ bool blocked = wxPyBeginBlockThreads();
+ if (PyString_Check(data)) {
+ rval = self->SetData(PyString_Size(data), PyString_AsString(data));
+ }
+ else {
+ // raise a TypeError if not a string
+ PyErr_SetString(PyExc_TypeError, "String expected.");
+ rval = False;
+ }
+ wxPyEndBlockThreads(blocked);
+ return rval;
+ }
// Create a new class for wxPython to use
class wxPyDataObjectSimple : public wxDataObjectSimple {
public:
wxPyEndBlockThreads(blocked);
return *rval;
}
-
+
void wxPyBitmapDataObject::SetBitmap(const wxBitmap& bitmap) {
bool blocked = wxPyBeginBlockThreads();
if (wxPyCBH_findCallback(m_myInst, "SetBitmap")) {
wxPyEndBlockThreads(blocked);
}
-void wxCustomDataObject_TakeData(wxCustomDataObject *self,PyObject *data){
- if (PyString_Check(data)) {
- // for Python we just call SetData here since we always need it to make a copy.
- self->SetData(PyString_Size(data), PyString_AsString(data));
- }
- else {
- // raise a TypeError if not a string
- PyErr_SetString(PyExc_TypeError, "String expected.");
- }
- }
bool wxCustomDataObject_SetData(wxCustomDataObject *self,PyObject *data){
+ bool rval;
+ bool blocked = wxPyBeginBlockThreads();
if (PyString_Check(data)) {
- return self->SetData(PyString_Size(data), PyString_AsString(data));
+ rval = self->SetData(PyString_Size(data), PyString_AsString(data));
}
else {
// raise a TypeError if not a string
PyErr_SetString(PyExc_TypeError, "String expected.");
- return False;
+ rval = False;
}
+ wxPyEndBlockThreads(blocked);
+ return rval;
}
PyObject *wxCustomDataObject_GetData(wxCustomDataObject *self){
- return PyString_FromStringAndSize((char*)self->GetData(), self->GetSize());
+ PyObject* obj;
+ bool blocked = wxPyBeginBlockThreads();
+ obj = PyString_FromStringAndSize((char*)self->GetData(), self->GetSize());
+ wxPyEndBlockThreads(blocked);
}
class wxMetafileDataObject : public wxDataObjectSimple
wxVideoMode* m = new wxVideoMode(arr.Item(i));
PyObject* pyObj = wxPyConstructObject(m, wxT("wxVideoMode"), true);
PyList_Append(pyList, pyObj);
+ Py_DECREF(pyObj);
}
wxPyEndBlockThreads(blocked);
return pyList;
static PyObject *_wrap_DataObject_GetAllFormats(PyObject *self, PyObject *args, PyObject *kwargs) {
PyObject *resultobj;
wxDataObject *arg1 = (wxDataObject *) 0 ;
- wxDataFormat *arg2 = (wxDataFormat *) 0 ;
- int arg3 = (int) wxDataObject::Get ;
+ int arg2 = (int) wxDataObject::Get ;
+ PyObject *result;
PyObject * obj0 = 0 ;
PyObject * obj1 = 0 ;
- PyObject * obj2 = 0 ;
char *kwnames[] = {
- (char *) "self",(char *) "formats",(char *) "dir", NULL
+ (char *) "self",(char *) "dir", NULL
};
- if(!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OO|O:DataObject_GetAllFormats",kwnames,&obj0,&obj1,&obj2)) goto fail;
+ if(!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"O|O:DataObject_GetAllFormats",kwnames,&obj0,&obj1)) goto fail;
if ((SWIG_ConvertPtr(obj0,(void **)(&arg1),SWIGTYPE_p_wxDataObject,
SWIG_POINTER_EXCEPTION | 0)) == -1) SWIG_fail;
- if ((SWIG_ConvertPtr(obj1,(void **)(&arg2),SWIGTYPE_p_wxDataFormat,
- SWIG_POINTER_EXCEPTION | 0)) == -1) SWIG_fail;
- if (obj2) {
- arg3 = (wxDataObject::Direction) SWIG_AsInt(obj2);
+ if (obj1) {
+ arg2 = (wxDataObject::Direction) SWIG_AsInt(obj1);
if (PyErr_Occurred()) SWIG_fail;
}
{
PyThreadState* __tstate = wxPyBeginAllowThreads();
- ((wxDataObject const *)arg1)->GetAllFormats(arg2,(wxDataObject::Direction )arg3);
+ result = (PyObject *)wxDataObject_GetAllFormats(arg1,(wxDataObject::Direction )arg2);
wxPyEndAllowThreads(__tstate);
if (PyErr_Occurred()) SWIG_fail;
}
- Py_INCREF(Py_None); resultobj = Py_None;
+ resultobj = result;
return resultobj;
fail:
return NULL;
PyObject *resultobj;
wxDataObject *arg1 = (wxDataObject *) 0 ;
wxDataFormat *arg2 = 0 ;
- void *arg3 = (void *) 0 ;
- bool result;
+ PyObject *result;
PyObject * obj0 = 0 ;
PyObject * obj1 = 0 ;
- PyObject * obj2 = 0 ;
char *kwnames[] = {
- (char *) "self",(char *) "format",(char *) "buf", NULL
+ (char *) "self",(char *) "format", NULL
};
- if(!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OOO:DataObject_GetDataHere",kwnames,&obj0,&obj1,&obj2)) goto fail;
+ if(!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OO:DataObject_GetDataHere",kwnames,&obj0,&obj1)) goto fail;
if ((SWIG_ConvertPtr(obj0,(void **)(&arg1),SWIGTYPE_p_wxDataObject,
SWIG_POINTER_EXCEPTION | 0)) == -1) SWIG_fail;
if ((SWIG_ConvertPtr(obj1,(void **)(&arg2),SWIGTYPE_p_wxDataFormat,
PyErr_SetString(PyExc_TypeError,"null reference");
SWIG_fail;
}
- if ((SWIG_ConvertPtr(obj2,&arg3,0,SWIG_POINTER_EXCEPTION | 0)) == -1) SWIG_fail;
{
PyThreadState* __tstate = wxPyBeginAllowThreads();
- result = (bool)((wxDataObject const *)arg1)->GetDataHere((wxDataFormat const &)*arg2,arg3);
+ result = (PyObject *)wxDataObject_GetDataHere(arg1,(wxDataFormat const &)*arg2);
wxPyEndAllowThreads(__tstate);
if (PyErr_Occurred()) SWIG_fail;
}
- {
- resultobj = result ? Py_True : Py_False; Py_INCREF(resultobj);
- }
+ resultobj = result;
return resultobj;
fail:
return NULL;
PyObject *resultobj;
wxDataObject *arg1 = (wxDataObject *) 0 ;
wxDataFormat *arg2 = 0 ;
- size_t arg3 ;
- void *arg4 = (void *) 0 ;
+ PyObject *arg3 = (PyObject *) 0 ;
bool result;
PyObject * obj0 = 0 ;
PyObject * obj1 = 0 ;
PyObject * obj2 = 0 ;
- PyObject * obj3 = 0 ;
char *kwnames[] = {
- (char *) "self",(char *) "format",(char *) "len",(char *) "buf", NULL
+ (char *) "self",(char *) "format",(char *) "data", NULL
};
- if(!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OOOO:DataObject_SetData",kwnames,&obj0,&obj1,&obj2,&obj3)) goto fail;
+ if(!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OOO:DataObject_SetData",kwnames,&obj0,&obj1,&obj2)) goto fail;
if ((SWIG_ConvertPtr(obj0,(void **)(&arg1),SWIGTYPE_p_wxDataObject,
SWIG_POINTER_EXCEPTION | 0)) == -1) SWIG_fail;
if ((SWIG_ConvertPtr(obj1,(void **)(&arg2),SWIGTYPE_p_wxDataFormat,
PyErr_SetString(PyExc_TypeError,"null reference");
SWIG_fail;
}
- arg3 = (size_t) SWIG_AsUnsignedLong(obj2);
- if (PyErr_Occurred()) SWIG_fail;
- if ((SWIG_ConvertPtr(obj3,&arg4,0,SWIG_POINTER_EXCEPTION | 0)) == -1) SWIG_fail;
+ arg3 = obj2;
{
PyThreadState* __tstate = wxPyBeginAllowThreads();
- result = (bool)(arg1)->SetData((wxDataFormat const &)*arg2,arg3,(void const *)arg4);
+ result = (bool)wxDataObject_SetData(arg1,(wxDataFormat const &)*arg2,arg3);
wxPyEndAllowThreads(__tstate);
if (PyErr_Occurred()) SWIG_fail;
}
+static PyObject *_wrap_DataObjectSimple_GetDataSize(PyObject *self, PyObject *args, PyObject *kwargs) {
+ PyObject *resultobj;
+ wxDataObjectSimple *arg1 = (wxDataObjectSimple *) 0 ;
+ size_t result;
+ PyObject * obj0 = 0 ;
+ char *kwnames[] = {
+ (char *) "self", NULL
+ };
+
+ if(!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"O:DataObjectSimple_GetDataSize",kwnames,&obj0)) goto fail;
+ if ((SWIG_ConvertPtr(obj0,(void **)(&arg1),SWIGTYPE_p_wxDataObjectSimple,
+ SWIG_POINTER_EXCEPTION | 0)) == -1) SWIG_fail;
+ {
+ PyThreadState* __tstate = wxPyBeginAllowThreads();
+ result = (size_t)((wxDataObjectSimple const *)arg1)->GetDataSize();
+
+ wxPyEndAllowThreads(__tstate);
+ if (PyErr_Occurred()) SWIG_fail;
+ }
+ resultobj = SWIG_FromUnsignedLong((unsigned long)result);
+ return resultobj;
+ fail:
+ return NULL;
+}
+
+
+static PyObject *_wrap_DataObjectSimple_GetDataHere(PyObject *self, PyObject *args, PyObject *kwargs) {
+ PyObject *resultobj;
+ wxDataObjectSimple *arg1 = (wxDataObjectSimple *) 0 ;
+ PyObject *result;
+ PyObject * obj0 = 0 ;
+ char *kwnames[] = {
+ (char *) "self", NULL
+ };
+
+ if(!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"O:DataObjectSimple_GetDataHere",kwnames,&obj0)) goto fail;
+ if ((SWIG_ConvertPtr(obj0,(void **)(&arg1),SWIGTYPE_p_wxDataObjectSimple,
+ SWIG_POINTER_EXCEPTION | 0)) == -1) SWIG_fail;
+ {
+ PyThreadState* __tstate = wxPyBeginAllowThreads();
+ result = (PyObject *)wxDataObjectSimple_GetDataHere(arg1);
+
+ wxPyEndAllowThreads(__tstate);
+ if (PyErr_Occurred()) SWIG_fail;
+ }
+ resultobj = result;
+ return resultobj;
+ fail:
+ return NULL;
+}
+
+
+static PyObject *_wrap_DataObjectSimple_SetData(PyObject *self, PyObject *args, PyObject *kwargs) {
+ PyObject *resultobj;
+ wxDataObjectSimple *arg1 = (wxDataObjectSimple *) 0 ;
+ PyObject *arg2 = (PyObject *) 0 ;
+ bool result;
+ PyObject * obj0 = 0 ;
+ PyObject * obj1 = 0 ;
+ char *kwnames[] = {
+ (char *) "self",(char *) "data", NULL
+ };
+
+ if(!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OO:DataObjectSimple_SetData",kwnames,&obj0,&obj1)) goto fail;
+ if ((SWIG_ConvertPtr(obj0,(void **)(&arg1),SWIGTYPE_p_wxDataObjectSimple,
+ SWIG_POINTER_EXCEPTION | 0)) == -1) SWIG_fail;
+ arg2 = obj1;
+ {
+ PyThreadState* __tstate = wxPyBeginAllowThreads();
+ result = (bool)wxDataObjectSimple_SetData(arg1,arg2);
+
+ wxPyEndAllowThreads(__tstate);
+ if (PyErr_Occurred()) SWIG_fail;
+ }
+ {
+ resultobj = result ? Py_True : Py_False; Py_INCREF(resultobj);
+ }
+ return resultobj;
+ fail:
+ return NULL;
+}
+
+
static PyObject * DataObjectSimple_swigregister(PyObject *self, PyObject *args) {
PyObject *obj;
if (!PyArg_ParseTuple(args,(char*)"O", &obj)) return NULL;
PyObject *resultobj;
wxDataObjectComposite *arg1 = (wxDataObjectComposite *) 0 ;
wxDataObjectSimple *arg2 = (wxDataObjectSimple *) 0 ;
- int arg3 = (int) False ;
+ bool arg3 = (bool) False ;
PyObject * obj0 = 0 ;
PyObject * obj1 = 0 ;
PyObject * obj2 = 0 ;
if ((SWIG_ConvertPtr(obj1,(void **)(&arg2),SWIGTYPE_p_wxDataObjectSimple,
SWIG_POINTER_EXCEPTION | SWIG_POINTER_DISOWN)) == -1) SWIG_fail;
if (obj2) {
- arg3 = (int) SWIG_AsInt(obj2);
+ arg3 = (bool) SWIG_AsBool(obj2);
if (PyErr_Occurred()) SWIG_fail;
}
{
}
-static PyObject *_wrap_CustomDataObject_TakeData(PyObject *self, PyObject *args, PyObject *kwargs) {
- PyObject *resultobj;
- wxCustomDataObject *arg1 = (wxCustomDataObject *) 0 ;
- PyObject *arg2 = (PyObject *) 0 ;
- PyObject * obj0 = 0 ;
- PyObject * obj1 = 0 ;
- char *kwnames[] = {
- (char *) "self",(char *) "data", NULL
- };
-
- if(!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OO:CustomDataObject_TakeData",kwnames,&obj0,&obj1)) goto fail;
- if ((SWIG_ConvertPtr(obj0,(void **)(&arg1),SWIGTYPE_p_wxCustomDataObject,
- SWIG_POINTER_EXCEPTION | 0)) == -1) SWIG_fail;
- arg2 = obj1;
- {
- PyThreadState* __tstate = wxPyBeginAllowThreads();
- wxCustomDataObject_TakeData(arg1,arg2);
-
- wxPyEndAllowThreads(__tstate);
- if (PyErr_Occurred()) SWIG_fail;
- }
- Py_INCREF(Py_None); resultobj = Py_None;
- return resultobj;
- fail:
- return NULL;
-}
-
-
static PyObject *_wrap_CustomDataObject_SetData(PyObject *self, PyObject *args, PyObject *kwargs) {
PyObject *resultobj;
wxCustomDataObject *arg1 = (wxCustomDataObject *) 0 ;
{ (char *)"new_DataObjectSimple", (PyCFunction) _wrap_new_DataObjectSimple, METH_VARARGS | METH_KEYWORDS },
{ (char *)"DataObjectSimple_GetFormat", (PyCFunction) _wrap_DataObjectSimple_GetFormat, METH_VARARGS | METH_KEYWORDS },
{ (char *)"DataObjectSimple_SetFormat", (PyCFunction) _wrap_DataObjectSimple_SetFormat, METH_VARARGS | METH_KEYWORDS },
+ { (char *)"DataObjectSimple_GetDataSize", (PyCFunction) _wrap_DataObjectSimple_GetDataSize, METH_VARARGS | METH_KEYWORDS },
+ { (char *)"DataObjectSimple_GetDataHere", (PyCFunction) _wrap_DataObjectSimple_GetDataHere, METH_VARARGS | METH_KEYWORDS },
+ { (char *)"DataObjectSimple_SetData", (PyCFunction) _wrap_DataObjectSimple_SetData, METH_VARARGS | METH_KEYWORDS },
{ (char *)"DataObjectSimple_swigregister", DataObjectSimple_swigregister, METH_VARARGS },
{ (char *)"new_PyDataObjectSimple", (PyCFunction) _wrap_new_PyDataObjectSimple, METH_VARARGS | METH_KEYWORDS },
{ (char *)"PyDataObjectSimple__setCallbackInfo", (PyCFunction) _wrap_PyDataObjectSimple__setCallbackInfo, METH_VARARGS | METH_KEYWORDS },
{ (char *)"FileDataObject_AddFile", (PyCFunction) _wrap_FileDataObject_AddFile, METH_VARARGS | METH_KEYWORDS },
{ (char *)"FileDataObject_swigregister", FileDataObject_swigregister, METH_VARARGS },
{ (char *)"new_CustomDataObject", (PyCFunction) _wrap_new_CustomDataObject, METH_VARARGS | METH_KEYWORDS },
- { (char *)"CustomDataObject_TakeData", (PyCFunction) _wrap_CustomDataObject_TakeData, METH_VARARGS | METH_KEYWORDS },
{ (char *)"CustomDataObject_SetData", (PyCFunction) _wrap_CustomDataObject_SetData, METH_VARARGS | METH_KEYWORDS },
{ (char *)"CustomDataObject_GetSize", (PyCFunction) _wrap_CustomDataObject_GetSize, METH_VARARGS | METH_KEYWORDS },
{ (char *)"CustomDataObject_GetData", (PyCFunction) _wrap_CustomDataObject_GetData, METH_VARARGS | METH_KEYWORDS },