Bug 1885602 - Part 5: Implement navigating to the SUMO help topic from the menu heade...
[gecko.git] / dom / events / CustomEvent.h
blobf046ea323e49695c3e47faa7a36df0ee41761409
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/. */
7 #ifndef CustomEvent_h__
8 #define CustomEvent_h__
10 #include "js/Value.h"
11 #include "mozilla/dom/Event.h"
13 namespace mozilla::dom {
15 struct CustomEventInit;
17 class CustomEvent final : public Event {
18 private:
19 virtual ~CustomEvent();
21 JS::Heap<JS::Value> mDetail;
23 public:
24 explicit CustomEvent(mozilla::dom::EventTarget* aOwner,
25 nsPresContext* aPresContext = nullptr,
26 mozilla::WidgetEvent* aEvent = nullptr);
28 NS_DECL_ISUPPORTS_INHERITED
29 NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_CLASS_INHERITED(CustomEvent, Event)
31 static already_AddRefed<CustomEvent> Constructor(
32 const GlobalObject& aGlobal, const nsAString& aType,
33 const CustomEventInit& aParam);
35 virtual JSObject* WrapObjectInternal(
36 JSContext* aCx, JS::Handle<JSObject*> aGivenProto) override;
38 CustomEvent* AsCustomEvent() override { return this; }
40 void GetDetail(JSContext* aCx, JS::MutableHandle<JS::Value> aRetval);
42 void InitCustomEvent(JSContext* aCx, const nsAString& aType, bool aCanBubble,
43 bool aCancelable, JS::Handle<JS::Value> aDetail);
46 } // namespace mozilla::dom
48 already_AddRefed<mozilla::dom::CustomEvent> NS_NewDOMCustomEvent(
49 mozilla::dom::EventTarget* aOwner, nsPresContext* aPresContext,
50 mozilla::WidgetEvent* aEvent);
52 #endif // CustomEvent_h__