GamepadLightIndicator.h (1701B)
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/. */ 6 7 #ifndef mozilla_dom_gamepad_GamepadLightIndicator_h 8 #define mozilla_dom_gamepad_GamepadLightIndicator_h 9 10 #include "mozilla/dom/GamepadHandle.h" 11 #include "mozilla/dom/GamepadLightIndicatorBinding.h" 12 #include "nsWrapperCache.h" 13 14 namespace mozilla::dom { 15 16 class GamepadLightIndicator final : public nsISupports, public nsWrapperCache { 17 public: 18 GamepadLightIndicator(nsISupports* aParent, GamepadHandle aGamepadHandle, 19 uint32_t aIndex); 20 21 NS_DECL_CYCLE_COLLECTING_ISUPPORTS 22 NS_DECL_CYCLE_COLLECTION_WRAPPERCACHE_CLASS(GamepadLightIndicator) 23 24 static GamepadLightIndicatorType DefaultType() { 25 return GamepadLightIndicatorType::Rgb; 26 } 27 28 nsISupports* GetParentObject() const; 29 30 virtual JSObject* WrapObject(JSContext* aCx, 31 JS::Handle<JSObject*> aGivenProto) override; 32 33 already_AddRefed<Promise> SetColor(const GamepadLightColor& color, 34 ErrorResult& aRv); 35 36 void SetType(GamepadLightIndicatorType aType) { mType = aType; } 37 38 GamepadLightIndicatorType Type() const; 39 40 void Set(const GamepadLightIndicator* aOther); 41 42 private: 43 virtual ~GamepadLightIndicator(); 44 45 nsCOMPtr<nsISupports> mParent; 46 GamepadLightIndicatorType mType; 47 GamepadHandle mGamepadHandle; 48 uint32_t mIndex; 49 }; 50 51 } // namespace mozilla::dom 52 53 #endif // mozilla_dom_gamepad_GamepadLightIndicator_h