- // ctor & dtor
- wxDropTarget();
- virtual ~wxDropTarget();
-
- // normally called by wxWindow on window creation/destruction, but might be
- // called `manually' as well. Register() returns true on success.
- bool Register(WXHWND hwnd);
- void Revoke(WXHWND hwnd);
-
- // do we accept this kind of data?
- virtual bool IsAcceptedData(IDataObject *pIDataSource) const;
-
- // called when mouse enters/leaves the window: might be used to give
- // some visual feedback to the user
- virtual void OnEnter() { }
- virtual void OnLeave() { }
-
- // this function is called when data is dropped.
- // (x, y) are the coordinates of the drop
- virtual bool OnDrop(long x, long y, const void *pData) = 0;
-
-protected:
- // Override these to indicate what kind of data you support: the first
- // format to which data can be converted is used. The classes below show
- // how it can be done in the simplest cases.
- // how many different (clipboard) formats do you support?
- virtual size_t GetFormatCount() const = 0;
- // return the n-th supported format
- virtual wxDataFormat GetFormat(size_t n) const = 0;
+ // ctor & dtor
+ wxDropTarget(wxDataObject *dataObject = NULL);
+ virtual ~wxDropTarget();
+
+ // normally called by wxWindow on window creation/destruction, but might be
+ // called `manually' as well. Register() returns true on success.
+ bool Register(WXHWND hwnd);
+ void Revoke(WXHWND hwnd);
+
+ // provide default implementation for base class pure virtuals
+ virtual bool OnDrop(wxCoord x, wxCoord y);
+ virtual bool GetData();
+
+ // implementation only from now on
+ // -------------------------------
+
+ // do we accept this kind of data?
+ bool IsAcceptedData(IDataObject *pIDataSource) const;
+
+ // give us the data source from IDropTarget::Drop() - this is later used by
+ // GetData() when it's called from inside OnData()
+ void SetDataSource(IDataObject *pIDataSource);