1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/widget/windows/nsNativeDragSource.h Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,66 @@ 1.4 +/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ 1.5 +/* This Source Code Form is subject to the terms of the Mozilla Public 1.6 + * License, v. 2.0. If a copy of the MPL was not distributed with this 1.7 + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ 1.8 +#ifndef _nsNativeDragSource_h_ 1.9 +#define _nsNativeDragSource_h_ 1.10 + 1.11 +#include "nscore.h" 1.12 +#include "nsIDOMDataTransfer.h" 1.13 +#include "nsCOMPtr.h" 1.14 +#include <ole2.h> 1.15 +#include <oleidl.h> 1.16 +#include "mozilla/Attributes.h" 1.17 + 1.18 +//class nsIDragSource; 1.19 + 1.20 +/* 1.21 + * nsNativeDragSource implements the IDropSource interface and gets 1.22 + * most of its behavior from the associated adapter (m_dragDrop). 1.23 + */ 1.24 +class nsNativeDragSource MOZ_FINAL : public IDropSource 1.25 +{ 1.26 +public: 1.27 + 1.28 + // construct an nsNativeDragSource referencing adapter 1.29 + // nsNativeDragSource(nsIDragSource * adapter); 1.30 + nsNativeDragSource(nsIDOMDataTransfer* aDataTransfer); 1.31 + ~nsNativeDragSource(); 1.32 + 1.33 + // IUnknown methods - see iunknown.h for documentation 1.34 + 1.35 + STDMETHODIMP QueryInterface(REFIID, void**); 1.36 + STDMETHODIMP_(ULONG) AddRef(); 1.37 + STDMETHODIMP_(ULONG) Release(); 1.38 + 1.39 + // IDropSource methods - see idropsrc.h for documentation 1.40 + 1.41 + // Return DRAGDROP_S_USEDEFAULTCURSORS if this object lets OLE provide 1.42 + // default cursors, otherwise return NOERROR. This method gets called in 1.43 + // response to changes that the target makes to dEffect (DragEnter, 1.44 + // DragOver). 1.45 + STDMETHODIMP GiveFeedback(DWORD dEffect); 1.46 + 1.47 + // This method gets called if there is any change in the mouse or key 1.48 + // state. Return DRAGDROP_S_CANCEL to stop the drag, DRAGDROP_S_DROP 1.49 + // to execute the drop, otherwise NOERROR. 1.50 + STDMETHODIMP QueryContinueDrag(BOOL fESC, DWORD grfKeyState); 1.51 + 1.52 + bool UserCancelled() { return mUserCancelled; } 1.53 + 1.54 +protected: 1.55 + // Reference count 1.56 + ULONG m_cRef; 1.57 + 1.58 + // Data object, hold information about cursor state 1.59 + nsCOMPtr<nsIDOMDataTransfer> mDataTransfer; 1.60 + 1.61 + // Custom drag cursor 1.62 + HCURSOR m_hCursor; 1.63 + 1.64 + // true if the user cancelled the drag by pressing escape 1.65 + bool mUserCancelled; 1.66 +}; 1.67 + 1.68 +#endif // _nsNativeDragSource_h_ 1.69 +