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 #include "mozilla/dom/CommandEvent.h"
8 #include "mozilla/MiscEvents.h"
11 namespace mozilla::dom
{
13 CommandEvent::CommandEvent(EventTarget
* aOwner
, nsPresContext
* aPresContext
,
14 WidgetCommandEvent
* aEvent
)
15 : Event(aOwner
, aPresContext
, aEvent
? aEvent
: new WidgetCommandEvent()) {
17 mEventIsInternal
= false;
19 mEventIsInternal
= true;
23 void CommandEvent::GetCommand(nsAString
& aCommand
) {
24 nsAtom
* command
= mEvent
->AsCommandEvent()->mCommand
;
26 command
->ToString(aCommand
);
32 } // namespace mozilla::dom
34 using namespace mozilla
;
35 using namespace mozilla::dom
;
37 already_AddRefed
<CommandEvent
> NS_NewDOMCommandEvent(
38 EventTarget
* aOwner
, nsPresContext
* aPresContext
,
39 WidgetCommandEvent
* aEvent
) {
40 RefPtr
<CommandEvent
> it
= new CommandEvent(aOwner
, aPresContext
, aEvent
);