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 #ifndef mozilla_dom_DragEvent_h_
8 #define mozilla_dom_DragEvent_h_
10 #include "mozilla/dom/MouseEvent.h"
11 #include "mozilla/dom/DragEventBinding.h"
12 #include "mozilla/EventForwards.h"
14 namespace mozilla::dom
{
18 class DragEvent
: public MouseEvent
{
20 DragEvent(EventTarget
* aOwner
, nsPresContext
* aPresContext
,
21 WidgetDragEvent
* aEvent
);
23 NS_INLINE_DECL_REFCOUNTING_INHERITED(DragEvent
, MouseEvent
)
25 virtual JSObject
* WrapObjectInternal(
26 JSContext
* aCx
, JS::Handle
<JSObject
*> aGivenProto
) override
{
27 return DragEvent_Binding::Wrap(aCx
, this, aGivenProto
);
30 DragEvent
* AsDragEvent() override
{ return this; }
32 DataTransfer
* GetDataTransfer();
34 void InitDragEvent(const nsAString
& aType
, bool aCanBubble
, bool aCancelable
,
35 nsGlobalWindowInner
* aView
, int32_t aDetail
,
36 int32_t aScreenX
, int32_t aScreenY
, int32_t aClientX
,
37 int32_t aClientY
, bool aCtrlKey
, bool aAltKey
,
38 bool aShiftKey
, bool aMetaKey
, uint16_t aButton
,
39 EventTarget
* aRelatedTarget
, DataTransfer
* aDataTransfer
);
41 static already_AddRefed
<DragEvent
> Constructor(const GlobalObject
& aGlobal
,
42 const nsAString
& aType
,
43 const DragEventInit
& aParam
);
46 ~DragEvent() = default;
49 } // namespace mozilla::dom
51 already_AddRefed
<mozilla::dom::DragEvent
> NS_NewDOMDragEvent(
52 mozilla::dom::EventTarget
* aOwner
, nsPresContext
* aPresContext
,
53 mozilla::WidgetDragEvent
* aEvent
);
55 #endif // mozilla_dom_DragEvent_h_