]> git.saurik.com Git - wxWidgets.git/commitdiff
reusing existing API
authorStefan Csomor <csomor@advancedconcepts.ch>
Thu, 13 Jun 2013 14:04:41 +0000 (14:04 +0000)
committerStefan Csomor <csomor@advancedconcepts.ch>
Thu, 13 Jun 2013 14:04:41 +0000 (14:04 +0000)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@74234 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

include/wx/uiaction.h
src/common/uiactioncmn.cpp
src/osx/uiaction_osx.cpp

index 1fce3897705f77229df61a242e659f2c41d6f80e..68de3dde6a713665d5e55ba49aacecc3486d4f04 100644 (file)
@@ -49,10 +49,6 @@ public:
                        int button = wxMOUSE_BTN_LEFT)
     { return MouseDragDrop(p1.x, p1.y, p2.x, p2.y, button); }
 
-    bool MouseClickAndDragTo(long x, long y, int button = wxMOUSE_BTN_LEFT);
-    bool MouseClickAndDragTo(const wxPoint& point, int button = wxMOUSE_BTN_LEFT)
-    { return MouseClickAndDragTo(point.x, point.y, button); }
-
     // Keyboard simulation
     // -------------------
 
index cf718d2a01618cbce9ab0152fe5a3a145ae47553..0df4aea34b54692b17e82ba16a4f8ef95b173437 100644 (file)
@@ -37,28 +37,19 @@ bool wxUIActionSimulator::MouseDblClick(int button)
     return true;
 }
 
-bool wxUIActionSimulator::MouseClickAndDragTo(long x, long y, int button)
-{
-    MouseDown(button);
-    MouseMove(x,y);
-    MouseUp(button);
-    return true;
-}
-
-#endif
-
-bool
-wxUIActionSimulator::MouseDragDrop(long x1, long y1, long x2, long y2,
+bool wxUIActionSimulator::MouseDragDrop(long x1, long y1, long x2, long y2,
                                    int button)
 {
     MouseMove(x1, y1);
     MouseDown(button);
     MouseMove(x2, y2);
     MouseUp(button);
-
+    
     return true;
 }
 
+#endif
+
 bool
 wxUIActionSimulator::Key(int keycode, int modifiers, bool isDown)
 {
index 5c1bbade278bb149fcfca1f7ae36200788e70072..7c75e105e2f8321247ca9b53299035dce300e438 100644 (file)
@@ -202,27 +202,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);