Line data Source code
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 : #include "nsIDOMCustomEvent.h"
12 :
13 : namespace mozilla {
14 : namespace dom {
15 :
16 : struct CustomEventInit;
17 :
18 : class CustomEvent final : public Event,
19 : public nsIDOMCustomEvent
20 : {
21 : private:
22 : virtual ~CustomEvent();
23 :
24 : JS::Heap<JS::Value> mDetail;
25 :
26 : public:
27 : explicit CustomEvent(mozilla::dom::EventTarget* aOwner,
28 : nsPresContext* aPresContext = nullptr,
29 : mozilla::WidgetEvent* aEvent = nullptr);
30 :
31 : NS_DECL_ISUPPORTS_INHERITED
32 172 : NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_CLASS_INHERITED(CustomEvent, Event)
33 94 : NS_FORWARD_TO_EVENT
34 : NS_DECL_NSIDOMCUSTOMEVENT
35 :
36 : static already_AddRefed<CustomEvent>
37 : Constructor(const GlobalObject& aGlobal,
38 : const nsAString& aType,
39 : const CustomEventInit& aParam,
40 : ErrorResult& aRv);
41 :
42 : virtual JSObject*
43 : WrapObjectInternal(JSContext* aCx, JS::Handle<JSObject*> aGivenProto) override;
44 :
45 : void
46 : GetDetail(JSContext* aCx,
47 : JS::MutableHandle<JS::Value> aRetval);
48 :
49 : void
50 : InitCustomEvent(JSContext* aCx,
51 : const nsAString& aType,
52 : bool aCanBubble,
53 : bool aCancelable,
54 : JS::Handle<JS::Value> aDetail,
55 : ErrorResult& aRv);
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__
|