michael@0: /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ michael@0: /* This Source Code Form is subject to the terms of the Mozilla Public michael@0: * License, v. 2.0. If a copy of the MPL was not distributed with this michael@0: * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ michael@0: #ifndef _nsNativeDragSource_h_ michael@0: #define _nsNativeDragSource_h_ michael@0: michael@0: #include "nscore.h" michael@0: #include "nsIDOMDataTransfer.h" michael@0: #include "nsCOMPtr.h" michael@0: #include michael@0: #include michael@0: #include "mozilla/Attributes.h" michael@0: michael@0: //class nsIDragSource; michael@0: michael@0: /* michael@0: * nsNativeDragSource implements the IDropSource interface and gets michael@0: * most of its behavior from the associated adapter (m_dragDrop). michael@0: */ michael@0: class nsNativeDragSource MOZ_FINAL : public IDropSource michael@0: { michael@0: public: michael@0: michael@0: // construct an nsNativeDragSource referencing adapter michael@0: // nsNativeDragSource(nsIDragSource * adapter); michael@0: nsNativeDragSource(nsIDOMDataTransfer* aDataTransfer); michael@0: ~nsNativeDragSource(); michael@0: michael@0: // IUnknown methods - see iunknown.h for documentation michael@0: michael@0: STDMETHODIMP QueryInterface(REFIID, void**); michael@0: STDMETHODIMP_(ULONG) AddRef(); michael@0: STDMETHODIMP_(ULONG) Release(); michael@0: michael@0: // IDropSource methods - see idropsrc.h for documentation michael@0: michael@0: // Return DRAGDROP_S_USEDEFAULTCURSORS if this object lets OLE provide michael@0: // default cursors, otherwise return NOERROR. This method gets called in michael@0: // response to changes that the target makes to dEffect (DragEnter, michael@0: // DragOver). michael@0: STDMETHODIMP GiveFeedback(DWORD dEffect); michael@0: michael@0: // This method gets called if there is any change in the mouse or key michael@0: // state. Return DRAGDROP_S_CANCEL to stop the drag, DRAGDROP_S_DROP michael@0: // to execute the drop, otherwise NOERROR. michael@0: STDMETHODIMP QueryContinueDrag(BOOL fESC, DWORD grfKeyState); michael@0: michael@0: bool UserCancelled() { return mUserCancelled; } michael@0: michael@0: protected: michael@0: // Reference count michael@0: ULONG m_cRef; michael@0: michael@0: // Data object, hold information about cursor state michael@0: nsCOMPtr mDataTransfer; michael@0: michael@0: // Custom drag cursor michael@0: HCURSOR m_hCursor; michael@0: michael@0: // true if the user cancelled the drag by pressing escape michael@0: bool mUserCancelled; michael@0: }; michael@0: michael@0: #endif // _nsNativeDragSource_h_ michael@0: