1 /* 2 Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies) 3 4 This library is free software; you can redistribute it and/or 5 modify it under the terms of the GNU Library General Public 6 License as published by the Free Software Foundation; either 7 version 2 of the License, or (at your option) any later version. 8 9 This library is distributed in the hope that it will be useful, 10 but WITHOUT ANY WARRANTY; without even the implied warranty of 11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 12 Library General Public License for more details. 13 14 You should have received a copy of the GNU Library General Public License 15 along with this library; see the file COPYING.LIB. If not, write to 16 the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, 17 Boston, MA 02110-1301, USA. 18 */ 19 20 #ifndef PlatformTouchEvent_h 21 #define PlatformTouchEvent_h 22 23 #include "PlatformTouchPoint.h" 24 #include <wtf/Vector.h> 25 26 #if ENABLE(TOUCH_EVENTS) 27 28 #if PLATFORM(QT) 29 QT_BEGIN_NAMESPACE 30 class QTouchEvent; 31 QT_END_NAMESPACE 32 #endif 33 34 #if PLATFORM(ANDROID) 35 #include "IntPoint.h" 36 #endif 37 38 namespace WebCore { 39 40 enum TouchEventType { 41 TouchStart 42 , TouchMove 43 , TouchEnd 44 , TouchCancel 45 #if PLATFORM(ANDROID) 46 , TouchLongPress 47 , TouchDoubleTap 48 #endif 49 }; 50 51 class PlatformTouchEvent { 52 public: PlatformTouchEvent()53 PlatformTouchEvent() 54 : m_type(TouchStart) 55 , m_ctrlKey(false) 56 , m_altKey(false) 57 , m_shiftKey(false) 58 , m_metaKey(false) 59 {} 60 #if PLATFORM(QT) 61 PlatformTouchEvent(QTouchEvent*); 62 #elif PLATFORM(ANDROID) 63 PlatformTouchEvent(const IntPoint& windowPos, TouchEventType, PlatformTouchPoint::State, int metaState); 64 #endif 65 type()66 TouchEventType type() const { return m_type; } touchPoints()67 const Vector<PlatformTouchPoint>& touchPoints() const { return m_touchPoints; } 68 ctrlKey()69 bool ctrlKey() const { return m_ctrlKey; } altKey()70 bool altKey() const { return m_altKey; } shiftKey()71 bool shiftKey() const { return m_shiftKey; } metaKey()72 bool metaKey() const { return m_metaKey; } 73 74 private: 75 TouchEventType m_type; 76 Vector<PlatformTouchPoint> m_touchPoints; 77 bool m_ctrlKey; 78 bool m_altKey; 79 bool m_shiftKey; 80 bool m_metaKey; 81 }; 82 83 } 84 85 #endif // ENABLE(TOUCH_EVENTS) 86 87 #endif // PlatformTouchEvent_h 88