Line data Source code
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 : {
19 : public:
20 : WheelEvent(EventTarget* aOwner,
21 : nsPresContext* aPresContext,
22 : WidgetWheelEvent* aWheelEvent);
23 :
24 : NS_DECL_ISUPPORTS_INHERITED
25 :
26 : // Forward to base class
27 0 : NS_FORWARD_TO_MOUSEEVENT
28 :
29 : static
30 : already_AddRefed<WheelEvent> Constructor(const GlobalObject& aGlobal,
31 : const nsAString& aType,
32 : const WheelEventInit& aParam,
33 : ErrorResult& aRv);
34 :
35 0 : virtual JSObject* WrapObjectInternal(JSContext* aCx, JS::Handle<JSObject*> aGivenProto) override
36 : {
37 0 : return WheelEventBinding::Wrap(aCx, this, aGivenProto);
38 : }
39 :
40 : // NOTE: DeltaX(), DeltaY() and DeltaZ() return CSS pixels when deltaMode is
41 : // DOM_DELTA_PIXEL. (The internal event's delta values are device pixels
42 : // if it's dispatched by widget)
43 : double DeltaX();
44 : double DeltaY();
45 : double DeltaZ();
46 : uint32_t DeltaMode();
47 :
48 : void
49 : InitWheelEvent(const nsAString& aType, bool aCanBubble, bool aCancelable,
50 : nsGlobalWindow* aView, int32_t aDetail,
51 : int32_t aScreenX, int32_t aScreenY,
52 : int32_t aClientX, int32_t aClientY, uint16_t aButton,
53 : EventTarget* aRelatedTarget, const nsAString& aModifiersList,
54 : double aDeltaX, double aDeltaY, double aDeltaZ,
55 : uint32_t aDeltaMode);
56 :
57 : protected:
58 0 : ~WheelEvent() {}
59 :
60 : private:
61 : int32_t mAppUnitsPerDevPixel;
62 : };
63 :
64 : } // namespace dom
65 : } // namespace mozilla
66 :
67 : already_AddRefed<mozilla::dom::WheelEvent>
68 : NS_NewDOMWheelEvent(mozilla::dom::EventTarget* aOwner,
69 : nsPresContext* aPresContext,
70 : mozilla::WidgetWheelEvent* aEvent);
71 :
72 : #endif // mozilla_dom_WheelEvent_h_
|