NativeWebWheelEvent.h 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293
  1. /*
  2. * Copyright (C) 2011 Apple Inc. All rights reserved.
  3. *
  4. * Redistribution and use in source and binary forms, with or without
  5. * modification, are permitted provided that the following conditions
  6. * are met:
  7. * 1. Redistributions of source code must retain the above copyright
  8. * notice, this list of conditions and the following disclaimer.
  9. * 2. Redistributions in binary form must reproduce the above copyright
  10. * notice, this list of conditions and the following disclaimer in the
  11. * documentation and/or other materials provided with the distribution.
  12. *
  13. * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
  14. * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
  15. * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
  16. * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
  17. * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
  18. * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
  19. * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
  20. * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
  21. * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
  22. * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
  23. * THE POSSIBILITY OF SUCH DAMAGE.
  24. */
  25. #ifndef NativeWebWheelEvent_h
  26. #define NativeWebWheelEvent_h
  27. #include "WebEvent.h"
  28. #if PLATFORM(MAC)
  29. #include <wtf/RetainPtr.h>
  30. OBJC_CLASS NSView;
  31. #elif PLATFORM(QT)
  32. #include <qevent.h>
  33. #elif PLATFORM(GTK)
  34. #include <GOwnPtrGtk.h>
  35. typedef union _GdkEvent GdkEvent;
  36. #elif PLATFORM(MANX)
  37. #include <manx/WheelEvent.h>
  38. #include <wtf/OwnPtr.h>
  39. #elif PLATFORM(EFL)
  40. #include <Evas.h>
  41. #include <WebCore/AffineTransform.h>
  42. #endif
  43. namespace WebKit {
  44. class NativeWebWheelEvent : public WebWheelEvent {
  45. public:
  46. #if USE(APPKIT)
  47. NativeWebWheelEvent(NSEvent *, NSView *);
  48. #elif PLATFORM(QT)
  49. explicit NativeWebWheelEvent(QWheelEvent*, const QTransform& fromItemTransform);
  50. #elif PLATFORM(GTK)
  51. NativeWebWheelEvent(const NativeWebWheelEvent&);
  52. NativeWebWheelEvent(GdkEvent*);
  53. #elif PLATFORM(MANX)
  54. NativeWebWheelEvent(const Manx::WheelEvent&);
  55. #elif PLATFORM(EFL)
  56. NativeWebWheelEvent(const Evas_Event_Mouse_Wheel*, const WebCore::AffineTransform& toWebContent, const WebCore::AffineTransform& toDeviceScreen);
  57. #endif
  58. #if USE(APPKIT)
  59. NSEvent* nativeEvent() const { return m_nativeEvent.get(); }
  60. #elif PLATFORM(QT)
  61. const QWheelEvent* nativeEvent() const { return m_nativeEvent; }
  62. #elif PLATFORM(GTK)
  63. const GdkEvent* nativeEvent() const { return m_nativeEvent.get(); }
  64. #elif PLATFORM(MANX)
  65. const Manx::WheelEvent* nativeEvent() const { return &m_nativeEvent; }
  66. #elif PLATFORM(EFL)
  67. const Evas_Event_Mouse_Wheel* nativeEvent() const { return m_nativeEvent; }
  68. #endif
  69. private:
  70. #if USE(APPKIT)
  71. RetainPtr<NSEvent> m_nativeEvent;
  72. #elif PLATFORM(QT)
  73. QWheelEvent* m_nativeEvent;
  74. #elif PLATFORM(GTK)
  75. GOwnPtr<GdkEvent> m_nativeEvent;
  76. #elif PLATFORM(MANX)
  77. Manx::WheelEvent m_nativeEvent;
  78. #elif PLATFORM(EFL)
  79. const Evas_Event_Mouse_Wheel* m_nativeEvent;
  80. #endif
  81. };
  82. } // namespace WebKit
  83. #endif // NativeWebWheelEvent_h