PlatformTouchEvent.h 2.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495
  1. /*
  2. Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies)
  3. This library is free software; you can redistribute it and/or
  4. modify it under the terms of the GNU Library General Public
  5. License as published by the Free Software Foundation; either
  6. version 2 of the License, or (at your option) any later version.
  7. This library is distributed in the hope that it will be useful,
  8. but WITHOUT ANY WARRANTY; without even the implied warranty of
  9. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  10. Library General Public License for more details.
  11. You should have received a copy of the GNU Library General Public License
  12. along with this library; see the file COPYING.LIB. If not, write to
  13. the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
  14. Boston, MA 02110-1301, USA.
  15. */
  16. #ifndef PlatformTouchEvent_h
  17. #define PlatformTouchEvent_h
  18. #include "PlatformEvent.h"
  19. #include "PlatformTouchPoint.h"
  20. #include <wtf/Vector.h>
  21. #if ENABLE(TOUCH_EVENTS)
  22. #if PLATFORM(QT)
  23. QT_BEGIN_NAMESPACE
  24. class QTouchEvent;
  25. QT_END_NAMESPACE
  26. #endif
  27. #if PLATFORM(BLACKBERRY)
  28. namespace BlackBerry {
  29. namespace Platform {
  30. class TouchEvent;
  31. };
  32. };
  33. #endif
  34. #if PLATFORM(MANX)
  35. namespace Manx {
  36. struct TouchEvent;
  37. }
  38. #endif
  39. namespace WebCore {
  40. class PlatformTouchEvent : public PlatformEvent {
  41. public:
  42. PlatformTouchEvent()
  43. : PlatformEvent(PlatformEvent::TouchStart)
  44. #if PLATFORM(BLACKBERRY)
  45. , m_rotation(0)
  46. , m_scale(1)
  47. , m_doubleTap(false)
  48. , m_touchHold(false)
  49. #endif
  50. {
  51. }
  52. #if PLATFORM(BLACKBERRY)
  53. explicit PlatformTouchEvent(BlackBerry::Platform::TouchEvent*);
  54. #elif PLATFORM(MANX)
  55. PlatformTouchEvent(const Manx::TouchEvent& event);
  56. #endif
  57. const Vector<PlatformTouchPoint>& touchPoints() const { return m_touchPoints; }
  58. #if PLATFORM(BLACKBERRY)
  59. float rotation() const { return m_rotation; }
  60. float scale() const { return m_scale; }
  61. bool doubleTap() const { return m_doubleTap; }
  62. bool touchHold() const { return m_touchHold; }
  63. #endif
  64. protected:
  65. Vector<PlatformTouchPoint> m_touchPoints;
  66. #if PLATFORM(BLACKBERRY)
  67. float m_rotation;
  68. float m_scale;
  69. bool m_doubleTap;
  70. bool m_touchHold;
  71. #endif
  72. };
  73. }
  74. #endif // ENABLE(TOUCH_EVENTS)
  75. #endif // PlatformTouchEvent_h