//---------------------------------------------------------------------------
+#ifndef __WXX11__
-%{
-%}
-
-//---------------------------------------------------------------------------
%newgroup
// flags for wxDropSource::DoDragDrop()
%}
-%name(DropSource) class wxPyDropSource {
+%rename(DropSource) wxPyDropSource;
+class wxPyDropSource {
public:
+ %pythonAppend wxPyDropSource "self._setCallbackInfo(self, DropSource, 0)"
#ifndef __WXGTK__
- wxPyDropSource(wxWindow *win = NULL,
+ wxPyDropSource(wxWindow *win,
const wxCursor © = wxNullCursor,
const wxCursor &move = wxNullCursor,
const wxCursor &none = wxNullCursor);
#else
- wxPyDropSource(wxWindow *win = NULL,
+ wxPyDropSource(wxWindow *win,
const wxIcon& copy = wxNullIcon,
const wxIcon& move = wxNullIcon,
const wxIcon& none = wxNullIcon);
#endif
void _setCallbackInfo(PyObject* self, PyObject* _class, int incref);
- %pragma(python) addtomethod = "__init__:self._setCallbackInfo(self, wxDropSource, 0)"
~wxPyDropSource();
// set the data which is transfered by drag and drop
void SetData(wxDataObject& data);
-
+
wxDataObject *GetDataObject();
-
+
// set the icon corresponding to given drag result
void SetCursor(wxDragResult res, const wxCursor& cursor);
%}
-%name(DropTarget) class wxPyDropTarget // : public wxDropTarget
+%rename(DropTarget) wxPyDropTarget;
+class wxPyDropTarget // : public wxDropTarget
{
public:
- %addtofunc wxPyDropTarget "if args: args[1].thisown = 0; self._setCallbackInfo(self, DropTarget)"
+ %pythonAppend wxPyDropTarget
+ "self._setCallbackInfo(self, DropTarget)"
+ %apply SWIGTYPE *DISOWN { wxDataObject *dataObject };
wxPyDropTarget(wxDataObject *dataObject = NULL);
void _setCallbackInfo(PyObject* self, PyObject* _class);
// get/set the associated wxDataObject
wxDataObject *GetDataObject();
- %addtofunc SetDataObject "args[1].thisown = 0"
void SetDataObject(wxDataObject *dataObject);
+ %clear wxDataObject *dataObject;
+
wxDragResult base_OnEnter(wxCoord x, wxCoord y, wxDragResult def);
wxDragResult base_OnDragOver(wxCoord x, wxCoord y, wxDragResult def);
void base_OnLeave();
// with the data from the drop source if it returns True
bool GetData();
+ // sets the default action for drag and drop:
+ // use wxDragMove or wxDragCopy to set deafult action to move or copy
+ // and use wxDragNone (default) to set default action specified by
+ // initialization of draging (see wxDropSourceBase::DoDragDrop())
+ void SetDefaultAction(wxDragResult action);
+
+ // returns default action for drag and drop or
+ // wxDragNone if this not specified
+ wxDragResult GetDefaultAction();
};
%}
-%name(TextDropTarget) class wxPyTextDropTarget : public wxPyDropTarget {
+%rename(TextDropTarget) wxPyTextDropTarget;
+class wxPyTextDropTarget : public wxPyDropTarget {
public:
- %addtofunc wxPyTextDropTarget "self._setCallbackInfo(self, TextDropTarget)"
+ %pythonAppend wxPyTextDropTarget "self._setCallbackInfo(self, TextDropTarget)"
wxPyTextDropTarget();
void _setCallbackInfo(PyObject* self, PyObject* _class);
bool wxPyFileDropTarget::OnDropFiles(wxCoord x, wxCoord y,
const wxArrayString& filenames) {
- bool rval = False;
- wxPyBeginBlockThreads();
+ bool rval = false;
+ wxPyBlock_t blocked = wxPyBeginBlockThreads();
if (wxPyCBH_findCallback(m_myInst, "OnDropFiles")) {
PyObject* list = wxArrayString2PyList_helper(filenames);
rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(iiO)",x,y,list));
Py_DECREF(list);
}
- wxPyEndBlockThreads();
+ wxPyEndBlockThreads(blocked);
return rval;
}
%}
-%name(FileDropTarget) class wxPyFileDropTarget : public wxPyDropTarget
+%rename(FileDropTarget) wxPyFileDropTarget;
+class wxPyFileDropTarget : public wxPyDropTarget
{
public:
- %addtofunc wxPyFileDropTarget "self._setCallbackInfo(self, FileDropTarget)"
+ %pythonAppend wxPyFileDropTarget "self._setCallbackInfo(self, FileDropTarget)"
wxPyFileDropTarget();
void _setCallbackInfo(PyObject* self, PyObject* _class);
wxPyPtrTypeMap_Add("wxFileDropTarget", "wxPyFileDropTarget");
%}
//---------------------------------------------------------------------------
+
+#endif