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 // This class implements a XUL "command" event. See XULCommandEvent.webidl
9 #ifndef mozilla_dom_XULCommandEvent_h_
10 #define mozilla_dom_XULCommandEvent_h_
12 #include "mozilla/RefPtr.h"
13 #include "mozilla/dom/UIEvent.h"
14 #include "mozilla/dom/XULCommandEventBinding.h"
19 class XULCommandEvent
: public UIEvent
{
21 XULCommandEvent(EventTarget
* aOwner
, nsPresContext
* aPresContext
,
22 WidgetInputEvent
* aEvent
);
24 NS_DECL_ISUPPORTS_INHERITED
25 NS_DECL_CYCLE_COLLECTION_CLASS_INHERITED(XULCommandEvent
, UIEvent
)
27 virtual JSObject
* WrapObjectInternal(
28 JSContext
* aCx
, JS::Handle
<JSObject
*> aGivenProto
) override
{
29 return XULCommandEvent_Binding::Wrap(aCx
, this, aGivenProto
);
32 virtual XULCommandEvent
* AsXULCommandEvent() override
{ return this; }
38 uint16_t InputSource();
40 already_AddRefed
<Event
> GetSourceEvent() {
41 RefPtr
<Event
> e
= mSourceEvent
;
45 void InitCommandEvent(const nsAString
& aType
, bool aCanBubble
,
46 bool aCancelable
, nsGlobalWindowInner
* aView
,
47 int32_t aDetail
, bool aCtrlKey
, bool aAltKey
,
48 bool aShiftKey
, bool aMetaKey
, Event
* aSourceEvent
,
49 uint16_t aInputSource
, ErrorResult
& aRv
);
52 ~XULCommandEvent() = default;
54 RefPtr
<Event
> mSourceEvent
;
55 uint16_t mInputSource
;
59 } // namespace mozilla
61 already_AddRefed
<mozilla::dom::XULCommandEvent
> NS_NewDOMXULCommandEvent(
62 mozilla::dom::EventTarget
* aOwner
, nsPresContext
* aPresContext
,
63 mozilla::WidgetInputEvent
* aEvent
);
65 #endif // mozilla_dom_XULCommandEvent_h_