Bug 1025824 - Fix mHwcLayerMap handling r=sushil
[gecko.git] / dom / events / Touch.h
blobf220cdec3828b544f0a1d20457ddba3a9f9f6ad0
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"
14 #include "Units.h"
16 class nsPresContext;
18 namespace mozilla {
19 namespace dom {
21 class EventTarget;
23 class Touch MOZ_FINAL : public nsISupports
24 , public nsWrapperCache
25 , public WidgetPointerHelper
27 public:
28 static bool PrefEnabled(JSContext* aCx, JSObject* aGlobal);
30 Touch(EventTarget* aTarget,
31 int32_t aIdentifier,
32 int32_t aPageX,
33 int32_t aPageY,
34 int32_t aScreenX,
35 int32_t aScreenY,
36 int32_t aClientX,
37 int32_t aClientY,
38 int32_t aRadiusX,
39 int32_t aRadiusY,
40 float aRotationAngle,
41 float aForce);
42 Touch(int32_t aIdentifier,
43 nsIntPoint aPoint,
44 nsIntPoint aRadius,
45 float aRotationAngle,
46 float aForce);
48 ~Touch();
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();
63 // WebIDL
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;
78 nsIntPoint mRefPoint;
79 bool mChanged;
80 uint32_t mMessage;
81 int32_t mIdentifier;
82 CSSIntPoint mPagePoint;
83 CSSIntPoint mClientPoint;
84 nsIntPoint mScreenPoint;
85 nsIntPoint mRadius;
86 float mRotationAngle;
87 float mForce;
88 protected:
89 bool mPointsInitialized;
92 } // namespace dom
93 } // namespace mozilla
95 #endif // mozilla_dom_Touch_h_