Blender  V2.93
GHOST_DropTargetWin32.h
Go to the documentation of this file.
1 /*
2  * This program is free software; you can redistribute it and/or
3  * modify it under the terms of the GNU General Public License
4  * as published by the Free Software Foundation; either version 2
5  * of the License, or (at your option) any later version.
6  *
7  * This program is distributed in the hope that it will be useful,
8  * but WITHOUT ANY WARRANTY; without even the implied warranty of
9  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10  * GNU General Public License for more details.
11  *
12  * You should have received a copy of the GNU General Public License
13  * along with this program; if not, write to the Free Software Foundation,
14  * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
15  *
16  * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
17  * All rights reserved.
18  */
19 
24 #pragma once
25 
26 #include "GHOST_SystemWin32.h"
27 #include "GHOST_WindowWin32.h"
28 #include <GHOST_Types.h>
29 #include <string.h>
30 
31 class GHOST_DropTargetWin32 : public IDropTarget {
32  public:
33  /* IUnknownd implementation.
34  * Enables clients to get pointers to other interfaces on a given object
35  * through the QueryInterface method, and manage the existence of the object
36  * through the AddRef and Release methods. All other COM interfaces are
37  * inherited, directly or indirectly, from IUnknown. Therefore, the three
38  * methods in IUnknown are the first entries in the VTable for every interface.
39  */
40  HRESULT __stdcall QueryInterface(REFIID riid, void **ppvObj);
41  ULONG __stdcall AddRef(void);
42  ULONG __stdcall Release(void);
43 
44  /* IDropTarget implementation
45  * + The IDropTarget interface is one of the interfaces you implement to
46  * provide drag-and-drop operations in your application. It contains methods
47  * used in any application that can be a target for data during a
48  * drag-and-drop operation. A drop-target application is responsible for:
49  *
50  * - Determining the effect of the drop on the target application.
51  * - Incorporating any valid dropped data when the drop occurs.
52  * - Communicating target feedback to the source so the source application
53  * can provide appropriate visual feedback such as setting the cursor.
54  * - Implementing drag scrolling.
55  * - Registering and revoking its application windows as drop targets.
56  *
57  * The IDropTarget interface contains methods that handle all these
58  * responsibilities except registering and revoking the application window
59  * as a drop target, for which you must call the RegisterDragDrop and the
60  * RevokeDragDrop functions.
61  */
62 
63  HRESULT __stdcall DragEnter(IDataObject *pDataObject,
64  DWORD grfKeyState,
65  POINTL pt,
66  DWORD *pdwEffect);
67  HRESULT __stdcall DragOver(DWORD grfKeyState, POINTL pt, DWORD *pdwEffect);
68  HRESULT __stdcall DragLeave(void);
69  HRESULT __stdcall Drop(IDataObject *pDataObject, DWORD grfKeyState, POINTL pt, DWORD *pdwEffect);
70 
80 
86 
87  private:
88  /* Internal helper functions */
89 
95  DWORD allowedDropEffect(DWORD dwAllowed);
96 
102  GHOST_TDragnDropTypes getGhostType(IDataObject *pDataObject);
103 
110  void *getGhostData(IDataObject *pDataObject);
111 
117  void *getDropDataAsFilenames(IDataObject *pDataObject);
118 
124  void *getDropDataAsString(IDataObject *pDataObject);
125 
134  int WideCharToANSI(LPCWSTR in, char *&out);
135 
136  /* Private member variables */
137  /* COM reference count. */
138  LONG m_cRef;
139  /* Handle of the associated window. */
140  HWND m_hWnd;
141  /* The associated GHOST_WindowWin32. */
142  GHOST_WindowWin32 *m_window;
143  /* The System. */
144  GHOST_SystemWin32 *m_system;
145  /* Data type of the dragged object */
146  GHOST_TDragnDropTypes m_draggedObjectType;
147 
148 #ifdef WITH_CXX_GUARDEDALLOC
149  MEM_CXX_CLASS_ALLOC_FUNCS("GHOST:GHOST_DropTargetWin32")
150 #endif
151 };
GHOST_TDragnDropTypes
Definition: GHOST_Types.h:477
HRESULT __stdcall DragLeave(void)
HRESULT __stdcall QueryInterface(REFIID riid, void **ppvObj)
HRESULT __stdcall DragEnter(IDataObject *pDataObject, DWORD grfKeyState, POINTL pt, DWORD *pdwEffect)
HRESULT __stdcall DragOver(DWORD grfKeyState, POINTL pt, DWORD *pdwEffect)
GHOST_DropTargetWin32(GHOST_WindowWin32 *window, GHOST_SystemWin32 *system)
ULONG __stdcall AddRef(void)
ULONG __stdcall Release(void)
HRESULT __stdcall Drop(IDataObject *pDataObject, DWORD grfKeyState, POINTL pt, DWORD *pdwEffect)