Implement initial try of wxDropTarget.
The drop target needs to use an event filter to capture drag-and-drop events from the window.
This commit is contained in:
@@ -10,22 +10,30 @@
|
||||
|
||||
#define wxDROP_ICON(name) wxICON(name)
|
||||
|
||||
class QMimeData;
|
||||
|
||||
class WXDLLIMPEXP_CORE wxDropTarget : public wxDropTargetBase
|
||||
{
|
||||
public:
|
||||
wxDropTarget(wxDataObject *dataObject = NULL );
|
||||
wxDropTarget(wxDataObject *dataObject = NULL);
|
||||
|
||||
virtual bool OnDrop(wxCoord x, wxCoord y);
|
||||
virtual wxDragResult OnData(wxCoord x, wxCoord y, wxDragResult def);
|
||||
virtual bool GetData();
|
||||
virtual bool OnDrop(wxCoord x, wxCoord y) wxOVERRIDE;
|
||||
virtual wxDragResult OnData(wxCoord x, wxCoord y, wxDragResult def) wxOVERRIDE;
|
||||
virtual bool GetData() wxOVERRIDE;
|
||||
|
||||
wxDataFormat GetMatchingPair();
|
||||
|
||||
protected:
|
||||
void OnQtEnter(QEvent* event);
|
||||
void OnQtLeave(QEvent* event);
|
||||
void OnQtMove(QEvent* event);
|
||||
void OnQtDrop(QEvent* event);
|
||||
|
||||
private:
|
||||
};
|
||||
class PendingMimeDataSetter;
|
||||
friend class PendingMimeDataSetter;
|
||||
|
||||
const QMimeData* m_pendingMimeData;
|
||||
};
|
||||
|
||||
class WXDLLIMPEXP_CORE wxDropSource: public wxDropSourceBase
|
||||
{
|
||||
|
@@ -10,6 +10,7 @@
|
||||
#define _WX_QT_WINDOW_H_
|
||||
|
||||
#include <list>
|
||||
#include <QObject>
|
||||
|
||||
class QShortcut;
|
||||
template < class T > class QList;
|
||||
@@ -216,6 +217,16 @@ protected:
|
||||
QWidget *m_qtWindow;
|
||||
|
||||
private:
|
||||
class DnDEventAdapter : public QObject
|
||||
{
|
||||
public:
|
||||
DnDEventAdapter();
|
||||
virtual bool eventFilter(QObject* watched, QEvent* event);
|
||||
void SetDropTarget(wxDropTarget* dropTarget, QWidget* window);
|
||||
private:
|
||||
wxDropTarget *m_dropTarget;
|
||||
};
|
||||
|
||||
void Init();
|
||||
QScrollArea *m_qtContainer;
|
||||
|
||||
@@ -238,6 +249,10 @@ private:
|
||||
bool m_processingShortcut;
|
||||
#endif // wxUSE_ACCEL
|
||||
|
||||
#if wxUSE_DRAG_AND_DROP
|
||||
DnDEventAdapter dnd_event_adapter;
|
||||
#endif
|
||||
|
||||
wxDECLARE_DYNAMIC_CLASS_NO_COPY( wxWindowQt );
|
||||
};
|
||||
|
||||
|
Reference in New Issue
Block a user