summaryrefslogtreecommitdiffstats
path: root/src/plugins/platforms/cocoa/qcocoadrag.h
diff options
context:
space:
mode:
authorJames Turner <james.turner@kdab.com>2012-06-20 15:01:56 +0200
committerQt by Nokia <qt-info@nokia.com>2012-07-04 18:00:41 +0200
commit76b1df303237c1bd37e4b822f44686980e66b73f (patch)
tree46dcd5ef12228319ec9ee394dde08b977b7a35ea /src/plugins/platforms/cocoa/qcocoadrag.h
parenta8fb38f230da9a7afc3dbace6fa45c33dc58b4a6 (diff)
Native drag implementation on Mac
Create a native implementation of QCocoaDrag, using the 10.6 (and earlier) Cocoa dragging API. This matches the implementation in Qt4 closely for the moment. In the future it may be desirable to create an alternative implementation using the new (non-blocking) drag API introduced in 10.7, but that will require deeper changes to the mime-data handling. This changes makes one more method on QPlatformDrag virtual, since the Cocoa behaviour diverges from the base version: ::defaultAction is customised. Change-Id: I1843293a62b2b4973a07b5e75ea3c312dc064018 Reviewed-by: Christoph Schleifenbaum <christoph.schleifenbaum@kdab.com> Reviewed-by: Friedemann Kleint <Friedemann.Kleint@nokia.com> Reviewed-by: Morten Johan Sørvig <morten.sorvig@nokia.com>
Diffstat (limited to 'src/plugins/platforms/cocoa/qcocoadrag.h')
-rw-r--r--src/plugins/platforms/cocoa/qcocoadrag.h21
1 files changed, 20 insertions, 1 deletions
diff --git a/src/plugins/platforms/cocoa/qcocoadrag.h b/src/plugins/platforms/cocoa/qcocoadrag.h
index 5a0a3fa271..cb8a71ed92 100644
--- a/src/plugins/platforms/cocoa/qcocoadrag.h
+++ b/src/plugins/platforms/cocoa/qcocoadrag.h
@@ -51,10 +51,29 @@
QT_BEGIN_NAMESPACE
-class QCocoaDrag : public QSimpleDrag
+class QCocoaDrag : public QPlatformDrag
{
public:
+ QCocoaDrag();
+
+ virtual QMimeData *platformDropData();
+ virtual Qt::DropAction drag(QDrag *m_drag);
+
+ virtual Qt::DropAction defaultAction(Qt::DropActions possibleActions,
+ Qt::KeyboardModifiers modifiers) const;
+
+ /**
+ * to meet NSView dragImage:at guarantees, we need to record the original
+ * event and view when handling an event in QNSView
+ */
+ void setLastMouseEvent(NSEvent *event, NSView *view);
+
+ void setAcceptedAction(Qt::DropAction act);
private:
+ QDrag *m_drag;
+ NSEvent *m_lastEvent;
+ NSView *m_lastView;
+ Qt::DropAction m_executed_drop_action;
};
class QCocoaDropData : public QInternalMimeData