soui 5.0.0.1
Soui5 Doc
 
Loading...
Searching...
No Matches
sapp-i.h
1#ifndef __SAPP_I__H__
2#define __SAPP_I__H__
3#include <interface/obj-ref-i.h>
5#include <interface/STranslator-i.h>
7#include <interface/slog-i.h>
8#include <interface/SAttrStorage-i.h>
9#include <interface/SMsgLoop-i.h>
10#include <interface/shostwnd-i.h>
11#include <interface/SResProviderMgr-i.h>
13#include <interface/SRender-i.h>
15#include <interface/SAnimation-i.h>
16#include <interface/SValueAnimator-i.h>
17#include <interface/SNotifyCenter-i.h>
18#include <interface/SObjFactory-i.h>
19#include <interface/SHostPresenter-i.h>
20#include <interface/STaskLoop-i.h>
21
22SNSBEGIN
23
24typedef enum _SingletonType
25{
26 SINGLETON_UIDEF = 0,
27 SINGLETON_SWNDMGR,
28 SINGLETON_TIMERGENERATOR,
29 SINGLETON_WINDOWFINDER,
30 SINGLETON_RICHEDITMENUDEF,
31 SINGLETON_HOSTMGR,
32 SINGLETON_NOTIFYCENTER,
33
34 SINGLETON_COUNT,
35} SingletonType;
36
37typedef struct IApplication IApplication;
38typedef IObject *(*FunCreateObject)(const IApplication *app, LPCWSTR pszName, SObjectType nType);
39typedef ITaskLoop *(*FunCrateTaskLoop)();
40
41#undef INTERFACE
42#define INTERFACE IApplication
43DECLARE_INTERFACE_(IApplication, IObjRef)
44{
45 /**
46 * @brief 添加引用
47 * @return long -- 引用计数
48 */
49 STDMETHOD_(long, AddRef)(THIS) PURE;
50
51 /**
52 * @brief 释放引用
53 * @return long -- 引用计数
54 */
55 STDMETHOD_(long, Release)(THIS) PURE;
56
57 /**
58 * @brief 释放对象
59 * @return void
60 */
61 STDMETHOD_(void, OnFinalRelease)(THIS) PURE;
62
63 //////////////////////////////////////////////////////////////////////////
64
65 /**
66 * @brief 获取当前app的hModule
67 * @return HMODULE -- 当前app的hModule
68 */
69 STDMETHOD_(HMODULE, GetModule)(CTHIS) SCONST PURE;
70
71 /**
72 * @brief 从指定的ResProvider里加载系统资源
73 * @param pResProvider IResProvider* -- 提供系统资源的资源包
74 * @return UINT -- 0: 成功, 其它: 失败
75 */
76 STDMETHOD_(UINT, LoadSystemNamedResource)(THIS_ IResProvider * pResProvider) PURE;
77
78 /**
79 * @brief 获取翻译接口
80 * @return ITranslatorMgr* -- 翻译接口
81 */
82 STDMETHOD_(ITranslatorMgr *, GetTranslator)(THIS) PURE;
83
84 /**
85 * @brief 设置翻译接口
86 * @param pTrans ITranslatorMgr* -- 翻译接口
87 * @return void
88 */
89 STDMETHOD_(void, SetTranslator)(THIS_ ITranslatorMgr * pTrans) PURE;
90
91 /**
92 * @brief 获取ToolTip类厂
93 * @return IToolTipFactory* -- ToolTip类厂
94 */
95 STDMETHOD_(IToolTipFactory *, GetToolTipFactory)(THIS) PURE;
96
97 /**
98 * @brief 设置ToolTip类厂
99 * @param pToolTipFac IToolTipFactory* -- ToolTip类厂
100 * @return void
101 */
102 STDMETHOD_(void, SetToolTipFactory)(THIS_ IToolTipFactory * pToolTipFac) PURE;
103
104 /**
105 * @brief 设置MsgLoop类厂
106 * @param pMsgLoopFac IMsgLoopFactory* -- MsgLoop类厂
107 * @return BOOL -- TRUE: 成功
108 */
109 STDMETHOD_(BOOL, SetMsgLoopFactory)(THIS_ IMsgLoopFactory * pMsgLoopFac) PURE;
110
111 /**
112 * @brief 获取当前的MsgLoop类厂
113 * @return IMsgLoopFactory* -- MsgLoop类厂
114 */
115 STDMETHOD_(IMsgLoopFactory *, GetMsgLoopFactory)(THIS) PURE;
116
117 /**
118 * @brief 设置日志输出模块
119 * @param pLogMgr ILogMgr* -- 日志输出模块
120 * @return void
121 */
122 STDMETHOD_(void, SetLogManager)(THIS_ ILogMgr * pLogMgr) PURE;
123
124 /**
125 * @brief 获取日志输出模块
126 * @return ILogMgr* -- 日志输出模块
127 */
128 STDMETHOD_(ILogMgr *, GetLogManager)(THIS) PURE;
129
130 /**
131 * @brief 设置属性持久化类厂
132 * @param pAttrStorageFactory IAttrStorageFactory* -- 属性持久化类厂
133 * @return void
134 */
135 STDMETHOD_(void, SetAttrStorageFactory)(THIS_ IAttrStorageFactory * pAttrStorageFactory) PURE;
136
137 /**
138 * @brief 获取属性持久化类厂
139 * @return IAttrStorageFactory* -- 属性持久化类厂
140 */
141 STDMETHOD_(IAttrStorageFactory *, GetAttrStorageFactory)(THIS) PURE;
142
143 /**
144 * @brief 进入消息循环运行程序
145 * @param hMainWnd HWND -- 主窗口句柄
146 * @return int -- 程序退出的返回值
147 */
148 STDMETHOD_(int, Run)(THIS_ HWND hMainWnd) PURE;
149
150 /**
151 * @brief 退出消息循环
152 * @param nCode int -- 线程退出代码
153 * @return void
154 */
155 STDMETHOD_(void, Quit)(THIS_ int nCode) PURE;
156
157 /**
158 * @brief 获取程序主窗口
159 * @return HWND -- 在Run方法中设定的窗口
160 */
161 STDMETHOD_(HWND, GetMainWnd)(THIS) PURE;
162
163 /**
164 * @brief 将当前UI线程的msgLoop保存到SApp中
165 * @param pMsgLoop IMessageLoop* -- msgLoop
166 * @param bReplace BOOL -- 替换标志
167 * @return BOOL -- TRUE: 成功
168 */
169 STDMETHOD_(BOOL, AddMsgLoop)(THIS_ IMessageLoop * pMsgLoop, BOOL bReplace DEF_VAL(FALSE)) PURE;
170
171 /**
172 * @brief 从SApp中删除当前线程的msgLoop
173 * @return BOOL -- TRUE: 成功
174 */
175 STDMETHOD_(BOOL, RemoveMsgLoop)(THIS) PURE;
176
177 /**
178 * @brief 获取指定UI线程的msgLoop
179 * @param tid -- 线程ID
180 * @return IMessageLoop* -- 指定线程的msgLoop
181 */
182 STDMETHOD_(IMessageLoop *, GetMsgLoop)(CTHIS_ tid_t dwThreadID DEF_VAL(GetCurrentThreadId())) SCONST PURE;
183
184 /**
185 * @brief 获取IResProviderMgr接口
186 * @return IResProviderMgr* -- IResProviderMgr接口
187 */
188 STDMETHOD_(IResProviderMgr *, GetResProviderMgr)(THIS) PURE;
189
190 /**
191 * @brief 获取RealWndHandler
192 * @return IRealWndHandler* -- RealWndHandler
193 */
194 STDMETHOD_(IRealWndHandler *, GetRealWndHander)(THIS) PURE;
195
196 /**
197 * @brief 设置RealWnd处理接口
198 * @param pRealHandler IRealWndHandler* -- RealWnd处理接口
199 * @return void
200 */
201 STDMETHOD_(void, SetRealWndHandler)(THIS_ IRealWndHandler * pRealHandler) PURE;
202
203 /**
204 * @brief 获取当前的渲染模块
205 * @return IRenderFactory* -- 渲染模块指针
206 */
207 STDMETHOD_(IRenderFactory *, GetRenderFactory)(THIS) PURE;
208
209 /**
210 * @brief 设置渲染模块
211 * @param renderFac IRenderFactory* -- 渲染模块指针
212 * @return BOOL -- TRUE: 成功
213 */
214 STDMETHOD_(BOOL, SetRenderFactory)(THIS_ IRenderFactory * renderFac) PURE;
215
216 /**
217 * @brief 设置SOUI中使用的脚本模块类厂
218 * @param pScriptModule IScriptFactory* -- 脚本模块类厂
219 * @return void
220 */
221 STDMETHOD_(void, SetScriptFactory)(THIS_ IScriptFactory * pScriptModule) PURE;
222
223 /**
224 * @brief 初始化XML资源的name-id映射表
225 * @param pNames const LPCWSTR* -- 控件名表
226 * @param nIds const int* -- 控件ID表
227 * @param nCount int -- 控件数量
228 * @return void
229 */
230 STDMETHOD_(void, InitXmlNamedID)(THIS_ const LPCWSTR *pNames, const int *nIds, int nCount) PURE;
231
232 /**
233 * @brief 从资源ID加载XML
234 * @param strResId LPCTSTR -- 资源ID,为type:name格式
235 * @return IXmlDoc* -- XML Doc
236 */
237 STDMETHOD_(IXmlDoc *, LoadXmlDocment)(THIS_ LPCTSTR strResId) PURE;
238 STDMETHOD_(IXmlDoc *, LoadXmlDocmentU8)(THIS_ LPCSTR strResId) PURE;
239
240 /**
241 * @brief 从资源加载动画资源
242 * @param strResId LPCTSTR -- 动画资源ID
243 * @return IAnimation* -- 动画对象
244 */
245 STDMETHOD_(IAnimation *, LoadAnimation)(THIS_ LPCTSTR strResId) PURE;
246 STDMETHOD_(IAnimation *, LoadAnimationU8)(THIS_ LPCSTR strResId) PURE;
247
248 /**
249 * @brief 从资源加载数值动画资源
250 * @param strResId LPCTSTR -- 动画资源ID
251 * @return IValueAnimator* -- 数值动画对象
252 */
253 STDMETHOD_(IValueAnimator *, LoadValueAnimator)(THIS_ LPCTSTR strResId) PURE;
254 STDMETHOD_(IValueAnimator *, LoadValueAnimatorU8)(THIS_ LPCSTR strResId) PURE;
255
256 /**
257 * @brief 从资源加载图片
258 * @param strResId LPCTSTR -- 图片资源ID
259 * @return IBitmapS* -- 图片对象
260 */
261 STDMETHOD_(IBitmapS *, LoadImage)(THIS_ LPCTSTR strResId) PURE;
262 STDMETHOD_(IBitmapS *, LoadImageU8)(THIS_ LPCSTR strResId) PURE;
263
264 /**
265 * @brief 从资源加载翻译包
266 * @param strResId LPCTSTR -- 翻译包资源ID
267 * @return ITranslator* -- 翻译包对象
268 */
269 STDMETHOD_(ITranslator *, LoadTranslator)(THIS_ LPCTSTR strResId) PURE;
270 STDMETHOD_(ITranslator *, LoadTranslatorU8)(THIS_ LPCSTR strResId) PURE;
271
272 /**
273 * @brief 使用翻译包
274 * @param trModule ITranslator* -- 翻译包
275 * @return BOOL -- TRUE: 成功
276 */
277 STDMETHOD_(BOOL, InstallTranslator)(THIS_ ITranslator * trModule) PURE;
278
279 /**
280 * @brief 卸载翻译包
281 * @param langId REFGUID -- 翻译包ID
282 * @return BOOL -- TRUE: 成功
283 */
284 STDMETHOD_(BOOL, UnnstallTranslator)(THIS_ REFGUID langId) PURE;
285
286 /**
287 * @brief 启用NotifyCenter
288 * @param bEnable BOOL -- 是否启用
289 * @param interval int -- 处理事件时间间隔
290 * @return void
291 */
292 STDMETHOD_(void, EnableNotifyCenter)(THIS_ BOOL bEnable, int interval DEF_VAL(20)) PURE;
293
294 /**
295 * @brief 获取SApp内部定义的几个单例对象
296 * @param type SingletonType -- 内部单例类型
297 * @return void* -- 单例类型指针
298 */
299 STDMETHOD_(void *, GetInnerSingleton)(THIS_ SingletonType type) PURE;
300
301 /**
302 * @brief 创建对象
303 * @param pszName LPCWSTR -- 类型在XML中的名字
304 * @param nType SObjectType -- 类型ID
305 * @return IObject* -- 创建的类型
306 */
307 STDMETHOD_(IObject *, CreateObject)(CTHIS_ LPCWSTR pszName, SObjectType nType) SCONST PURE;
308
309 /**
310 * @brief 设置CreateObject的回调
311 * @param cbCreateObj FunCreateObject -- CreateObject的回调函数
312 * @return void
313 */
314 STDMETHOD_(void, SetCreateObjectCallback)(THIS_ FunCreateObject cbCreateObj) PURE;
315
316 /**
317 * @brief 注册扩展对象
318 * @param objFac const IObjectFactory* -- 对象类厂
319 * @param bReplace BOOL -- 替换已有类厂标志
320 * @return BOOL -- TRUE: 成功
321 */
322 STDMETHOD_(BOOL, RegisterObjFactory)(THIS_ const IObjectFactory *objFac, BOOL bReplace DEF_VAL(FALSE)) PURE;
323
324 /**
325 * @brief 反注册扩展对象
326 * @param objFac const IObjectFactory* -- 对象类厂
327 * @return BOOL -- TRUE: 成功
328 */
329 STDMETHOD_(BOOL, UnregisterObjFactory)(THIS_ const IObjectFactory *objFac) PURE;
330
331 /**
332 * @brief 设置默认字体
333 * @param pszFontInfo LPCWSTR -- 字体描述,参考fontpool
334 * @return void
335 */
336 STDMETHOD_(void, SetDefaultFontInfo)(THIS_ LPCWSTR pszFontInfo) PURE;
337
338 /**
339 * @brief 创建TaskLoop对象
340 * @param nCount int -- taskloop对象数量
341 * @param priority Priority -- taskloop的线程优先级
342 * @param bAutoStart BOOL -- 自动启动标志
343 * @return BOOL -- TRUE: 成功
344 */
345 STDMETHOD_(BOOL, CreateTaskLoop)(THIS_ int nCount, Priority priority, BOOL bAutoStart DEF_VAL(TRUE)) PURE;
346
347 /**
348 * @brief 获取TaskLoop对象
349 * @param iTaskLoop int -- taskloop索引
350 * @return ITaskLoop* -- taskloop接口,失败返回NULL
351 */
352 STDMETHOD_(ITaskLoop *, GetTaskLoop)(THIS_ int iTaskLoop DEF_VAL(0)) PURE;
353
354 /**
355 * @brief 设置创建TaskLoop对象的回调接口
356 * @param cbCreateTaskLoop FunCrateTaskLoop -- 创建TaskLoop对象的回调接口
357 * @return void
358 */
359 STDMETHOD_(void, SetCreateTaskLoopCallback)(THIS_ FunCrateTaskLoop cbCreateTaskLoop) PURE;
360
361 /**
362 * @brief 创建脚本模块对象
363 * @param ppScriptModule IScriptModule** -- 脚本模块对象
364 * @return HRESULT -- S_OK: 创建成功
365 */
366 STDMETHOD_(HRESULT, CreateScriptModule)(THIS_ IScriptModule * *ppScriptModule) PURE;
367
368 /**
369 * @brief 设置编辑上下文菜单模板资源ID
370 * @param resId LPCTSTR -- 资源ID
371 * @param pResProvider IResProvider* -- 资源提供者
372 * @return BOOL -- TRUE: 成功
373 */
374 STDMETHOD_(BOOL, SetEditCtxMenuTemplateResId)(THIS_ LPCTSTR resId, IResProvider * pResProvider DEF_VAL(NULL)) PURE;
375
376 /**
377 * @brief 设置消息框模板资源ID
378 * @param resId LPCTSTR -- 资源ID
379 * @param pResProvider IResProvider* -- 资源提供者
380 * @return BOOL -- TRUE: 成功
381 */
382 STDMETHOD_(BOOL, SetMessageBoxTemplateResId)(THIS_ LPCTSTR resId, IResProvider * pResProvider DEF_VAL(NULL)) PURE;
383};
384
385SNSEND
386#endif // __SAPP_I__H__
Interface for handling real window creation and destruction.
Interface for Tooltip Objects.
Bitmap object interface.
Definition SRender-i.h:420
Interface for message loops.
Definition SMsgLoop-i.h:42
Interface for creating message loops.
Definition SMsgLoop-i.h:181
Interface for reference counting.
Definition obj-ref-i.h:19
Interface for handling real window operations.
RenderFactory object.
Definition SRender-i.h:2018
ResProvider对象
Interface for Tooltip Factory.
Definition stooltip-i.h:112
Language Translation Interface.
Language Translation Interface Manager.
Interface for XML Document.
Definition sxml-i.h:472