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()) {
16 mEvent
->mTime
= PR_Now();
18 mEventIsInternal
= false;
20 mEventIsInternal
= true;
24 void CommandEvent::GetCommand(nsAString
& aCommand
) {
25 nsAtom
* command
= mEvent
->AsCommandEvent()->mCommand
;
27 command
->ToString(aCommand
);
33 } // namespace mozilla::dom
35 using namespace mozilla
;
36 using namespace mozilla::dom
;
38 already_AddRefed
<CommandEvent
> NS_NewDOMCommandEvent(
39 EventTarget
* aOwner
, nsPresContext
* aPresContext
,
40 WidgetCommandEvent
* aEvent
) {
41 RefPtr
<CommandEvent
> it
= new CommandEvent(aOwner
, aPresContext
, aEvent
);