1 /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ 2 /* vim: set ts=8 sts=2 et sw=2 tw=80: */ 3 /* This Source Code Form is subject to the terms of the Mozilla Public 4 * License, v. 2.0. If a copy of the MPL was not distributed with this file, 5 * You can obtain one at http://mozilla.org/MPL/2.0/. */ 6 7 #ifndef mozilla_dom_WheelEvent_h_ 8 #define mozilla_dom_WheelEvent_h_ 9 10 #include "mozilla/dom/MouseEvent.h" 11 #include "mozilla/dom/WheelEventBinding.h" 12 #include "mozilla/EventForwards.h" 13 14 namespace mozilla { 15 namespace dom { 16 17 class WheelEvent : public MouseEvent { 18 public: 19 WheelEvent(EventTarget* aOwner, nsPresContext* aPresContext, 20 WidgetWheelEvent* aWheelEvent); 21 22 NS_INLINE_DECL_REFCOUNTING_INHERITED(WheelEvent, MouseEvent) 23 24 static already_AddRefed<WheelEvent> Constructor(const GlobalObject& aGlobal, 25 const nsAString& aType, 26 const WheelEventInit& aParam); 27 WrapObjectInternal(JSContext * aCx,JS::Handle<JSObject * > aGivenProto)28 virtual JSObject* WrapObjectInternal( 29 JSContext* aCx, JS::Handle<JSObject*> aGivenProto) override { 30 return WheelEvent_Binding::Wrap(aCx, this, aGivenProto); 31 } 32 33 // NOTE: DeltaX(), DeltaY() and DeltaZ() return CSS pixels when deltaMode is 34 // DOM_DELTA_PIXEL. (The internal event's delta values are device pixels 35 // if it's dispatched by widget) 36 double DeltaX(); 37 double DeltaY(); 38 double DeltaZ(); 39 uint32_t DeltaMode(); 40 41 void InitWheelEvent(const nsAString& aType, bool aCanBubble, bool aCancelable, 42 nsGlobalWindowInner* aView, int32_t aDetail, 43 int32_t aScreenX, int32_t aScreenY, int32_t aClientX, 44 int32_t aClientY, uint16_t aButton, 45 EventTarget* aRelatedTarget, 46 const nsAString& aModifiersList, double aDeltaX, 47 double aDeltaY, double aDeltaZ, uint32_t aDeltaMode); 48 49 protected: 50 ~WheelEvent() = default; 51 52 private: 53 int32_t mAppUnitsPerDevPixel; 54 }; 55 56 } // namespace dom 57 } // namespace mozilla 58 59 already_AddRefed<mozilla::dom::WheelEvent> NS_NewDOMWheelEvent( 60 mozilla::dom::EventTarget* aOwner, nsPresContext* aPresContext, 61 mozilla::WidgetWheelEvent* aEvent); 62 63 #endif // mozilla_dom_WheelEvent_h_ 64