2013-04-05 12:49:00 +04: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 18:58:42 +04:00
|
|
|
#ifndef mozilla_dom_Touch_h_
|
|
|
|
#define mozilla_dom_Touch_h_
|
2013-04-05 12:49:00 +04:00
|
|
|
|
|
|
|
#include "mozilla/Attributes.h"
|
2013-09-24 14:04:14 +04:00
|
|
|
#include "mozilla/EventForwards.h"
|
2014-02-27 01:37:01 +04:00
|
|
|
#include "mozilla/MouseEvents.h"
|
2013-05-19 01:18:12 +04:00
|
|
|
#include "nsWrapperCache.h"
|
2013-09-07 00:15:04 +04:00
|
|
|
#include "nsAutoPtr.h"
|
2013-07-10 13:55:05 +04:00
|
|
|
#include "Units.h"
|
2013-04-05 12:49:00 +04:00
|
|
|
|
2013-08-19 14:15:55 +04:00
|
|
|
class nsPresContext;
|
|
|
|
|
2013-04-05 12:49:00 +04:00
|
|
|
namespace mozilla {
|
|
|
|
namespace dom {
|
|
|
|
|
2013-08-19 14:15:55 +04:00
|
|
|
class EventTarget;
|
|
|
|
|
2013-08-05 08:51:22 +04:00
|
|
|
class Touch MOZ_FINAL : public nsISupports
|
2013-04-21 10:42:19 +04:00
|
|
|
, public nsWrapperCache
|
2014-02-27 01:37:01 +04:00
|
|
|
, public WidgetPointerHelper
|
2013-04-05 12:49:00 +04:00
|
|
|
{
|
|
|
|
public:
|
2014-02-06 22:28:14 +04:00
|
|
|
static bool PrefEnabled(JSContext* aCx, JSObject* aGlobal);
|
2013-04-21 10:42:19 +04:00
|
|
|
|
2014-02-28 18:58:42 +04:00
|
|
|
Touch(EventTarget* aTarget,
|
2013-04-05 12:49:00 +04: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 14:15:55 +04:00
|
|
|
float aForce);
|
2013-04-05 12:49:00 +04:00
|
|
|
Touch(int32_t aIdentifier,
|
2015-02-02 01:27:31 +03:00
|
|
|
LayoutDeviceIntPoint aPoint,
|
2013-04-05 12:49:00 +04:00
|
|
|
nsIntPoint aRadius,
|
|
|
|
float aRotationAngle,
|
2013-08-19 14:15:55 +04:00
|
|
|
float aForce);
|
|
|
|
|
2013-04-05 12:49:00 +04:00
|
|
|
NS_DECL_CYCLE_COLLECTING_ISUPPORTS
|
2013-04-21 10:42:19 +04:00
|
|
|
NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_CLASS(Touch)
|
2013-05-18 00:17:53 +04:00
|
|
|
|
2013-10-02 07:46:04 +04:00
|
|
|
void InitializePoints(nsPresContext* aPresContext, WidgetEvent* aEvent);
|
2013-05-18 00:17:53 +04:00
|
|
|
|
2014-02-28 18:58:42 +04:00
|
|
|
void SetTarget(EventTarget* aTarget);
|
2013-08-19 14:15:55 +04:00
|
|
|
|
2013-08-02 11:06:35 +04:00
|
|
|
bool Equals(Touch* aTouch);
|
2013-04-05 12:49:00 +04:00
|
|
|
|
2014-04-09 02:27:18 +04:00
|
|
|
virtual JSObject* WrapObject(JSContext* aCx) MOZ_OVERRIDE;
|
2014-03-19 20:35:45 +04:00
|
|
|
|
|
|
|
EventTarget* GetParentObject();
|
2013-04-21 10:42:19 +04:00
|
|
|
|
|
|
|
// WebIDL
|
|
|
|
int32_t Identifier() const { return mIdentifier; }
|
2014-05-05 14:48:50 +04:00
|
|
|
EventTarget* GetTarget() const;
|
2013-04-21 10:42:19 +04: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 11:06:35 +04:00
|
|
|
nsCOMPtr<EventTarget> mTarget;
|
2015-02-02 01:27:31 +03:00
|
|
|
LayoutDeviceIntPoint mRefPoint;
|
2013-08-02 11:06:35 +04:00
|
|
|
bool mChanged;
|
|
|
|
uint32_t mMessage;
|
2013-04-05 12:49:00 +04:00
|
|
|
int32_t mIdentifier;
|
2013-07-10 13:55:05 +04:00
|
|
|
CSSIntPoint mPagePoint;
|
|
|
|
CSSIntPoint mClientPoint;
|
2013-04-05 12:49:00 +04:00
|
|
|
nsIntPoint mScreenPoint;
|
|
|
|
nsIntPoint mRadius;
|
|
|
|
float mRotationAngle;
|
|
|
|
float mForce;
|
|
|
|
protected:
|
2014-06-23 23:56:07 +04:00
|
|
|
~Touch();
|
|
|
|
|
2013-04-05 12:49:00 +04:00
|
|
|
bool mPointsInitialized;
|
|
|
|
};
|
|
|
|
|
|
|
|
} // namespace dom
|
|
|
|
} // namespace mozilla
|
|
|
|
|
2014-02-28 18:58:42 +04:00
|
|
|
#endif // mozilla_dom_Touch_h_
|