soui 5.0.0.1
Soui5 Doc
 
Loading...
Searching...
No Matches
SDropTargetDispatcher.h
Go to the documentation of this file.
1/**
2 * Copyright (C) 2014-2050
3 * All rights reserved.
4 *
5 * @file SDropTargetDispatcher.h
6 * @brief Drag-and-drop target dispatcher module
7 * @version v1.0
8 * @author SOUI group
9 * @date 2014/08/02
10 *
11 * @details Manages the dispatching of drag-and-drop targets between DUI windows.
12 */
13
14#ifndef __SDROPTARGETDISPATCHER__H__
15#define __SDROPTARGETDISPATCHER__H__
16
17#include <windows.h>
18#include <souicoll.h>
19#include <core/SWnd.h>
20
21SNSBEGIN
22
23/**
24 * @class SDropTargetDispatcher
25 * @brief Manages the dispatching of drag-and-drop targets between DUI windows.
26 *
27 * @details This class handles the registration and dispatching of drag-and-drop targets
28 * for DUI windows. It implements the `IDropTarget` interface to manage drag-and-drop
29 * operations and routes them to the appropriate window.
30 */
31class SDropTargetDispatcher : public IDropTarget {
32 public:
33 /**
34 * @brief Constructor
35 *
36 * @details Initializes the drop target dispatcher.
37 */
39
40 /**
41 * @brief Destructor
42 *
43 * @details Cleans up the drop target dispatcher.
44 */
46
47 /**
48 * @brief Sets the owner window
49 * @param pOwner Pointer to the owner window
50 *
51 * @details Sets the owner window for the drop target dispatcher.
52 */
53 void SetOwner(SWindow *pOwner);
54
55 /**
56 * @brief Registers a drag-and-drop target for a window
57 * @param swnd Handle to the window
58 * @param pDropTarget Pointer to the drop target
59 * @return TRUE if successful, otherwise FALSE
60 *
61 * @details Registers a drag-and-drop target for the specified window.
62 */
63 BOOL RegisterDragDrop(SWND swnd, IDropTarget *pDropTarget);
64
65 /**
66 * @brief Unregisters a drag-and-drop target for a window
67 * @param swnd Handle to the window
68 * @return TRUE if successful, otherwise FALSE
69 *
70 * @details Unregisters the drag-and-drop target for the specified window.
71 */
72 BOOL UnregisterDragDrop(SWND swnd);
73
74 //////////////////////////////////////////////////////////////////////////
75 // IUnknown
76
77 /**
78 * @brief Queries for a specific interface
79 * @param riid Interface identifier
80 * @param ppvObject Pointer to the interface pointer
81 * @return HRESULT indicating success or failure
82 *
83 * @details Queries for the specified interface and returns a pointer to it.
84 */
85 STDMETHOD_(HRESULT, QueryInterface)
86 (
87 /* [in] */ REFIID riid,
88 /* [iid_is][out] */ void **ppvObject);
89
90 /**
91 * @brief Increments the reference count
92 * @return New reference count
93 *
94 * @details Increments the reference count of the object. Always returns 1.
95 */
96 STDMETHOD_(ULONG, AddRef)(void)
97 {
98 return 1;
99 }
100
101 /**
102 * @brief Decrements the reference count
103 * @return New reference count
104 *
105 * @details Decrements the reference count of the object. Always returns 1.
106 */
107 STDMETHOD_(ULONG, Release)(void)
108 {
109 return 1;
110 }
111
112 //////////////////////////////////////////////////////////////////////////
113 // IDropTarget
114
115 /**
116 * @brief Handles the DragEnter event
117 * @param pDataObj Pointer to the data object
118 * @param grfKeyState State of the keyboard and mouse
119 * @param pt Mouse position
120 * @param pdwEffect Pointer to the drag effect
121 * @return HRESULT indicating success or failure
122 *
123 * @details Handles the DragEnter event and routes it to the appropriate window.
124 */
125 STDMETHOD_(HRESULT, DragEnter)
126 (
127 /* [unique][in] */ IDataObject *pDataObj,
128 /* [in] */ DWORD grfKeyState,
129 /* [in] */ POINTL pt,
130 /* [out][in] */ DWORD *pdwEffect);
131
132 /**
133 * @brief Handles the DragOver event
134 * @param grfKeyState State of the keyboard and mouse
135 * @param pt Mouse position
136 * @param pdwEffect Pointer to the drag effect
137 * @return HRESULT indicating success or failure
138 *
139 * @details Handles the DragOver event and routes it to the appropriate window.
140 */
141 STDMETHOD_(HRESULT, DragOver)
142 (
143 /* [in] */ DWORD grfKeyState,
144 /* [in] */ POINTL pt,
145 /* [out][in] */ DWORD *pdwEffect);
146
147 /**
148 * @brief Handles the DragLeave event
149 * @return HRESULT indicating success or failure
150 *
151 * @details Handles the DragLeave event and routes it to the appropriate window.
152 */
153 STDMETHOD_(HRESULT, DragLeave)(void);
154
155 /**
156 * @brief Handles the Drop event
157 * @param pDataObj Pointer to the data object
158 * @param grfKeyState State of the keyboard and mouse
159 * @param pt Mouse position
160 * @param pdwEffect Pointer to the drag effect
161 * @return HRESULT indicating success or failure
162 *
163 * @details Handles the Drop event and routes it to the appropriate window.
164 */
165 STDMETHOD_(HRESULT, Drop)
166 (
167 /* [unique][in] */ IDataObject *pDataObj,
168 /* [in] */ DWORD grfKeyState,
169 /* [in] */ POINTL pt,
170 /* [out][in] */ DWORD *pdwEffect);
171
172 protected:
173 /**
174 * @brief Converts POINTL to frame client coordinates
175 * @param pt POINTL structure
176 * @return Converted POINT structure in frame client coordinates
177 *
178 * @details Converts the POINTL structure to frame client coordinates.
179 */
180 POINT PointL2FrameClient(const POINTL &pt);
181
182 typedef SMap<SWND, IDropTarget *> DTMAP; /**< Map type for storing drop targets. */
183 DTMAP m_mapDropTarget; /**< Map of drop targets associated with windows. */
184 IDataObject *m_pDataObj; /**< Pointer to the data object. */
185 SWND m_hHover; /**< Handle to the window currently being hovered over. */
186 SWindow *m_pOwner; /**< Pointer to the owner window. */
187};
188
189SNSEND
190
191#endif // __SDROPTARGETDISPATCHER__H__
SOUI基础DUI窗口模块
ULONG Release(void)
Decrements the reference count.
HRESULT DragOver(DWORD grfKeyState, POINTL pt, DWORD *pdwEffect)
Handles the DragOver event.
HRESULT Drop(IDataObject *pDataObj, DWORD grfKeyState, POINTL pt, DWORD *pdwEffect)
Handles the Drop event.
HRESULT DragEnter(IDataObject *pDataObj, DWORD grfKeyState, POINTL pt, DWORD *pdwEffect)
Handles the DragEnter event.
~SDropTargetDispatcher(void)
Destructor.
POINT PointL2FrameClient(const POINTL &pt)
Converts POINTL to frame client coordinates.
HRESULT QueryInterface(REFIID riid, void **ppvObject)
Queries for a specific interface.
BOOL RegisterDragDrop(SWND swnd, IDropTarget *pDropTarget)
Registers a drag-and-drop target for a window.
void SetOwner(SWindow *pOwner)
Sets the owner window.
SMap< SWND, IDropTarget * > DTMAP
BOOL UnregisterDragDrop(SWND swnd)
Unregisters a drag-and-drop target for a window.
HRESULT DragLeave(void)
Handles the DragLeave event.
ULONG AddRef(void)
Increments the reference count.
Base class for SOUI DUI windows.
Definition SWnd.h:286