2013-04-05 08:49:00 +00:00
|
|
|
/* vim: set shiftwidth=2 tabstop=8 autoindent cindent expandtab: */
|
|
|
|
/* This Source Code Form is subject to the terms of the Mozilla Public
|
|
|
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
|
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
|
|
|
|
2014-02-28 14:58:42 +00:00
|
|
|
#ifndef mozilla_dom_Touch_h_
|
|
|
|
#define mozilla_dom_Touch_h_
|
2013-04-05 08:49:00 +00:00
|
|
|
|
|
|
|
#include "mozilla/Attributes.h"
|
2013-09-24 10:04:14 +00:00
|
|
|
#include "mozilla/EventForwards.h"
|
2014-02-26 21:37:01 +00:00
|
|
|
#include "mozilla/MouseEvents.h"
|
2013-05-18 21:18:12 +00:00
|
|
|
#include "nsWrapperCache.h"
|
2013-09-06 20:15:04 +00:00
|
|
|
#include "nsAutoPtr.h"
|
2013-07-10 09:55:05 +00:00
|
|
|
#include "Units.h"
|
2013-04-05 08:49:00 +00:00
|
|
|
|
2013-08-19 10:15:55 +00:00
|
|
|
class nsPresContext;
|
|
|
|
|
2013-04-05 08:49:00 +00:00
|
|
|
namespace mozilla {
|
|
|
|
namespace dom {
|
|
|
|
|
2013-08-19 10:15:55 +00:00
|
|
|
class EventTarget;
|
|
|
|
|
2013-08-05 04:51:22 +00:00
|
|
|
class Touch MOZ_FINAL : public nsISupports
|
2013-04-21 06:42:19 +00:00
|
|
|
, public nsWrapperCache
|
2014-02-26 21:37:01 +00:00
|
|
|
, public WidgetPointerHelper
|
2013-04-05 08:49:00 +00:00
|
|
|
{
|
|
|
|
public:
|
2014-02-06 18:28:14 +00:00
|
|
|
static bool PrefEnabled(JSContext* aCx, JSObject* aGlobal);
|
2013-04-21 06:42:19 +00:00
|
|
|
|
2014-02-28 14:58:42 +00:00
|
|
|
Touch(EventTarget* aTarget,
|
2013-04-05 08:49:00 +00:00
|
|
|
int32_t aIdentifier,
|
|
|
|
int32_t aPageX,
|
|
|
|
int32_t aPageY,
|
|
|
|
int32_t aScreenX,
|
|
|
|
int32_t aScreenY,
|
|
|
|
int32_t aClientX,
|
|
|
|
int32_t aClientY,
|
|
|
|
int32_t aRadiusX,
|
|
|
|
int32_t aRadiusY,
|
|
|
|
float aRotationAngle,
|
2013-08-19 10:15:55 +00:00
|
|
|
float aForce);
|
2013-04-05 08:49:00 +00:00
|
|
|
Touch(int32_t aIdentifier,
|
|
|
|
nsIntPoint aPoint,
|
|
|
|
nsIntPoint aRadius,
|
|
|
|
float aRotationAngle,
|
2013-08-19 10:15:55 +00:00
|
|
|
float aForce);
|
|
|
|
|
|
|
|
~Touch();
|
2013-04-05 08:49:00 +00:00
|
|
|
|
|
|
|
NS_DECL_CYCLE_COLLECTING_ISUPPORTS
|
2013-04-21 06:42:19 +00:00
|
|
|
NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_CLASS(Touch)
|
2013-05-17 20:17:53 +00:00
|
|
|
|
2013-10-02 03:46:04 +00:00
|
|
|
void InitializePoints(nsPresContext* aPresContext, WidgetEvent* aEvent);
|
2013-05-17 20:17:53 +00:00
|
|
|
|
2014-02-28 14:58:42 +00:00
|
|
|
void SetTarget(EventTarget* aTarget);
|
2013-08-19 10:15:55 +00:00
|
|
|
|
2013-08-02 07:06:35 +00:00
|
|
|
bool Equals(Touch* aTouch);
|
2013-04-05 08:49:00 +00:00
|
|
|
|
2014-04-08 22:27:18 +00:00
|
|
|
virtual JSObject* WrapObject(JSContext* aCx) MOZ_OVERRIDE;
|
2014-03-19 16:35:45 +00:00
|
|
|
|
|
|
|
EventTarget* GetParentObject();
|
2013-04-21 06:42:19 +00:00
|
|
|
|
|
|
|
// WebIDL
|
|
|
|
int32_t Identifier() const { return mIdentifier; }
|
2014-05-05 10:48:50 +00:00
|
|
|
EventTarget* GetTarget() const;
|
2013-04-21 06:42:19 +00:00
|
|
|
int32_t ScreenX() const { return mScreenPoint.x; }
|
|
|
|
int32_t ScreenY() const { return mScreenPoint.y; }
|
|
|
|
int32_t ClientX() const { return mClientPoint.x; }
|
|
|
|
int32_t ClientY() const { return mClientPoint.y; }
|
|
|
|
int32_t PageX() const { return mPagePoint.x; }
|
|
|
|
int32_t PageY() const { return mPagePoint.y; }
|
|
|
|
int32_t RadiusX() const { return mRadius.x; }
|
|
|
|
int32_t RadiusY() const { return mRadius.y; }
|
|
|
|
float RotationAngle() const { return mRotationAngle; }
|
|
|
|
float Force() const { return mForce; }
|
|
|
|
|
2013-08-02 07:06:35 +00:00
|
|
|
nsCOMPtr<EventTarget> mTarget;
|
|
|
|
nsIntPoint mRefPoint;
|
|
|
|
bool mChanged;
|
|
|
|
uint32_t mMessage;
|
2013-04-05 08:49:00 +00:00
|
|
|
int32_t mIdentifier;
|
2013-07-10 09:55:05 +00:00
|
|
|
CSSIntPoint mPagePoint;
|
|
|
|
CSSIntPoint mClientPoint;
|
2013-04-05 08:49:00 +00:00
|
|
|
nsIntPoint mScreenPoint;
|
|
|
|
nsIntPoint mRadius;
|
|
|
|
float mRotationAngle;
|
|
|
|
float mForce;
|
|
|
|
protected:
|
|
|
|
bool mPointsInitialized;
|
|
|
|
};
|
|
|
|
|
|
|
|
} // namespace dom
|
|
|
|
} // namespace mozilla
|
|
|
|
|
2014-02-28 14:58:42 +00:00
|
|
|
#endif // mozilla_dom_Touch_h_
|