soui 5.0.0.1
Soui5 Doc
 
Loading...
Searching...
No Matches
SWndContainerImpl.h
Go to the documentation of this file.
1/**
2 * Copyright (C) 2014-2050
3 * All rights reserved.
4 *
5 * @file SwndContainerImpl.h
6 * @brief SOUI窗口容器的实现
7 * @version v1.0
8 * @author SOUI group
9 * @date 2014/08/02
10 *
11 * Description: This file defines the SwndContainerImpl class, which implements the ISwndContainer
12 * and ITimelineHandler interfaces for managing a container of SOUI windows.
13 */
14
15#ifndef __SWNDCONTAINERIMPL__H__
16#define __SWNDCONTAINERIMPL__H__
17
19#include <core/SFocusManager.h>
20#include <core/STimerlineHandlerMgr.h>
21
22SNSBEGIN
23
24/**
25 * @class SwndContainerImpl
26 * @brief Implementation of the SOUI window container.
27 *
28 * This class implements the ISwndContainer and ITimelineHandler interfaces to manage a container
29 * of SOUI windows. It handles drag-and-drop operations, focus management, mouse and keyboard events,
30 * and timeline handling.
31 */
32class SOUI_EXP SwndContainerImpl
33 : public ISwndContainer
34 , public ITimelineHandler {
35 public:
36 /**
37 * @brief Constructor.
38 */
40
41 /**
42 * @brief Retrieves the drop target.
43 * @return Pointer to the drop target.
44 */
45 IDropTarget *GetDropTarget()
46 {
47 return &m_dropTarget;
48 }
49
50 /**
51 * @brief Retrieves the focus manager.
52 * @return Pointer to the focus manager.
53 */
55 {
56 return &m_focusMgr;
57 }
58
59 /**
60 * @brief Sets the root window of the container.
61 * @param pRoot Pointer to the root window.
62 */
63 void SetRoot(SWindow *pRoot);
64
65 /**
66 * @brief Processes frame events.
67 * @param uMsg Message identifier.
68 * @param wParam Additional message-specific information.
69 * @param lParam Additional message-specific information.
70 * @return Result of the message processing.
71 */
72 virtual LRESULT DoFrameEvent(UINT uMsg, WPARAM wParam, LPARAM lParam);
73
74 protected:
75 // ISwndContainer
76 /**
77 * @brief Registers a drop target for a window.
78 * @param swnd Window handle.
79 * @param pDropTarget Pointer to the drop target.
80 * @return TRUE if registration is successful, FALSE otherwise.
81 */
82 STDMETHOD_(BOOL, RegisterDragDrop)(THIS_ SWND swnd, IDropTarget *pDropTarget) OVERRIDE;
83
84 /**
85 * @brief Unregisters a drop target for a window.
86 * @param swnd Window handle.
87 * @return TRUE if unregistration is successful, FALSE otherwise.
88 */
89 STDMETHOD_(BOOL, UnregisterDragDrop)(THIS_ SWND swnd) OVERRIDE;
90
91 /**
92 * @brief Releases the window capture.
93 * @return TRUE if the capture is released, FALSE otherwise.
94 */
95 STDMETHOD_(BOOL, OnReleaseSwndCapture)(THIS) OVERRIDE;
96
97 /**
98 * @brief Sets the window capture.
99 * @param swnd Window handle.
100 * @return Previous window handle that had capture.
101 */
102 STDMETHOD_(SWND, OnSetSwndCapture)(THIS_ SWND swnd) OVERRIDE;
103
104 /**
105 * @brief Sets the window focus.
106 * @param swnd Window handle.
107 */
108 STDMETHOD_(void, OnSetSwndFocus)(THIS_ SWND swnd) OVERRIDE;
109
110 /**
111 * @brief Transforms a rectangle from frame coordinates to host coordinates.
112 * @param rc Rectangle to transform.
113 */
114 STDMETHOD_(void, FrameToHost)(THIS_ RECT *rc) SCONST OVERRIDE
115 {
116 }
117
118 /**
119 * @brief Retrieves the window handle that has capture.
120 * @return Window handle with capture.
121 */
122 STDMETHOD_(SWND, OnGetSwndCapture)(THIS) SCONST OVERRIDE;
123
124 /**
125 * @brief Retrieves the window handle that has focus.
126 * @return Window handle with focus.
127 */
128 STDMETHOD_(SWND, GetFocus)(THIS) SCONST OVERRIDE;
129
130 /**
131 * @brief Retrieves the window handle that is hovered.
132 * @return Window handle that is hovered.
133 */
134 STDMETHOD_(SWND, GetHover)(THIS) SCONST OVERRIDE;
135
136 /**
137 * @brief Retrieves the accelerator manager.
138 * @return Pointer to the accelerator manager.
139 */
141 {
142 return &m_focusMgr;
143 }
144
145 /**
146 * @brief Registers a timeline handler.
147 * @param pHandler Pointer to the timeline handler.
148 * @return TRUE if registration is successful, FALSE otherwise.
149 */
150 STDMETHOD_(BOOL, RegisterTimelineHandler)(THIS_ ITimelineHandler *pHandler) OVERRIDE;
151
152 /**
153 * @brief Unregisters a timeline handler.
154 * @param pHandler Pointer to the timeline handler.
155 * @return TRUE if unregistration is successful, FALSE otherwise.
156 */
157 STDMETHOD_(BOOL, UnregisterTimelineHandler)(THIS_ ITimelineHandler *pHandler) OVERRIDE;
158
159 /**
160 * @brief Registers a window for tracking mouse events.
161 * @param swnd Window handle.
162 * @return TRUE if registration is successful, FALSE otherwise.
163 */
164 STDMETHOD_(BOOL, RegisterTrackMouseEvent)(THIS_ SWND swnd) OVERRIDE;
165
166 /**
167 * @brief Unregisters a window for tracking mouse events.
168 * @param swnd Window handle.
169 * @return TRUE if unregistration is successful, FALSE otherwise.
170 */
171 STDMETHOD_(BOOL, UnregisterTrackMouseEvent)(THIS_ SWND swnd) OVERRIDE;
172
173 /**
174 * @brief Marks the window tree's z-order as dirty.
175 */
176 STDMETHOD_(void, MarkWndTreeZorderDirty)(THIS) OVERRIDE;
177
178 /**
179 * @brief Rebuilds the window tree's z-order.
180 */
181 STDMETHOD_(void, BuildWndTreeZorder)(THIS) OVERRIDE;
182
183 /**
184 * @brief Registers a window as a video canvas.
185 * @param swnd Window handle.
186 * @return TRUE if registration is successful, FALSE otherwise.
187 */
188 STDMETHOD_(BOOL, RegisterVideoCanvas)(THIS_ SWND swnd) OVERRIDE;
189
190 /**
191 * @brief Unregisters a window as a video canvas.
192 * @param swnd Window handle.
193 * @return TRUE if unregistration is successful, FALSE otherwise.
194 */
195 STDMETHOD_(BOOL, UnregisterVideoCanvas)(THIS_ SWND swnd) OVERRIDE;
196
197 public: // ITimelineHandler
198 /**
199 * @brief Called when the next frame is ready.
200 */
201 STDMETHOD_(void, OnNextFrame)(THIS_) OVERRIDE;
202
203 protected:
204 /**
205 * @brief Handles mouse move events within the frame.
206 * @param uFlag Flags indicating the state of the mouse buttons.
207 * @param pt Current mouse position.
208 */
209 void OnFrameMouseMove(UINT uFlag, CPoint pt);
210
211 /**
212 * @brief Handles mouse leave events within the frame.
213 */
214 void OnFrameMouseLeave();
215
216 /**
217 * @brief Sets the cursor based on the mouse position.
218 * @param pt Current mouse position.
219 * @return TRUE if the cursor is set, FALSE otherwise.
220 */
221 BOOL OnFrameSetCursor(const CPoint &pt);
222
223 /**
224 * @brief Handles mouse events within the frame.
225 * @param uMsg Message identifier.
226 * @param wParam Additional message-specific information.
227 * @param lParam Additional message-specific information.
228 */
229 void OnFrameMouseEvent(UINT uMsg, WPARAM wParam, LPARAM lParam);
230
231 /**
232 * @brief Handles mouse wheel events within the frame.
233 * @param uMsg Message identifier.
234 * @param wParam Additional message-specific information.
235 * @param lParam Additional message-specific information.
236 */
237 void OnFrameMouseWheel(UINT uMsg, WPARAM wParam, LPARAM lParam);
238
239 /**
240 * @brief Handles key events within the frame.
241 * @param uMsg Message identifier.
242 * @param wParam Additional message-specific information.
243 * @param lParam Additional message-specific information.
244 * @return Result of the message processing.
245 */
246 LRESULT OnFrameKeyEvent(UINT uMsg, WPARAM wParam, LPARAM lParam);
247
248 /**
249 * @brief Handles key down events within the frame.
250 * @param nChar Virtual-key code of the key.
251 * @param nRepCnt Repeat count of the key.
252 * @param nFlags Flags indicating the state of the key.
253 */
254 void OnFrameKeyDown(UINT nChar, UINT nRepCnt, UINT nFlags);
255
256 /**
257 * @brief Handles window activation events.
258 * @param nState Activation state.
259 */
260 void OnActivate(UINT nState);
261
262 /**
263 * @brief Handles application activation events.
264 * @param bActive TRUE if the application is being activated, FALSE if deactivated.
265 * @param dwThreadID Thread identifier of the application.
266 */
267 void OnActivateApp(BOOL bActive, DWORD dwThreadID);
268
269 protected:
270 /**
271 * @brief Recursively builds the z-order of the window tree.
272 * @param pWnd Pointer to the window.
273 * @param iOrder Current z-order index.
274 */
275 void _BuildWndTreeZorder(IWindow *pWnd, UINT &iOrder);
276
277 protected:
278 SWindow *m_pRoot; /**< Root window of the container */
279 SWND m_hCapture; /**< Window handle with capture */
280 SWND m_hHover; /**< Window handle that is hovered */
281 BOOL m_bNcHover; /**< Non-client area hover flag */
282 SFocusManager m_focusMgr; /**< Focus manager */
283 SDropTargetDispatcher m_dropTarget; /**< Drop target dispatcher */
284 BOOL m_bZorderDirty; /**< Z-order dirty flag */
285 SList<SWND> m_lstTrackMouseEvtWnd; /**< List of windows tracking mouse events */
286 SList<SWND> m_lstVideoCanvas; /**< List of video canvas windows */
288 STimerlineHandlerMgr m_timelineHandlerMgr; /**< Timeline handler manager */
289};
290
291SNSEND
292#endif // __SWNDCONTAINERIMPL__H__
Drag-and-drop target dispatcher module.
Focus management module for DUI windows.
Smart pointer class for managing COM-style reference-counted objects.
Manages the dispatching of drag-and-drop targets between DUI windows.
Focus management object for DUI windows.
Manages a collection of timeline handlers.
Base class for SOUI DUI windows.
Definition SWnd.h:286
SDropTargetDispatcher m_dropTarget
STimerlineHandlerMgr m_timelineHandlerMgr
SFocusManager * GetFocusManager()
Retrieves the focus manager.
IAcceleratorMgr * GetAcceleratorMgr()
Retrieves the accelerator manager.
SList< SWND > m_lstTrackMouseEvtWnd
SFocusManager m_focusMgr
void FrameToHost(RECT *rc) SCONST OVERRIDE
Transforms a rectangle from frame coordinates to host coordinates.
SList< SWND > m_lstVideoCanvas
SwndContainerImpl()
Constructor.
SAutoRefPtr< ICaret > m_caret
IDropTarget * GetDropTarget()
Retrieves the drop target.
Interface for managing accelerator keys.
SOUI Window Container Interface.
时间轴处理接口