/src/mozilla-central/dom/events/CustomEvent.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 |
5 | | * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ |
6 | | |
7 | | #ifndef CustomEvent_h__ |
8 | | #define CustomEvent_h__ |
9 | | |
10 | | #include "mozilla/dom/Event.h" |
11 | | |
12 | | namespace mozilla { |
13 | | namespace dom { |
14 | | |
15 | | struct CustomEventInit; |
16 | | |
17 | | class CustomEvent final : public Event |
18 | | { |
19 | | private: |
20 | | virtual ~CustomEvent(); |
21 | | |
22 | | JS::Heap<JS::Value> mDetail; |
23 | | |
24 | | public: |
25 | | explicit CustomEvent(mozilla::dom::EventTarget* aOwner, |
26 | | nsPresContext* aPresContext = nullptr, |
27 | | mozilla::WidgetEvent* aEvent = nullptr); |
28 | | |
29 | | NS_DECL_ISUPPORTS_INHERITED |
30 | | NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_CLASS_INHERITED(CustomEvent, Event) |
31 | | |
32 | | static already_AddRefed<CustomEvent> |
33 | | Constructor(const GlobalObject& aGlobal, |
34 | | const nsAString& aType, |
35 | | const CustomEventInit& aParam, |
36 | | ErrorResult& aRv); |
37 | | |
38 | | virtual JSObject* |
39 | | WrapObjectInternal(JSContext* aCx, JS::Handle<JSObject*> aGivenProto) override; |
40 | | |
41 | | CustomEvent* AsCustomEvent() override |
42 | 0 | { |
43 | 0 | return this; |
44 | 0 | } |
45 | | |
46 | | void |
47 | | GetDetail(JSContext* aCx, |
48 | | JS::MutableHandle<JS::Value> aRetval); |
49 | | |
50 | | void |
51 | | InitCustomEvent(JSContext* aCx, |
52 | | const nsAString& aType, |
53 | | bool aCanBubble, |
54 | | bool aCancelable, |
55 | | JS::Handle<JS::Value> aDetail); |
56 | | }; |
57 | | |
58 | | } // namespace dom |
59 | | } // namespace mozilla |
60 | | |
61 | | already_AddRefed<mozilla::dom::CustomEvent> |
62 | | NS_NewDOMCustomEvent(mozilla::dom::EventTarget* aOwner, |
63 | | nsPresContext* aPresContext, |
64 | | mozilla::WidgetEvent* aEvent); |
65 | | |
66 | | #endif // CustomEvent_h__ |