Blender V4.3
GHOST_DropTargetWin32.hh
Go to the documentation of this file.
1/* SPDX-FileCopyrightText: 2001-2002 NaN Holding BV. All rights reserved.
2 *
3 * SPDX-License-Identifier: GPL-2.0-or-later */
4
9#pragma once
10
11#include "GHOST_SystemWin32.hh"
12#include "GHOST_WindowWin32.hh"
13#include <GHOST_Types.h>
14#include <string.h>
15
16class GHOST_DropTargetWin32 : public IDropTarget {
17 public:
18 /* IUnknownd implementation.
19 * Enables clients to get pointers to other interfaces on a given object
20 * through the QueryInterface method, and manage the existence of the object
21 * through the AddRef and Release methods. All other COM interfaces are
22 * inherited, directly or indirectly, from IUnknown. Therefore, the three
23 * methods in IUnknown are the first entries in the VTable for every interface.
24 */
25 HRESULT __stdcall QueryInterface(REFIID riid, void **ppv_obj);
26 ULONG __stdcall AddRef();
27 ULONG __stdcall Release();
28
29 /* IDropTarget implementation
30 * + The IDropTarget interface is one of the interfaces you implement to
31 * provide drag-and-drop operations in your application. It contains methods
32 * used in any application that can be a target for data during a
33 * drag-and-drop operation. A drop-target application is responsible for:
34 *
35 * - Determining the effect of the drop on the target application.
36 * - Incorporating any valid dropped data when the drop occurs.
37 * - Communicating target feedback to the source so the source application
38 * can provide appropriate visual feedback such as setting the cursor.
39 * - Implementing drag scrolling.
40 * - Registering and revoking its application windows as drop targets.
41 *
42 * The IDropTarget interface contains methods that handle all these
43 * responsibilities except registering and revoking the application window
44 * as a drop target, for which you must call the RegisterDragDrop and the
45 * RevokeDragDrop functions.
46 */
47
48 HRESULT __stdcall DragEnter(IDataObject *p_data_object,
49 DWORD grf_key_state,
50 POINTL pt,
51 DWORD *pdw_effect);
52 HRESULT __stdcall DragOver(DWORD grf_key_state, POINTL pt, DWORD *pdw_effect);
53 HRESULT __stdcall DragLeave();
54 HRESULT __stdcall Drop(IDataObject *p_data_object,
55 DWORD grf_key_state,
56 POINTL pt,
57 DWORD *pdw_effect);
58
68
74
75 private:
76 /* Internal helper functions */
77
83 DWORD allowedDropEffect(DWORD dw_allowed);
84
90 GHOST_TDragnDropTypes getGhostType(IDataObject *p_data_object);
91
98 void *getGhostData(IDataObject *p_data_object);
99
105 void *getDropDataAsFilenames(IDataObject *p_data_object);
106
112 void *getDropDataAsString(IDataObject *p_data_object);
113
122 int WideCharToANSI(LPCWSTR in, char *&out);
123
124 /* Private member variables */
125 /* COM reference count. */
126 LONG m_cRef;
127 /* Handle of the associated window. */
128 HWND m_hWnd;
129 /* The associated GHOST_WindowWin32. */
130 GHOST_WindowWin32 *m_window;
131 /* The System. */
132 GHOST_SystemWin32 *m_system;
133 /* Data type of the dragged object */
134 GHOST_TDragnDropTypes m_draggedObjectType;
135
136#ifdef WITH_CXX_GUARDEDALLOC
137 MEM_CXX_CLASS_ALLOC_FUNCS("GHOST:GHOST_DropTargetWin32")
138#endif
139};
GHOST_TDragnDropTypes
HRESULT __stdcall QueryInterface(REFIID riid, void **ppv_obj)
HRESULT __stdcall DragEnter(IDataObject *p_data_object, DWORD grf_key_state, POINTL pt, DWORD *pdw_effect)
HRESULT __stdcall DragLeave()
HRESULT __stdcall Drop(IDataObject *p_data_object, DWORD grf_key_state, POINTL pt, DWORD *pdw_effect)
GHOST_DropTargetWin32(GHOST_WindowWin32 *window, GHOST_SystemWin32 *system)
HRESULT __stdcall DragOver(DWORD grf_key_state, POINTL pt, DWORD *pdw_effect)