1 /* vim: set shiftwidth=2 tabstop=8 autoindent cindent expandtab: */
2 /* This Source Code Form is subject to the terms of the Mozilla Public
3 * License, v. 2.0. If a copy of the MPL was not distributed with this
4 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
6 #ifndef mozilla_dom_Touch_h_
7 #define mozilla_dom_Touch_h_
9 #include "mozilla/Attributes.h"
10 #include "mozilla/EventForwards.h"
11 #include "mozilla/MouseEvents.h"
12 #include "nsWrapperCache.h"
13 #include "nsAutoPtr.h"
23 class Touch MOZ_FINAL
: public nsISupports
24 , public nsWrapperCache
25 , public WidgetPointerHelper
28 static bool PrefEnabled(JSContext
* aCx
, JSObject
* aGlobal
);
30 Touch(EventTarget
* aTarget
,
42 Touch(int32_t aIdentifier
,
50 NS_DECL_CYCLE_COLLECTING_ISUPPORTS
51 NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_CLASS(Touch
)
53 void InitializePoints(nsPresContext
* aPresContext
, WidgetEvent
* aEvent
);
55 void SetTarget(EventTarget
* aTarget
);
57 bool Equals(Touch
* aTouch
);
59 virtual JSObject
* WrapObject(JSContext
* aCx
) MOZ_OVERRIDE
;
61 EventTarget
* GetParentObject();
64 int32_t Identifier() const { return mIdentifier
; }
65 EventTarget
* GetTarget() const;
66 int32_t ScreenX() const { return mScreenPoint
.x
; }
67 int32_t ScreenY() const { return mScreenPoint
.y
; }
68 int32_t ClientX() const { return mClientPoint
.x
; }
69 int32_t ClientY() const { return mClientPoint
.y
; }
70 int32_t PageX() const { return mPagePoint
.x
; }
71 int32_t PageY() const { return mPagePoint
.y
; }
72 int32_t RadiusX() const { return mRadius
.x
; }
73 int32_t RadiusY() const { return mRadius
.y
; }
74 float RotationAngle() const { return mRotationAngle
; }
75 float Force() const { return mForce
; }
77 nsCOMPtr
<EventTarget
> mTarget
;
82 CSSIntPoint mPagePoint
;
83 CSSIntPoint mClientPoint
;
84 nsIntPoint mScreenPoint
;
89 bool mPointsInitialized
;
93 } // namespace mozilla
95 #endif // mozilla_dom_Touch_h_