%}
-%name(DropSource) class wxPyDropSource {
+%rename(DropSource) wxPyDropSource;
+class wxPyDropSource {
public:
%pythonAppend wxPyDropSource "self._setCallbackInfo(self, DropSource, 0)"
#ifndef __WXGTK__
};
+%pythoncode {
+def DROP_ICON(filename):
+ """
+ Returns either a `wx.Cursor` or `wx.Icon` created from the image file
+ ``filename``. This function is useful with the `wx.DropSource` class
+ which, depending on platform accepts either a icon or a cursor.
+ """
+ img = wx.Image(filename)
+ if wx.Platform == '__WXGTK__':
+ return wx.IconFromBitmap(wx.BitmapFromImage(img))
+ else:
+ return wx.CursorFromImage(img)
+}
+
+
//---------------------------------------------------------------------------
// wxDropTarget should be associated with a window if it wants to be able to
%}
-%name(DropTarget) class wxPyDropTarget // : public wxDropTarget
+%rename(DropTarget) wxPyDropTarget;
+class wxPyDropTarget // : public wxDropTarget
{
public:
%pythonAppend wxPyDropTarget
// 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:
%pythonAppend wxPyTextDropTarget "self._setCallbackInfo(self, TextDropTarget)"
bool wxPyFileDropTarget::OnDropFiles(wxCoord x, wxCoord y,
const wxArrayString& filenames) {
- bool rval = False;
- bool blocked = 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));
%}
-%name(FileDropTarget) class wxPyFileDropTarget : public wxPyDropTarget
+%rename(FileDropTarget) wxPyFileDropTarget;
+class wxPyFileDropTarget : public wxPyDropTarget
{
public:
%pythonAppend wxPyFileDropTarget "self._setCallbackInfo(self, FileDropTarget)"