SimpleGestureEvent.h (2883B)
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 5 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ 6 7 #ifndef mozilla_dom_SimpleGestureEvent_h_ 8 #define mozilla_dom_SimpleGestureEvent_h_ 9 10 #include "mozilla/EventForwards.h" 11 #include "mozilla/dom/MouseEvent.h" 12 #include "mozilla/dom/SimpleGestureEventBinding.h" 13 14 class nsPresContext; 15 16 namespace mozilla::dom { 17 18 class SimpleGestureEvent : public MouseEvent { 19 public: 20 SimpleGestureEvent(EventTarget* aOwner, nsPresContext* aPresContext, 21 WidgetSimpleGestureEvent* aEvent); 22 23 NS_INLINE_DECL_REFCOUNTING_INHERITED(SimpleGestureEvent, MouseEvent) 24 25 virtual JSObject* WrapObjectInternal( 26 JSContext* aCx, JS::Handle<JSObject*> aGivenProto) override { 27 return SimpleGestureEvent_Binding::Wrap(aCx, this, aGivenProto); 28 } 29 30 uint32_t AllowedDirections() const; 31 void SetAllowedDirections(uint32_t aAllowedDirections); 32 uint32_t Direction() const; 33 double Delta() const; 34 uint32_t ClickCount() const; 35 36 void InitSimpleGestureEvent(const nsAString& aType, bool aCanBubble, 37 bool aCancelable, nsGlobalWindowInner* aView, 38 int32_t aDetail, int32_t aScreenX, 39 int32_t aScreenY, int32_t aClientX, 40 int32_t aClientY, bool aCtrlKey, bool aAltKey, 41 bool aShiftKey, bool aMetaKey, uint16_t aButton, 42 EventTarget* aRelatedTarget, 43 uint32_t aAllowedDirections, uint32_t aDirection, 44 double aDelta, uint32_t aClickCount) { 45 InitSimpleGestureEventInternal( 46 aType, aCanBubble, aCancelable, aView, aDetail, aScreenX, aScreenY, 47 aClientX, aClientY, aCtrlKey, aAltKey, aShiftKey, aMetaKey, aButton, 48 aRelatedTarget, aAllowedDirections, aDirection, aDelta, aClickCount); 49 } 50 51 protected: 52 ~SimpleGestureEvent() = default; 53 54 void InitSimpleGestureEventInternal( 55 const nsAString& aType, bool aCanBubble, bool aCancelable, 56 nsGlobalWindowInner* aView, int32_t aDetail, double aScreenX, 57 double aScreenY, double aClientX, double aClientY, bool aCtrlKey, 58 bool aAltKey, bool aShiftKey, bool aMetaKey, uint16_t aButton, 59 EventTarget* aRelatedTarget, uint32_t aAllowedDirections, 60 uint32_t aDirection, double aDelta, uint32_t aClickCount); 61 }; 62 63 } // namespace mozilla::dom 64 65 already_AddRefed<mozilla::dom::SimpleGestureEvent> NS_NewDOMSimpleGestureEvent( 66 mozilla::dom::EventTarget* aOwner, nsPresContext* aPresContext, 67 mozilla::WidgetSimpleGestureEvent* aEvent); 68 69 #endif // mozilla_dom_SimpleGestureEvent_h_