- // return all formats in the provided array (of size GetFormatCount())
- //virtual void GetAllFormats(wxDataFormat *formats,
- // Direction dir = Get) const;
- DocAStr(GetAllFormats,
- "GetAllFormats(self, int dir=Get) -> [formats]",
- "Returns a list of all the wx.DataFormats that this dataobject supports
-in the given direction.", "");
%extend {
+ DocAStr(GetAllFormats,
+ "GetAllFormats(self, int dir=Get) -> [formats]",
+ "Returns a list of all the wx.DataFormats that this dataobject supports
+in the given direction.", "");
PyObject* GetAllFormats(Direction dir = Get) {
size_t count = self->GetFormatCount(dir);
wxDataFormat* formats = new wxDataFormat[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);
+ PyList_SET_ITEM(list, i, obj); // PyList_SET_ITEM steals a reference
}
wxPyEndBlockThreads(blocked);
delete [] formats;
// True if data copied successfully, False otherwise
// virtual bool GetDataHere(const wxDataFormat& format, void *buf) const;
- DocAStr(GetDataHere,
- "GetDataHere(self, DataFormat format) -> String",
- "Get the data bytes in the specified format, returns None on failure.
-", "
-:todo: This should use the python buffer interface isntead...");
%extend {
+ DocAStr(GetDataHere,
+ "GetDataHere(self, DataFormat format) -> String",
+ "Get the data bytes in the specified format, returns None on failure.", "
+:todo: This should use the python buffer interface isntead...");
PyObject* GetDataHere(const wxDataFormat& format) {
PyObject* rval = NULL;
size_t size = self->GetDataSize(format);
- DocAStr(GetDataHere,
- "GetDataHere(self) -> String",
- "Returns the data bytes from the data object as a string, returns None
+ %extend {
+ DocAStr(GetDataHere,
+ "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.", "");
- %extend {
PyObject* GetDataHere() {
PyObject* rval = NULL;
size_t size = self->GetDataSize();
}
- DocAStr(SetData,
- "SetData(self, String data) -> bool",
- "Copy the data value to the data object. Must be implemented in the
+ %extend {
+ DocAStr(SetData,
+ "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.
", "");
- %extend {
bool SetData(PyObject* data) {
bool rval;
wxPyBlock_t blocked = wxPyBeginBlockThreads();
public:
wxDataObjectComposite();
- %apply SWIGTYPE *DISOWN { wxDataObjectSimple *dataObject };
+ %disownarg( wxDataObjectSimple *dataObject );
DocDeclStr(
void , Add(wxDataObjectSimple *dataObject, bool preferred = false),
"Adds the dataObject to the list of supported objects and it becomes
the preferred object if preferred is True.", "");
- %clear wxDataObjectSimple *dataObject;
+ %cleardisown( wxDataObjectSimple *dataObject );
};
//---------------------------------------------------------------------------
wxCustomDataObject();
- DocAStr(SetData,
- "SetData(self, String data) -> bool",
- "Copy the data value to the data object.", "");
%extend {
+ DocAStr(SetData,
+ "SetData(self, String data) -> bool",
+ "Copy the data value to the data object.", "");
bool SetData(PyObject* data) {
bool rval;
wxPyBlock_t blocked = wxPyBeginBlockThreads();
"Get the size of the data.", "");
- DocAStr(GetData,
- "GetData(self) -> String",
- "Returns the data bytes from the data object as a string.", "");
%extend {
+ DocAStr(GetData,
+ "GetData(self) -> String",
+ "Returns the data bytes from the data object as a string.", "");
PyObject* GetData() {
PyObject* obj;
wxPyBlock_t blocked = wxPyBeginBlockThreads();
DocStr(wxURLDataObject,
"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.", "");
-class wxURLDataObject : public wxDataObjectComposite {
+class wxURLDataObject : public wxDataObject/*Composite*/ {
public:
wxURLDataObject();