michael@0: /* This Source Code Form is subject to the terms of the Mozilla Public michael@0: * License, v. 2.0. If a copy of the MPL was not distributed with this file, michael@0: * You can obtain one at http://mozilla.org/MPL/2.0/. */ michael@0: michael@0: #ifndef mozilla_dom_gamepad_GamepadButton_h michael@0: #define mozilla_dom_gamepad_GamepadButton_h michael@0: michael@0: #include michael@0: #include "nsCOMPtr.h" michael@0: #include "nsWrapperCache.h" michael@0: michael@0: namespace mozilla { michael@0: namespace dom { michael@0: michael@0: class GamepadButton : public nsISupports, michael@0: public nsWrapperCache michael@0: { michael@0: public: michael@0: GamepadButton(nsISupports* aParent) : mParent(aParent), michael@0: mPressed(false), michael@0: mValue(0) michael@0: { michael@0: SetIsDOMBinding(); michael@0: } michael@0: michael@0: NS_DECL_CYCLE_COLLECTING_ISUPPORTS michael@0: NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_CLASS(GamepadButton) michael@0: michael@0: nsISupports* GetParentObject() const michael@0: { michael@0: return mParent; michael@0: } michael@0: michael@0: virtual JSObject* WrapObject(JSContext* aCx) MOZ_OVERRIDE; michael@0: michael@0: void SetPressed(bool aPressed) michael@0: { michael@0: mPressed = aPressed; michael@0: } michael@0: michael@0: void SetValue(double aValue) michael@0: { michael@0: mValue = aValue; michael@0: } michael@0: michael@0: bool Pressed() const michael@0: { michael@0: return mPressed; michael@0: } michael@0: michael@0: double Value() const michael@0: { michael@0: return mValue; michael@0: } michael@0: michael@0: private: michael@0: virtual ~GamepadButton() {} michael@0: michael@0: protected: michael@0: nsCOMPtr mParent; michael@0: bool mPressed; michael@0: double mValue; michael@0: }; michael@0: michael@0: } // namespace dom michael@0: } // namespace mozilla michael@0: michael@0: #endif // mozilla_dom_gamepad_GamepadButton_h