]> git.saurik.com Git - wxWidgets.git/blobdiff - src/osx/uiaction_osx.cpp
Applied #15375 to stop event-sending in generic wxSpinCtrl ctor (eco)
[wxWidgets.git] / src / osx / uiaction_osx.cpp
index 5c1bbade278bb149fcfca1f7ae36200788e70072..c916923a3fccfc3cd660ddbeabfa240750abdf07 100644 (file)
@@ -4,7 +4,6 @@
 // Author:      Kevin Ollivier, Steven Lamerton, Vadim Zeitlin
 // Modified by:
 // Created:     2010-03-06
-// RCS-ID:      $Id$
 // Copyright:   (c) Kevin Ollivier
 //              (c) 2010 Steven Lamerton
 //              (c) 2010 Vadim Zeitlin
@@ -202,27 +201,34 @@ bool wxUIActionSimulator::MouseDblClick(int button)
     return true;
 }
 
-bool wxUIActionSimulator::MouseClickAndDragTo(long x, long y, int button)
+bool wxUIActionSimulator::MouseDragDrop(long x1, long y1, long x2, long y2,
+                                        int button)
 {
+    CGPoint pos1,pos2;
+    pos1.x = x1;
+    pos1.y = y1;
+    pos2.x = x2;
+    pos2.y = y2;
+
     CGEventType downtype = CGEventTypeForMouseButton(button, true);
     CGEventType uptype = CGEventTypeForMouseButton(button, false);
     CGEventType dragtype = CGEventTypeForMouseDrag(button) ;
 
     wxCFRef<CGEventRef> event(
-                              CGEventCreateMouseEvent(NULL, downtype, GetMousePosition(), CGButtonForMouseButton(button)));
+                              CGEventCreateMouseEvent(NULL, kCGEventMouseMoved, pos1, CGButtonForMouseButton(button)));
     
     if ( !event )
         return false;
     
+    CGEventSetType(event,kCGEventMouseMoved);
+    CGEventPost(tap, event);
+    
     CGEventSetType(event,downtype);
     CGEventPost(tap, event);
     
-    CGPoint pos;
-    pos.x = x;
-    pos.y = y;
     
     CGEventSetType(event, dragtype);
-    CGEventSetLocation(event,pos);
+    CGEventSetLocation(event,pos2);
     CGEventPost(tap, event);
     
     CGEventSetType(event, uptype);