1 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 /* ***** BEGIN LICENSE BLOCK *****
3 * Version: MPL 1.1/GPL 2.0/LGPL 2.1
5 * The contents of this file are subject to the Mozilla Public License Version
6 * 1.1 (the "License"); you may not use this file except in compliance with
7 * the License. You may obtain a copy of the License at
8 * http://www.mozilla.org/MPL/
10 * Software distributed under the License is distributed on an "AS IS" basis,
11 * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
12 * for the specific language governing rights and limitations under the
15 * The Original Code is Mozilla Communicator client code.
17 * The Initial Developer of the Original Code is
18 * Netscape Communications Corporation.
19 * Portions created by the Initial Developer are Copyright (C) 1998
20 * the Initial Developer. All Rights Reserved.
24 * Alternatively, the contents of this file may be used under the terms of
25 * either the GNU General Public License Version 2 or later (the "GPL"), or
26 * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
27 * in which case the provisions of the GPL or the LGPL are applicable instead
28 * of those above. If you wish to allow use of your version of this file only
29 * under the terms of either the GPL or the LGPL, and not to allow others to
30 * use your version of this file under the terms of the MPL, indicate your
31 * decision by deleting the provisions above and replace them with the notice
32 * and other provisions required by the GPL or the LGPL. If you do not delete
33 * the provisions above, a recipient may use your version of this file under
34 * the terms of any one of the MPL, the GPL or the LGPL.
36 * ***** END LICENSE BLOCK ***** */
37 #ifndef _nsNativeDragTarget_h_
38 #define _nsNativeDragTarget_h_
40 #include "nsGUIEvent.h"
42 #include "nsIDragSession.h"
47 #ifndef IDropTargetHelper
48 #ifndef __MINGW32__ // MingW does not provide shobjidl.h.
49 #include <shobjidl.h> // Vista drag image interfaces
60 * nsNativeDragTarget implements the IDropTarget interface and gets most of its
61 * behavior from the associated adapter (m_dragDrop).
64 class nsNativeDragTarget
: public IDropTarget
67 nsNativeDragTarget(nsIWidget
* aWnd
);
68 ~nsNativeDragTarget();
70 // IUnknown members - see iunknown.h for documentation
71 STDMETHODIMP
QueryInterface(REFIID
, void**);
72 STDMETHODIMP_(ULONG
) AddRef();
73 STDMETHODIMP_(ULONG
) Release();
75 // IDataTarget members
77 // Set pEffect based on whether this object can support a drop based on
78 // the data available from pSource, the key and mouse states specified
79 // in grfKeyState, and the coordinates specified by point. This is
80 // called by OLE when a drag enters this object's window (as registered
82 STDMETHODIMP
DragEnter(LPDATAOBJECT pSource
, DWORD grfKeyState
,
83 POINTL point
, DWORD
* pEffect
);
85 // Similar to DragEnter except it is called frequently while the drag
86 // is over this object's window.
87 STDMETHODIMP
DragOver(DWORD grfKeyState
, POINTL point
, DWORD
* pEffect
);
89 // Release the drag-drop source and put internal state back to the point
90 // before the call to DragEnter. This is called when the drag leaves
91 // without a drop occurring.
92 STDMETHODIMP
DragLeave();
94 // If point is within our region of interest and pSource's data supports
95 // one of our formats, get the data and set pEffect according to
96 // grfKeyState (DROPEFFECT_MOVE if the control key was not pressed,
97 // DROPEFFECT_COPY if the control key was pressed). Otherwise return
99 STDMETHODIMP
Drop(LPDATAOBJECT pSource
, DWORD grfKeyState
,
100 POINTL point
, DWORD
* pEffect
);
102 PRBool mDragCancelled
;
106 void GetGeckoDragAction(LPDATAOBJECT pData
, DWORD grfKeyState
,
107 LPDWORD pdwEffect
, PRUint32
* aGeckoAction
);
108 void ProcessDrag(LPDATAOBJECT pData
, PRUint32 aEventType
, DWORD grfKeyState
,
109 POINTL pt
, DWORD
* pdwEffect
);
110 void DispatchDragDropEvent(PRUint32 aType
, POINTL pt
);
113 ULONG m_cRef
; // reference count
116 PRBool mMovePreferred
;
120 nsIDragService
* mDragService
;
122 // Drag target helper
124 IDropTargetHelper
* mDropTargetHelper
;
128 #endif // _nsNativeDragTarget_h_