~ubuntu-branches/ubuntu/precise/kompozer/precise

« back to all changes in this revision

Viewing changes to mozilla/widget/src/windows/nsNativeDragTarget.h

  • Committer: Bazaar Package Importer
  • Author(s): Anthony Yarusso
  • Date: 2007-08-27 01:11:03 UTC
  • Revision ID: james.westby@ubuntu.com-20070827011103-2jgf4s6532gqu2ka
Tags: upstream-0.7.10
ImportĀ upstreamĀ versionĀ 0.7.10

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
 
2
/* ***** BEGIN LICENSE BLOCK *****
 
3
 * Version: NPL 1.1/GPL 2.0/LGPL 2.1
 
4
 *
 
5
 * The contents of this file are subject to the Netscape Public License
 
6
 * Version 1.1 (the "License"); you may not use this file except in
 
7
 * compliance with the License. You may obtain a copy of the License at
 
8
 * http://www.mozilla.org/NPL/
 
9
 *
 
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
 
13
 * License.
 
14
 *
 
15
 * The Original Code is Mozilla Communicator client code.
 
16
 *
 
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.
 
21
 *
 
22
 * Contributor(s):
 
23
 *
 
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 NPL, 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 NPL, the GPL or the LGPL.
 
35
 *
 
36
 * ***** END LICENSE BLOCK ***** */
 
37
#ifndef _nsNativeDragTarget_h_
 
38
#define _nsNativeDragTarget_h_
 
39
 
 
40
#include "nsGUIEvent.h"
 
41
#include "nsCOMPtr.h"
 
42
#include "nsIDragSession.h"
 
43
#include <ole2.h>
 
44
 
 
45
class nsIDragService;
 
46
class nsIWidget;
 
47
 
 
48
struct IDataObject;
 
49
 
 
50
/*
 
51
 * nsNativeDragTarget implements the IDropTarget interface and gets most of its
 
52
 * behavior from the associated adapter (m_dragDrop).
 
53
 */
 
54
 
 
55
class nsNativeDragTarget : public IDropTarget
 
56
{
 
57
        public: // construction, destruction
 
58
 
 
59
                nsNativeDragTarget(nsIWidget * aWnd);
 
60
                ~nsNativeDragTarget();
 
61
 
 
62
        public: // IUnknown members - see iunknown.h for documentation
 
63
                STDMETHODIMP         QueryInterface(REFIID, void**);
 
64
                STDMETHODIMP_(ULONG) AddRef        ();
 
65
                STDMETHODIMP_(ULONG) Release       ();
 
66
 
 
67
        public: // IDataTarget members
 
68
 
 
69
                // Set pEffect based on whether this object can support a drop based on
 
70
                // the data available from pSource, the key and mouse states specified
 
71
                // in grfKeyState, and the coordinates specified by point. This is
 
72
                // called by OLE when a drag enters this object's window (as registered
 
73
                // by Initialize).
 
74
                STDMETHODIMP DragEnter(LPDATAOBJECT pSource, DWORD grfKeyState,
 
75
                                                                                       POINTL point, DWORD* pEffect);
 
76
 
 
77
                // Similar to DragEnter except it is called frequently while the drag
 
78
                // is over this object's window.
 
79
                STDMETHODIMP DragOver(DWORD grfKeyState, POINTL point, DWORD* pEffect);
 
80
 
 
81
                // Release the drag-drop source and put internal state back to the point
 
82
                // before the call to DragEnter. This is called when the drag leaves
 
83
                // without a drop occurring.
 
84
                STDMETHODIMP DragLeave();
 
85
 
 
86
                // If point is within our region of interest and pSource's data supports
 
87
                // one of our formats, get the data and set pEffect according to
 
88
                // grfKeyState (DROPEFFECT_MOVE if the control key was not pressed,
 
89
                // DROPEFFECT_COPY if the control key was pressed). Otherwise return
 
90
                // E_FAIL.
 
91
                STDMETHODIMP Drop(LPDATAOBJECT pSource, DWORD grfKeyState,
 
92
                                                                            POINTL point, DWORD* pEffect);
 
93
 
 
94
  protected:
 
95
 
 
96
    void GetGeckoDragAction ( LPDATAOBJECT pData, DWORD grfKeyState, LPDWORD pdwEffect, PRUint32 * aGeckoAction );
 
97
    void ProcessDrag ( LPDATAOBJECT pData, PRUint32 aEventType, DWORD grfKeyState,
 
98
                                                                  POINTL pt, DWORD* pdwEffect );
 
99
    void DispatchDragDropEvent(PRUint32 aType, POINTL pt);
 
100
 
 
101
    // Native Stuff
 
102
    ULONG            m_cRef;      // reference count
 
103
    HWND             mHWnd;
 
104
    PRBool           mCanMove;
 
105
 
 
106
    // Gecko Stuff
 
107
    nsIWidget      * mWindow;
 
108
    nsIDragService * mDragService;
 
109
};
 
110
 
 
111
#endif // _nsNativeDragTarget_h_
 
112
 
 
113