soui 5.0.0.1
Soui5 Doc
 
Loading...
Searching...
No Matches
shostwnd-i.h
1#ifndef __SHOSTWND_I__H__
2#define __SHOSTWND_I__H__
4#include <interface/SNcPainter-i.h>
5#include <interface/SMsgLoop-i.h>
6
7SNSBEGIN
8
9typedef struct IWindow IWindow;
10typedef struct IApplication IApplication;
11typedef struct IHostPresenter IHostPresenter;
12typedef struct IHostWnd IHostWnd;
13typedef struct _EventHandlerInfo
14{
15 FunCallback fun;
16 void *ctx;
17} EventHandlerInfo;
18
19#undef INTERFACE
20#define INTERFACE IHostWnd
21DECLARE_INTERFACE_(IHostWnd, INativeWnd)
22{
23#include "SNativeWndApi.h"
24 //////////////////////////////////////////////////////////////////////////
25
26 /**
27 * @brief 创建窗口
28 * @param hWndParent 父窗口
29 * @param dwStyle style
30 * @param dwExStyle exStyle
31 * @param x
32 * @param y
33 * @param nWidth
34 * @param nHeight
35 * @param xmlInit init xml node
36 * @return HWND
37 */
38 STDMETHOD_(HWND, CreateEx)
39 (THIS_ HWND hWndParent, DWORD dwStyle, DWORD dwExStyle, int x, int y, int nWidth, int nHeight, IXmlNode *xmlInit DEF_VAL(NULL)) PURE;
40
41 /**
42 * @brief 创建窗口
43 * @param hWndParent
44 * @param x
45 * @param y
46 * @param nWidth
47 * @param nHeight
48 * @return HWND
49 */
50 STDMETHOD_(HWND, Create)
51 (THIS_ HWND hWndParent, int x DEF_VAL(0), int y DEF_VAL(0), int nWidth DEF_VAL(0), int nHeight DEF_VAL(0)) PURE;
52
53 /**
54 * @brief 设置窗口布局资源ID
55 * @param pszLayoutId 布局资源ID
56 * @return
57 */
58 STDMETHOD_(void, SetLayoutId)(THIS_ LPCTSTR pszLayoutId) PURE;
59
60 /**
61 * @brief 从XML初始化窗口
62 * @param pNode XML数据
63 * @return TRUE-成功
64 */
65 STDMETHOD_(BOOL, InitFromXml)(THIS_ IXmlNode * pNode) PURE;
66
67 /**
68 * @brief 获取Dui Root
69 * @return Dui Root
70 */
71 STDMETHOD_(IWindow *, GetIRoot)(THIS) PURE;
72
73 /**
74 * @brief 查询窗口的半透明标志
75 * @return TRUE-窗口半透明
76 */
77 STDMETHOD_(BOOL, IsTranslucent)(CTHIS) SCONST PURE;
78
79 /**
80 * @brief 获取窗口的上屏对象
81 * @return IHostPresenter* - 上屏对象
82 */
83 STDMETHOD_(IHostPresenter *, GetPresenter)(THIS) PURE;
84
85 /**
86 * @brief 设置窗口上屏对象
87 * @param pPresenter 上屏对象
88 * @return
89 */
90 STDMETHOD_(void, SetPresenter)(THIS_ IHostPresenter * pPresenter) PURE;
91
92 /**
93 * @brief 获取窗口所属的msgloop对象
94 * @param
95 * @return
96 */
97 STDMETHOD_(IMessageLoop *, GetMsgLoop)(THIS) PURE;
98
99 /**
100 * @brief 根据ID查找子窗口
101 * @param nId int--子窗口ID
102 * @return IWindow*--匹配窗口
103 * @remark 采用广度优先算法搜索匹配子窗口
104 */
105 STDMETHOD_(IWindow *, FindIChildByID)(THIS_ int nId) PURE;
106
107 /**
108 * @brief 根据Name查找子窗口
109 * @param pszName LPCWSTR--子窗口Name
110 * @return IWindow*--匹配窗口
111 * @remark 采用广度优先算法搜索匹配子窗口
112 */
113 STDMETHOD_(IWindow *, FindIChildByName)(THIS_ LPCWSTR pszName) PURE;
114
115 /**
116 * @brief 根据Name查找子窗口
117 * @param pszName LPCSTR--子窗口Name(utf8)
118 * @return
119 */
120 STDMETHOD_(IWindow *, FindIChildByNameA)(THIS_ LPCSTR pszName) PURE;
121
122 /**
123 * @brief 获取非客户区的绘制对象
124 * @return INcPainter *
125 */
126 STDMETHOD_(INcPainter *, GetNcPainter)(THIS) PURE;
127
128 /**
129 * @brief 设置事件处理对象
130 * @param fun 事件处理对象
131 * @param ctx 事件处理对象Context
132 * @return
133 */
134 STDMETHOD_(void, SetEventHandler)(THIS_ FunCallback fun, void *ctx) PURE;
135
136 /**
137 * @brief 获取事件处理对象
138 * @return EventHandlerInfo*
139 */
140 STDMETHOD_(EventHandlerInfo *, GetEventHandler)(THIS) PURE;
141
142 /**
143 * @brief 动画显示/隐藏窗口
144 * @param dwTime
145 * @param dwFlags
146 * @return
147 * @remark 参考API AnimateWindow
148 */
149 STDMETHOD_(BOOL, AnimateHostWindow)(THIS_ DWORD dwTime, DWORD dwFlags) PURE;
150
151 /**
152 * @brief 让窗口支持DragDrop
153 * @return
154 */
155 STDMETHOD_(void, EnableDragDrop)(THIS) PURE;
156
157 /**
158 * @brief 显示或者隐藏HostWnd
159 * @param uShowCmd 和ShowWindow参数相同
160 * @param bWaitAniDone 当窗口有配置进出动画时,等待动画完成标志
161 * @return
162 */
163 STDMETHOD_(void, ShowHostWnd)(THIS_ int uShowCmd, BOOL bWaitAniDone) PURE;
164
165 /**
166 * @brief 是否启用布局中定义的私有UIDef对象
167 * @param BOOL bEnable TRUE-启动,FALSE-关闭
168 * @return void
169 * @remark 当程序中需要重新从私有UIDef中获取数据时启动,启用完后关闭
170 */
171 STDMETHOD_(void, EnablePrivateUiDef)(THIS_ BOOL bEnable) PURE;
172
173 /**
174 * @brief 设置窗口的dpi倍数
175 * @param int nScale dpi倍数,以100为基数
176 * @param LPCRECT pDestRect 缩放后的窗口坐标
177 * @return void
178 */
179 STDMETHOD_(void, SetScale)(THIS_ int nScale, LPCRECT pDestRect) PURE;
180};
181
182#undef INTERFACE
183#define INTERFACE IHostDialog
184DECLARE_INTERFACE_(IHostDialog, IHostWnd)
185{
186#include "SNativeWndApi.h"
187
188 //////////////////////////////////////////////////////////////////////////
189
190 /**
191 * @brief 创建窗口
192 * @param hWndParent 父窗口
193 * @param dwStyle style
194 * @param dwExStyle exStyle
195 * @param x
196 * @param y
197 * @param nWidth
198 * @param nHeight
199 * @param xmlInit init xml node
200 * @return HWND
201 */
202 STDMETHOD_(HWND, CreateEx)
203 (THIS_ HWND hWndParent, DWORD dwStyle, DWORD dwExStyle, int x, int y, int nWidth, int nHeight, IXmlNode *xmlInit DEF_VAL(NULL)) PURE;
204
205 /**
206 * @brief 创建窗口
207 * @param hWndParent
208 * @param x
209 * @param y
210 * @param nWidth
211 * @param nHeight
212 * @return HWND
213 */
214 STDMETHOD_(HWND, Create)
215 (THIS_ HWND hWndParent, int x DEF_VAL(0), int y DEF_VAL(0), int nWidth DEF_VAL(0), int nHeight DEF_VAL(0)) PURE;
216
217 /**
218 * @brief 设置窗口布局资源ID
219 * @param pszLayoutId 布局资源ID
220 * @return
221 */
222 STDMETHOD_(void, SetLayoutId)(THIS_ LPCTSTR pszLayoutId) PURE;
223
224 /**
225 * @brief 从XML初始化窗口
226 * @param pNode XML数据
227 * @return TRUE-成功
228 */
229 STDMETHOD_(BOOL, InitFromXml)(THIS_ IXmlNode * pNode) PURE;
230
231 /**
232 * @brief 获取Dui Root
233 * @return Dui Root
234 */
235 STDMETHOD_(IWindow *, GetIRoot)(THIS) PURE;
236
237 /**
238 * @brief 查询窗口的半透明标志
239 * @return TRUE-窗口半透明
240 */
241 STDMETHOD_(BOOL, IsTranslucent)(CTHIS) SCONST PURE;
242
243 /**
244 * @brief 获取窗口的上屏对象
245 * @return IHostPresenter* - 上屏对象
246 */
247 STDMETHOD_(IHostPresenter *, GetPresenter)(THIS) PURE;
248
249 /**
250 * @brief 设置窗口上屏对象
251 * @param pPresenter 上屏对象
252 * @return
253 */
254 STDMETHOD_(void, SetPresenter)(THIS_ IHostPresenter * pPresenter) PURE;
255
256 /**
257 * @brief 获取窗口所属的msgloop对象
258 * @param
259 * @return
260 */
261 STDMETHOD_(IMessageLoop *, GetMsgLoop)(THIS) PURE;
262
263 /**
264 * @brief 根据ID查找子窗口
265 * @param nId int--子窗口ID
266 * @return IWindow*--匹配窗口
267 * @remark 采用广度优先算法搜索匹配子窗口
268 */
269 STDMETHOD_(IWindow *, FindIChildByID)(THIS_ int nId) PURE;
270
271 /**
272 * @brief 根据Name查找子窗口
273 * @param pszName LPCWSTR--子窗口Name
274 * @return IWindow*--匹配窗口
275 * @remark 采用广度优先算法搜索匹配子窗口
276 */
277 STDMETHOD_(IWindow *, FindIChildByName)(THIS_ LPCWSTR pszName) PURE;
278
279 /**
280 * @brief 根据Name查找子窗口
281 * @param pszName LPCSTR--子窗口Name(utf8)
282 * @return
283 */
284 STDMETHOD_(IWindow *, FindIChildByNameA)(THIS_ LPCSTR pszName) PURE;
285
286 /**
287 * @brief 获取非客户区的绘制对象
288 * @return INcPainter *
289 */
290 STDMETHOD_(INcPainter *, GetNcPainter)(THIS) PURE;
291
292 /**
293 * @brief 设置事件处理对象
294 * @param fun 事件处理对象
295 * @param ctx 事件处理对象Context
296 * @return
297 */
298 STDMETHOD_(void, SetEventHandler)(THIS_ FunCallback fun, void *ctx) PURE;
299
300 /**
301 * @brief 获取事件处理对象
302 * @return EventHandlerInfo*
303 */
304 STDMETHOD_(EventHandlerInfo *, GetEventHandler)(THIS) PURE;
305
306 /**
307 * @brief 动画显示/隐藏窗口
308 * @param dwTime
309 * @param dwFlags
310 * @return
311 * @remark 参考API AnimateWindow
312 */
313 STDMETHOD_(BOOL, AnimateHostWindow)(THIS_ DWORD dwTime, DWORD dwFlags) PURE;
314
315 /**
316 * @brief 让窗口支持DragDrop
317 * @return
318 */
319 STDMETHOD_(void, EnableDragDrop)(THIS) PURE;
320
321 /**
322 * @brief 显示或者隐藏HostWnd
323 * @param uShowCmd 和ShowWindow参数相同
324 * @param bWaitAniDone 当窗口有配置进出动画时,等待动画完成标志
325 * @return
326 */
327 STDMETHOD_(void, ShowHostWnd)(THIS_ int uShowCmd, BOOL bWaitAniDone) PURE;
328
329 /**
330 * @brief 是否启用布局中定义的私有UIDef对象
331 * @param BOOL bEnable TRUE-启动,FALSE-关闭
332 * @return void
333 * @remark 当程序中需要重新从私有UIDef中获取数据时启动,启用完后关闭
334 */
335 STDMETHOD_(void, EnablePrivateUiDef)(THIS_ BOOL bEnable) PURE;
336
337 /**
338 * @brief 设置窗口的dpi倍数
339 * @param int nScale dpi倍数,以100为基数
340 * @param LPCRECT pDestRect 缩放后的窗口坐标
341 * @return void
342 */
343 STDMETHOD_(void, SetScale)(THIS_ int nScale, LPCRECT pDestRect) PURE;
344
345 //////////////////////////////////////////////////////////////////////////
346
347 /**
348 * @brief 启动一个模式窗口
349 * @param hParent 窗口的Owner
350 * @return
351 */
352 STDMETHOD_(INT_PTR, DoModal)(THIS_ HWND hParent DEF_VAL(NULL), DWORD dwStyle DEF_VAL(WS_POPUP | WS_CLIPCHILDREN), DWORD dwExStyle DEF_VAL(0)) PURE;
353
354 /**
355 * @brief 退出当前模式窗口
356 * @param nResult DoModal的返回值
357 * @return
358 */
359 STDMETHOD_(void, EndDialog)(THIS_ INT_PTR nResult) PURE;
360};
361
362SNSEND
363
364#endif // __SHOSTWND_I__H__
Interface for Native Window Operations.
Interface for message loops.
Definition SMsgLoop-i.h:42
Interface for Native Window Operations.
Interface for XML nodes.
Definition sxml-i.h:128