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 file,
5 * You can obtain one at http://mozilla.org/MPL/2.0/. */
7 #ifndef mozilla_dom_gamepad_GamepadTouch_h
8 #define mozilla_dom_gamepad_GamepadTouch_h
10 #include "mozilla/dom/GamepadTouchBinding.h"
11 #include "mozilla/dom/GamepadTouchState.h"
16 class GamepadTouch final
: public nsWrapperCache
{
18 explicit GamepadTouch(nsISupports
* aParent
);
20 NS_INLINE_DECL_CYCLE_COLLECTING_NATIVE_REFCOUNTING(GamepadTouch
)
21 NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_NATIVE_CLASS(GamepadTouch
)
23 nsISupports
* GetParentObject() const { return mParent
; }
24 virtual JSObject
* WrapObject(JSContext
* aCx
,
25 JS::Handle
<JSObject
*> aGivenProto
) override
;
26 uint32_t TouchId() const { return mTouchState
.touchId
; }
27 uint32_t SurfaceId() const { return mTouchState
.surfaceId
; }
28 void GetPosition(JSContext
* aCx
, JS::MutableHandle
<JSObject
*> aRetval
,
30 void GetSurfaceDimensions(JSContext
* aCx
,
31 JS::MutableHandle
<JSObject
*> aRetval
,
33 void SetTouchState(const GamepadTouchState
& aTouch
);
34 void Set(const GamepadTouch
* aOther
);
37 virtual ~GamepadTouch();
39 nsCOMPtr
<nsISupports
> mParent
;
40 JS::Heap
<JSObject
*> mPosition
;
41 JS::Heap
<JSObject
*> mSurfaceDimensions
;
42 GamepadTouchState mTouchState
;
46 } // namespace mozilla
48 #endif // mozilla_dom_gamepad_GamepadTouch_h