qstmgesturelib/qstmutils.h
changeset 0 1450b09d0cfd
child 3 0954f5dd2cd0
equal deleted inserted replaced
-1:000000000000 0:1450b09d0cfd
       
     1 /*
       
     2 * Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
       
     3 * All rights reserved.
       
     4 * This component and the accompanying materials are made available
       
     5 * under the terms of "Eclipse Public License v1.0"
       
     6 * which accompanies this distribution, and is available
       
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     8 *
       
     9 * Initial Contributors:
       
    10 * Nokia Corporation - initial contribution.
       
    11 *
       
    12 * Contributors:
       
    13 *
       
    14 * Description: 
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #ifndef _GESTURE_UTILS_H_
       
    20 #define _GESTURE_UTILS_H_
       
    21 
       
    22 #include <QtCore>
       
    23 #include <QtGui>
       
    24 #ifdef Q_OS_SYMBIAN
       
    25 #include <e32math.h>
       
    26 #define SQRT(out,x) Math::Sqrt(out,x)
       
    27 #else
       
    28 #define SQRT(out,x) (out = sqrt(x))
       
    29 #endif
       
    30 
       
    31 #define MAX(a,b) ((a>=b) ? a : b)
       
    32 #define MIN(a,b) ((a<=b) ? a : b)
       
    33 #define ABS(x)   ((x>=0) ? x : -x)
       
    34 
       
    35 namespace qstmUiEventEngine
       
    36 {
       
    37 
       
    38     class QStm_Utils
       
    39     {
       
    40     public:
       
    41         static QRect  toleranceRectMm( const QPoint& aCenterPoint, int size_mm );
       
    42         static QRect  toleranceRectPx( const QPoint& aCenterPoint, int size_px );
       
    43         static long   mm2Pixels(long mm);
       
    44         static long   inches2Pixels(double inches);
       
    45         static qreal  distanceF(const QPoint& p1, const QPoint& p2);
       
    46         static int    distance(const QPoint& p1, const QPoint& p2);
       
    47         static int    longerEdge( const QSize& size );
       
    48     };
       
    49 }
       
    50 
       
    51 #endif // _GESTURE_UTILS_H_