tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

DragEvent.h (2769B)


      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/. */
      6 
      7 #ifndef mozilla_dom_DragEvent_h_
      8 #define mozilla_dom_DragEvent_h_
      9 
     10 #include "mozilla/EventForwards.h"
     11 #include "mozilla/dom/DragEventBinding.h"
     12 #include "mozilla/dom/MouseEvent.h"
     13 
     14 namespace mozilla::dom {
     15 
     16 class DataTransfer;
     17 
     18 class DragEvent : public MouseEvent {
     19 public:
     20  DragEvent(EventTarget* aOwner, nsPresContext* aPresContext,
     21            WidgetDragEvent* aEvent);
     22 
     23  NS_INLINE_DECL_REFCOUNTING_INHERITED(DragEvent, MouseEvent)
     24 
     25  virtual JSObject* WrapObjectInternal(
     26      JSContext* aCx, JS::Handle<JSObject*> aGivenProto) override {
     27    return DragEvent_Binding::Wrap(aCx, this, aGivenProto);
     28  }
     29 
     30  DragEvent* AsDragEvent() override { return this; }
     31 
     32  DataTransfer* GetDataTransfer();
     33 
     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) {
     40    InitDragEventInternal(aType, aCanBubble, aCancelable, aView, aDetail,
     41                          aScreenX, aScreenY, aClientX, aClientY, aCtrlKey,
     42                          aAltKey, aShiftKey, aMetaKey, aButton, aRelatedTarget,
     43                          aDataTransfer);
     44  }
     45 
     46  static already_AddRefed<DragEvent> Constructor(const GlobalObject& aGlobal,
     47                                                 const nsAString& aType,
     48                                                 const DragEventInit& aParam);
     49 
     50 protected:
     51  ~DragEvent() = default;
     52 
     53  void InitDragEventInternal(const nsAString& aType, bool aCanBubble,
     54                             bool aCancelable, nsGlobalWindowInner* aView,
     55                             int32_t aDetail, double aScreenX, double aScreenY,
     56                             double aClientX, double aClientY, bool aCtrlKey,
     57                             bool aAltKey, bool aShiftKey, bool aMetaKey,
     58                             uint16_t aButton, EventTarget* aRelatedTarget,
     59                             DataTransfer* aDataTransfer);
     60 };
     61 
     62 }  // namespace mozilla::dom
     63 
     64 already_AddRefed<mozilla::dom::DragEvent> NS_NewDOMDragEvent(
     65    mozilla::dom::EventTarget* aOwner, nsPresContext* aPresContext,
     66    mozilla::WidgetDragEvent* aEvent);
     67 
     68 #endif  // mozilla_dom_DragEvent_h_