/work/obj-fuzz/dist/include/mozilla/dom/GamepadButton.h
Line | Count | Source (jump to first uncovered line) |
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_GamepadButton_h |
8 | | #define mozilla_dom_gamepad_GamepadButton_h |
9 | | |
10 | | #include <stdint.h> |
11 | | #include "nsCOMPtr.h" |
12 | | #include "nsWrapperCache.h" |
13 | | |
14 | | namespace mozilla { |
15 | | namespace dom { |
16 | | |
17 | | class GamepadButton : public nsISupports, |
18 | | public nsWrapperCache |
19 | | { |
20 | | public: |
21 | | explicit GamepadButton(nsISupports* aParent) : mParent(aParent), |
22 | | mValue(0), |
23 | | mPressed(false), |
24 | | mTouched(false) |
25 | 0 | { |
26 | 0 | } |
27 | | |
28 | | NS_DECL_CYCLE_COLLECTING_ISUPPORTS |
29 | | NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_CLASS(GamepadButton) |
30 | | |
31 | | nsISupports* GetParentObject() const |
32 | 0 | { |
33 | 0 | return mParent; |
34 | 0 | } |
35 | | |
36 | | virtual JSObject* WrapObject(JSContext* aCx, JS::Handle<JSObject*> aGivenProto) override; |
37 | | |
38 | | void SetPressed(bool aPressed) |
39 | 0 | { |
40 | 0 | mPressed = aPressed; |
41 | 0 | } |
42 | | |
43 | | void SetTouched(bool aTouched) |
44 | 0 | { |
45 | 0 | mTouched = aTouched; |
46 | 0 | } |
47 | | |
48 | | void SetValue(double aValue) |
49 | 0 | { |
50 | 0 | mValue = aValue; |
51 | 0 | } |
52 | | |
53 | | bool Pressed() const |
54 | 0 | { |
55 | 0 | return mPressed; |
56 | 0 | } |
57 | | |
58 | | bool Touched() const |
59 | 0 | { |
60 | 0 | return mTouched; |
61 | 0 | } |
62 | | |
63 | | double Value() const |
64 | 0 | { |
65 | 0 | return mValue; |
66 | 0 | } |
67 | | |
68 | | private: |
69 | 0 | virtual ~GamepadButton() {} |
70 | | |
71 | | protected: |
72 | | nsCOMPtr<nsISupports> mParent; |
73 | | double mValue; |
74 | | bool mPressed; |
75 | | bool mTouched; |
76 | | }; |
77 | | |
78 | | } // namespace dom |
79 | | } // namespace mozilla |
80 | | |
81 | | #endif // mozilla_dom_gamepad_GamepadButton_h |