Blender  V3.3
GHOST_DropTargetWin32.h
Go to the documentation of this file.
1 /* SPDX-License-Identifier: GPL-2.0-or-later
2  * Copyright 2001-2002 NaN Holding BV. All rights reserved. */
3 
8 #pragma once
9 
10 #include "GHOST_SystemWin32.h"
11 #include "GHOST_WindowWin32.h"
12 #include <GHOST_Types.h>
13 #include <string.h>
14 
15 class GHOST_DropTargetWin32 : public IDropTarget {
16  public:
17  /* IUnknownd implementation.
18  * Enables clients to get pointers to other interfaces on a given object
19  * through the QueryInterface method, and manage the existence of the object
20  * through the AddRef and Release methods. All other COM interfaces are
21  * inherited, directly or indirectly, from IUnknown. Therefore, the three
22  * methods in IUnknown are the first entries in the VTable for every interface.
23  */
24  HRESULT __stdcall QueryInterface(REFIID riid, void **ppvObj);
25  ULONG __stdcall AddRef(void);
26  ULONG __stdcall Release(void);
27 
28  /* IDropTarget implementation
29  * + The IDropTarget interface is one of the interfaces you implement to
30  * provide drag-and-drop operations in your application. It contains methods
31  * used in any application that can be a target for data during a
32  * drag-and-drop operation. A drop-target application is responsible for:
33  *
34  * - Determining the effect of the drop on the target application.
35  * - Incorporating any valid dropped data when the drop occurs.
36  * - Communicating target feedback to the source so the source application
37  * can provide appropriate visual feedback such as setting the cursor.
38  * - Implementing drag scrolling.
39  * - Registering and revoking its application windows as drop targets.
40  *
41  * The IDropTarget interface contains methods that handle all these
42  * responsibilities except registering and revoking the application window
43  * as a drop target, for which you must call the RegisterDragDrop and the
44  * RevokeDragDrop functions.
45  */
46 
47  HRESULT __stdcall DragEnter(IDataObject *pDataObject,
48  DWORD grfKeyState,
49  POINTL pt,
50  DWORD *pdwEffect);
51  HRESULT __stdcall DragOver(DWORD grfKeyState, POINTL pt, DWORD *pdwEffect);
52  HRESULT __stdcall DragLeave(void);
53  HRESULT __stdcall Drop(IDataObject *pDataObject, DWORD grfKeyState, POINTL pt, DWORD *pdwEffect);
54 
64 
70 
71  private:
72  /* Internal helper functions */
73 
79  DWORD allowedDropEffect(DWORD dwAllowed);
80 
86  GHOST_TDragnDropTypes getGhostType(IDataObject *pDataObject);
87 
94  void *getGhostData(IDataObject *pDataObject);
95 
101  void *getDropDataAsFilenames(IDataObject *pDataObject);
102 
108  void *getDropDataAsString(IDataObject *pDataObject);
109 
118  int WideCharToANSI(LPCWSTR in, char *&out);
119 
120  /* Private member variables */
121  /* COM reference count. */
122  LONG m_cRef;
123  /* Handle of the associated window. */
124  HWND m_hWnd;
125  /* The associated GHOST_WindowWin32. */
126  GHOST_WindowWin32 *m_window;
127  /* The System. */
128  GHOST_SystemWin32 *m_system;
129  /* Data type of the dragged object */
130  GHOST_TDragnDropTypes m_draggedObjectType;
131 
132 #ifdef WITH_CXX_GUARDEDALLOC
133  MEM_CXX_CLASS_ALLOC_FUNCS("GHOST:GHOST_DropTargetWin32")
134 #endif
135 };
GHOST_TDragnDropTypes
Definition: GHOST_Types.h:474
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)
static const pxr::TfToken out("out", pxr::TfToken::Immortal)