]> git.saurik.com Git - wxWidgets.git/blobdiff - include/wx/dnd.h
some WXUNUSED() added
[wxWidgets.git] / include / wx / dnd.h
index 36d3e506cd1e68ac40e64dc9b975350d57e81309..2106b00a4c25676836b858daee9efd8cc73a7ca8 100644 (file)
@@ -44,7 +44,11 @@ public:
     virtual ~wxDropSourceBase() { }
 
     // set the data which is transfered by drag and drop
-    void SetData(wxDataObject& data) { delete m_data; m_data = &data; }
+    void SetData(wxDataObject& data) 
+      { m_data = &data; }
+      
+    wxDataObject *GetDataObject()
+      { return m_data; }
 
     // start drag action, see enum wxDragResult for return value description
     //
@@ -80,7 +84,7 @@ public:
     // ctor takes a pointer to heap-allocated wxDataObject which will be owned
     // by wxDropTarget and deleted by it automatically. If you don't give it
     // here, you can use SetDataObject() later.
-    wxDropTargetBase(wxDataObject *dataObject = NULL)
+    wxDropTargetBase(wxDataObject *dataObject = (wxDataObject*)NULL)
         { m_dataObject = dataObject; }
     // dtor deletes our data object
     virtual ~wxDropTargetBase()
@@ -90,13 +94,32 @@ public:
     wxDataObject *GetDataObject() const
         { return m_dataObject; }
     void SetDataObject(wxDataObject *dataObject)
-        { delete m_dataObject; m_dataObject = dataObject; }
+        { if (m_dataObject) delete m_dataObject; 
+         m_dataObject = dataObject; }
 
-    // called when mouse enters/leaves the window: might be used to give
-    // some visual feedback to the user
-    virtual void OnEnter() { }
+    // these functions are called when data is moved over position (x, y) and
+    // may return either wxDragCopy, wxDragMove or wxDragNone depending on
+    // what would happen if the data were dropped here.
+    //
+    // the last parameter is what would happen by default and is determined by
+    // the platform-specific logic (for example, under Windows it's wxDragCopy
+    // if Ctrl key is pressed and wxDragMove otherwise) except that it will
+    // always be wxDragNone if the carried data is in an unsupported format.
+
+    // called when the mouse enters the window (only once until OnLeave())
+    virtual wxDragResult OnEnter(wxCoord x, wxCoord y, wxDragResult def)
+        { return OnDragOver(x, y, def); }
+
+    // called when the mouse moves in the window - shouldn't take long to
+    // execute or otherwise mouse movement would be too slow
+    virtual wxDragResult OnDragOver(wxCoord WXUNUSED(x), wxCoord WXUNUSED(y),
+                                    wxDragResult def)
+        { return def; }
+    
+    // called when mouse leaves the window: might be used to remove the
+    // feedback which was given in OnEnter()
     virtual void OnLeave() { }
-
+    
     // this function is called when data is dropped at position (x, y) - if it
     // returns TRUE, OnData() will be called immediately afterwards which will
     // allow to retrieve the data dropped.