Bug 1686668 [wpt PR 27185] - Update wpt metadata, a=testonly
[gecko.git] / dom / events / XULCommandEvent.h
blobdcd83a6434ae35a086c22cc338ed57b23a294128
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"
16 namespace mozilla {
17 namespace dom {
19 class XULCommandEvent : public UIEvent {
20 public:
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; }
34 bool AltKey();
35 bool CtrlKey();
36 bool ShiftKey();
37 bool MetaKey();
38 uint16_t InputSource();
40 already_AddRefed<Event> GetSourceEvent() {
41 RefPtr<Event> e = mSourceEvent;
42 return e.forget();
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);
51 protected:
52 ~XULCommandEvent() = default;
54 RefPtr<Event> mSourceEvent;
55 uint16_t mInputSource;
58 } // namespace dom
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_