Bumping manifests a=b2g-bump
[gecko.git] / dom / gamepad / GamepadButton.h
bloba6e7d1bf6c2b9e59c491781f305f55d0ceef6e7c
1 /* This Source Code Form is subject to the terms of the Mozilla Public
2 * License, v. 2.0. If a copy of the MPL was not distributed with this file,
3 * You can obtain one at http://mozilla.org/MPL/2.0/. */
5 #ifndef mozilla_dom_gamepad_GamepadButton_h
6 #define mozilla_dom_gamepad_GamepadButton_h
8 #include <stdint.h>
9 #include "nsCOMPtr.h"
10 #include "nsWrapperCache.h"
12 namespace mozilla {
13 namespace dom {
15 class GamepadButton : public nsISupports,
16 public nsWrapperCache
18 public:
19 explicit GamepadButton(nsISupports* aParent) : mParent(aParent),
20 mPressed(false),
21 mValue(0)
23 SetIsDOMBinding();
26 NS_DECL_CYCLE_COLLECTING_ISUPPORTS
27 NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_CLASS(GamepadButton)
29 nsISupports* GetParentObject() const
31 return mParent;
34 virtual JSObject* WrapObject(JSContext* aCx) MOZ_OVERRIDE;
36 void SetPressed(bool aPressed)
38 mPressed = aPressed;
41 void SetValue(double aValue)
43 mValue = aValue;
46 bool Pressed() const
48 return mPressed;
51 double Value() const
53 return mValue;
56 private:
57 virtual ~GamepadButton() {}
59 protected:
60 nsCOMPtr<nsISupports> mParent;
61 bool mPressed;
62 double mValue;
65 } // namespace dom
66 } // namespace mozilla
68 #endif // mozilla_dom_gamepad_GamepadButton_h