+bool wxUIActionSimulator::MouseDblClick(int button)
+{
+ CGEventType downtype = CGEventTypeForMouseButton(button, true);
+ CGEventType uptype = CGEventTypeForMouseButton(button, false);
+ wxCFRef<CGEventRef> event(
+ CGEventCreateMouseEvent(NULL, downtype, GetMousePosition(), CGButtonForMouseButton(button)));
+
+ if ( !event )
+ return false;
+
+ CGEventSetType(event,downtype);
+ CGEventPost(tap, event);
+
+ CGEventSetType(event, uptype);
+ CGEventPost(tap, event);
+
+ CGEventSetIntegerValueField(event, kCGMouseEventClickState, 2);
+ CGEventSetType(event, downtype);
+ CGEventPost(tap, event);
+
+ CGEventSetType(event, uptype);
+ CGEventPost(tap, event);
+ wxCFEventLoop* loop = dynamic_cast<wxCFEventLoop*>(wxEventLoop::GetActive());
+ if (loop)
+ loop->SetShouldWaitForEvent(true);
+
+ return true;
+}
+
+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, kCGEventMouseMoved, pos1, CGButtonForMouseButton(button)));
+
+ if ( !event )
+ return false;
+
+ CGEventSetType(event,kCGEventMouseMoved);
+ CGEventPost(tap, event);
+
+ CGEventSetType(event,downtype);
+ CGEventPost(tap, event);
+
+
+ CGEventSetType(event, dragtype);
+ CGEventSetLocation(event,pos2);
+ CGEventPost(tap, event);
+
+ CGEventSetType(event, uptype);
+ CGEventPost(tap, event);
+ wxCFEventLoop* loop = dynamic_cast<wxCFEventLoop*>(wxEventLoop::GetActive());
+ if (loop)
+ loop->SetShouldWaitForEvent(true);
+