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_GamepadLightIndicator_h
8 #define mozilla_dom_gamepad_GamepadLightIndicator_h
10 #include "mozilla/dom/GamepadLightIndicatorBinding.h"
11 #include "mozilla/dom/GamepadHandle.h"
12 #include "nsWrapperCache.h"
14 namespace mozilla::dom
{
16 class GamepadLightIndicator final
: public nsISupports
, public nsWrapperCache
{
18 GamepadLightIndicator(nsISupports
* aParent
, GamepadHandle aGamepadHandle
,
21 NS_DECL_CYCLE_COLLECTING_ISUPPORTS
22 NS_DECL_CYCLE_COLLECTION_WRAPPERCACHE_CLASS(GamepadLightIndicator
)
24 static GamepadLightIndicatorType
DefaultType() {
25 return GamepadLightIndicatorType::Rgb
;
28 nsISupports
* GetParentObject() const;
30 virtual JSObject
* WrapObject(JSContext
* aCx
,
31 JS::Handle
<JSObject
*> aGivenProto
) override
;
33 already_AddRefed
<Promise
> SetColor(const GamepadLightColor
& color
,
36 void SetType(GamepadLightIndicatorType aType
) { mType
= aType
; }
38 GamepadLightIndicatorType
Type() const;
40 void Set(const GamepadLightIndicator
* aOther
);
43 virtual ~GamepadLightIndicator();
45 nsCOMPtr
<nsISupports
> mParent
;
46 GamepadLightIndicatorType mType
;
47 GamepadHandle mGamepadHandle
;
51 } // namespace mozilla::dom
53 #endif // mozilla_dom_gamepad_GamepadLightIndicator_h