Update contrib.
1 // Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
2 // All rights reserved.
3 // This component and the accompanying materials are made available
4 // under the terms of "Eclipse Public License v1.0"
5 // which accompanies this distribution, and is available
6 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
8 // Initial Contributors:
9 // Nokia Corporation - initial contribution.
19 @internalComponent - Internal Symbian test code
23 #include "te_gesturegenerator.h"
29 void GestureGenerator::SimulateFlickGestureL(RSemaphore& aSemaphore, TPoint aStartPoint, TPoint aEndPoint)
31 GenerateEventL(aSemaphore, TRawEvent::EButton1Down, aStartPoint.iX, aStartPoint.iY);
32 TPoint currentPosition(aStartPoint);
36 Math::Sqrt(distance, (aEndPoint.iX - aStartPoint.iX)*(aEndPoint.iX - aStartPoint.iX) + (aEndPoint.iY - aStartPoint.iY)*(aEndPoint.iY - aStartPoint.iY));
38 TReal deltaX = (aEndPoint.iX - aStartPoint.iX) / distance;
39 TReal deltaY = (aEndPoint.iY - aStartPoint.iY) / distance;
40 while (currentPosition != aEndPoint)
44 currentPosition.SetXY(aStartPoint.iX + currentX, aStartPoint.iY + currentY);
45 GenerateEventL(aSemaphore, TRawEvent::EPointerMove, currentPosition.iX, currentPosition.iY);
47 GenerateEventL(aSemaphore, TRawEvent::EButton1Up, aStartPoint.iX, aStartPoint.iY);
51 * Generates events to communicate with the control. Each time the control receives an event
52 * it redraws itself. That's necessary because the draw method can't be called directly from
55 void GestureGenerator::GenerateEventL(RSemaphore& aSemaphore, TRawEvent::TType aEventType, TInt aX, TInt aY)
58 rawEvent.Set(aEventType, aX, aY);
59 User::LeaveIfError(UserSvr::AddEvent(rawEvent));