Bug 1769952 - Fix running raptor on a Win10-64 VM r=sparky
[gecko.git] / dom / events / XULCommandEvent.h
blob0af98666bdb57d7e1fd4a28f25b6c59d533319ec
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::dom {
18 class XULCommandEvent : public UIEvent {
19 public:
20 XULCommandEvent(EventTarget* aOwner, nsPresContext* aPresContext,
21 WidgetInputEvent* aEvent);
23 NS_DECL_ISUPPORTS_INHERITED
24 NS_DECL_CYCLE_COLLECTION_CLASS_INHERITED(XULCommandEvent, UIEvent)
26 virtual JSObject* WrapObjectInternal(
27 JSContext* aCx, JS::Handle<JSObject*> aGivenProto) override {
28 return XULCommandEvent_Binding::Wrap(aCx, this, aGivenProto);
31 virtual XULCommandEvent* AsXULCommandEvent() override { return this; }
33 bool AltKey();
34 bool CtrlKey();
35 bool ShiftKey();
36 bool MetaKey();
37 uint16_t InputSource();
38 int16_t Button() { return mButton; }
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, int16_t aButton,
49 Event* aSourceEvent, uint16_t aInputSource,
50 ErrorResult& aRv);
52 protected:
53 ~XULCommandEvent() = default;
55 RefPtr<Event> mSourceEvent;
56 uint16_t mInputSource;
57 int16_t mButton = 0;
60 } // namespace mozilla::dom
62 already_AddRefed<mozilla::dom::XULCommandEvent> NS_NewDOMXULCommandEvent(
63 mozilla::dom::EventTarget* aOwner, nsPresContext* aPresContext,
64 mozilla::WidgetInputEvent* aEvent);
66 #endif // mozilla_dom_XULCommandEvent_h_