18#include <interface/sapp-i.h>
20#include <res.mgr/SResProviderMgr.h>
21#include <res.mgr/SNamedValue.h>
23#include <core/SMsgLoop.h>
25#include <helper/obj-ref-impl.hpp>
28#define GETRESPROVIDER SNS::SApplication::getSingletonPtr()
29#define GETRENDERFACTORY SNS::SApplication::getSingleton().GetRenderFactory()
30#define GETREALWNDHANDLER SNS::SApplication::getSingleton().GetRealWndHander()
31#define GETTOOLTIPFACTORY SNS::SApplication::getSingleton().GetToolTipFactory()
33#define LOADXML(p1, p2) SNS::SApplication::getSingleton().LoadXmlDocment(p1, p2)
34#define LOADIMAGE(p1,p2) ((IResProviderMgr*)SNS::SApplication::getSingletonPtr())->LoadImage(p1,p2)
35#define LOADIMAGE2(p1) SNS::SApplication::getSingleton().LoadImage2(p1)
36#define LOADICON(p1, p2) SNS::SApplication::getSingleton().LoadIcon(p1, p2, p2)
37#define LOADICON2(p1) SNS::SApplication::getSingleton().LoadIcon2(p1)
38#define TR(p1, p2) SNS::SApplication::getSingleton().tr(p1, p2)
39#define STR2ID(p1) SNS::SApplication::getSingleton().Str2ID(p1)
42#define CREATEINTERPOLATOR(x) SNS::SApplication::getSingleton().CreateInterpolatorByName(x)
163 LPCTSTR pszHostClassName = _T(
"SOUIHOST"),
165 BOOL bImeApp = FALSE);
190 STDMETHOD_(HMODULE,
GetModule)(THIS) SCONST OVERRIDE;
240 STDMETHOD_(
void,
SetLogManager)(THIS_ ILogMgr *pLogMgr) OVERRIDE;
253 (THIS_ IAttrStorageFactory *pAttrStorageFactory) OVERRIDE;
266 STDMETHOD_(
int,
Run)(THIS_ HWND hMainWnd) OVERRIDE;
272 STDMETHOD_(
void,
Quit)(THIS_
int nCode) OVERRIDE;
300 (THIS_ tid_t tid = ::GetCurrentThreadId()) SCONST OVERRIDE;
324 STDMETHOD_(
void,
SetScriptFactory)(THIS_ IScriptFactory *pScriptModule) OVERRIDE;
333 (THIS_
const LPCWSTR *pNames,
const int *nIds,
int nCount) OVERRIDE;
349 SStringT str = S_CA2T(strResId, CP_UTF8);
358 STDMETHOD_(IAnimation *, LoadAnimation)(THIS_ LPCTSTR strResId) OVERRIDE;
367 SStringT str = S_CA2T(strResId, CP_UTF8);
378 SStringW wcsResId = S_CT2W(strResId);
389 SStringT str = S_CA2T(strResId, CP_UTF8);
398 STDMETHOD_(IValueAnimator *, LoadValueAnimator)(THIS_ LPCTSTR strResId) OVERRIDE;
407 SStringT str = S_CA2T(strResId, CP_UTF8);
416 STDMETHOD_(
ITranslator *,LoadTranslator)(THIS_ LPCTSTR strResId) OVERRIDE;
425 SStringT str = S_CA2T(strResId, CP_UTF8);
434 STDMETHOD_(BOOL,InstallTranslator)(THIS_
ITranslator * trModule) OVERRIDE;
441 STDMETHOD_(BOOL,UnnstallTranslator)(THIS_ REFGUID langId) OVERRIDE;
448 STDMETHOD_(
void,EnableNotifyCenter)(THIS_ BOOL bEnable,
int interval DEF_VAL(20)) OVERRIDE;
455 STDMETHOD_(
void *,GetInnerSingleton)(THIS_ SingletonType nType) OVERRIDE;
463 STDMETHOD_(IObject *,CreateObject)(THIS_ LPCWSTR pszName,SObjectType nType) SCONST OVERRIDE;
469 STDMETHOD_(
void,SetCreateObjectCallback)(THIS_ FunCreateObject cbCreateObj) OVERRIDE;
477 STDMETHOD_(BOOL,RegisterObjFactory)(THIS_
const IObjectFactory *objFac,BOOL bReplace DEF_VAL(FALSE)) OVERRIDE;
484 STDMETHOD_(BOOL,UnregisterObjFactory)(THIS_
const IObjectFactory *objFac) OVERRIDE;
490 STDMETHOD_(
void,SetDefaultFontInfo)(THIS_ LPCWSTR pszFontInfo) OVERRIDE;
499 STDMETHOD_(BOOL,CreateTaskLoop)(THIS_
int nCount,Priority priority,BOOL bAutoStart DEF_VAL(TRUE)) OVERRIDE;
506 STDMETHOD_(ITaskLoop *, GetTaskLoop)(THIS_
int iTaskLoop DEF_VAL(0)) OVERRIDE;
512 STDMETHOD_(
void, SetCreateTaskLoopCallback)(THIS_ FunCrateTaskLoop cbCreateTaskLoop) OVERRIDE;
519 STDMETHOD_(HRESULT,CreateScriptModule)(THIS_ IScriptModule **ppScriptModule) OVERRIDE;
527 STDMETHOD_(BOOL,SetEditCtxMenuTemplateResId)(THIS_ LPCTSTR resId,
IResProvider *pResProvider DEF_VAL(NULL)) OVERRIDE;
535 STDMETHOD_(BOOL,SetMessageBoxTemplateResId)(THIS_ LPCTSTR resId,
IResProvider *pResProvider DEF_VAL(NULL)) OVERRIDE;
544 void InitXmlNamedID(
const SNamedID::NAMEDVALUE *pNamedValue,
int nCount, BOOL bSorted);
553 BOOL LoadXmlDocment(
SXmlDoc &xmlDoc,
const SStringT &strResId,
IResProvider *pResProvider = NULL);
559 void SetAppDir(
const SStringT &strAppDir);
565 SStringT GetAppDir()
const;
575 if (T::GetClassType() != Window)
588 if (T::GetClassType() != Window)
601 if (T::GetClassType() != Skin)
614 if (T::GetClassType() != Skin)
630 SXmlNode GetMessageBoxTemplate()
const;
636 SXmlNode GetEditCtxMenuTemplate()
const;
651 virtual IWindow *CreateWindowByName(LPCWSTR pszWndClass)
const;
658 virtual ISkinObj *CreateSkinByName(LPCWSTR pszSkinClass)
const;
665 virtual IInterpolator *CreateInterpolatorByName(LPCWSTR pszName)
const;
672 virtual IAnimation *CreateAnimationByName(LPCWSTR pszName)
const;
679 virtual IValueAnimator *CreateValueAnimatorByName(LPCWSTR pszName)
const;
687 virtual IAccProxy *CreateAccProxy(IWindow *pWnd)
const;
694 virtual IAccessible *CreateAccessible(IWindow *pWnd)
const;
700 void _CreateSingletons();
705 void _DestroySingletons();
718 BOOL _LoadXmlDocment(LPCTSTR pszXmlName,
virtual void RegisterValueAnimator(SObjectFactoryMgr *objFactory) const PURE
Register value animator objects into the object factory.
virtual void RegisterInterpolator(SObjectFactoryMgr *objFactory) const PURE
Register interpolator objects into the object factory.
virtual void RegisterSkins(SObjectFactoryMgr *objFactory) const PURE
Register skin objects into the object factory.
virtual void RegisterWindows(SObjectFactoryMgr *objFactory) const PURE
Register window objects into the object factory.
virtual void RegisterAnimation(SObjectFactoryMgr *objFactory) const PURE
Register animation objects into the object factory.
Object Factory Management.
Interface for Skin Objects.
SAutoRefPtr< IScriptFactory > m_pScriptFactory
Pointer to the script factory.
UINT LoadSystemNamedResource(IResProvider *pResProvider) OVERRIDE
Load system named resources.
ITranslatorMgr * GetTranslator() OVERRIDE
Get the translator manager.
SMap< tid_t, SAutoRefPtr< IMessageLoop > > MsgLoopMap
Map of message loops for different threads.
void Quit(int nCode) OVERRIDE
Quit the application.
HMODULE m_hInst
Module handle.
ITranslator * LoadTranslator(LPCTSTR strResId) OVERRIDE
Load a translator from a resource.
IValueAnimator * LoadValueAnimatorU8(LPCSTR strResId) OVERRIDE
Load a value animator from a UTF-8 encoded resource.
IBitmapS * LoadImage(LPCTSTR strResId) OVERRIDE
Load an image from a resource.
BOOL AddMsgLoop(IMessageLoop *pMsgLoop, BOOL bReplace=FALSE) OVERRIDE
Add a message loop.
HWND m_hMainWnd
Handle to the main window.
SAutoRefPtr< ITranslatorMgr > m_translator
Pointer to the translator manager.
IMessageLoop * GetMsgLoop(tid_t tid=::GetCurrentThreadId()) SCONST OVERRIDE
Get the message loop for a specific thread.
SApplication(IRenderFactory *pRendFactory, HINSTANCE hInst, LPCTSTR pszHostClassName=_T("SOUIHOST"), const ISystemObjectRegister &sysObjRegister=SObjectDefaultRegister(), BOOL bImeApp=FALSE)
Constructor for SApplication.
SNamedID m_namedID
Named ID manager.
IResProviderMgr * GetResProviderMgr() OVERRIDE
Get the resource provider manager.
SXmlDoc m_xmlMessageBoxTemplate
XML document for the message box template.
IAttrStorageFactory * GetAttrStorageFactory() OVERRIDE
Get the attribute storage factory.
IAnimation * LoadAnimationU8(LPCSTR strResId) OVERRIDE
Load an animation from a UTF-8 encoded resource.
void * m_pSingletons[SINGLETON_COUNT]
Array of singleton pointers.
int Run(HWND hMainWnd) OVERRIDE
Run the application message loop.
SStringT m_strAppDir
Application directory path.
SAutoRefPtr< ILogMgr > m_logManager
Pointer to the log manager.
IToolTipFactory * GetToolTipFactory() OVERRIDE
Get the tooltip factory.
BOOL UnregisterWindowClass()
Unregister a window class.
BOOL RegisterWindowClass()
Register a window class.
IBitmapS * LoadImageU8(LPCSTR strResId) OVERRIDE
Load an image from a UTF-8 encoded resource.
SAutoRefPtr< IRealWndHandler > m_pRealWndHandler
Pointer to the real window handler.
SXmlDoc m_xmlEditCtxMenuTemplate
XML document for the edit context menu template.
IMsgLoopFactory * GetMsgLoopFactory() OVERRIDE
Get the message loop factory.
void SetAttrStorageFactory(IAttrStorageFactory *pAttrStorageFactory) OVERRIDE
Set the attribute storage factory.
BOOL SetRenderFactory(IRenderFactory *renderFac) OVERRIDE
Set the render factory.
HWND GetMainWnd() OVERRIDE
Get the main window handle.
SCriticalSection m_cs
Critical section for thread-safe operations.
FunCrateTaskLoop m_cbCreateTaskLoop
Callback function for creating task loops.
BOOL RemoveMsgLoop() OVERRIDE
Remove the current message loop.
SAutoRefPtr< IToolTipFactory > m_tooltipFactory
Pointer to the tooltip factory.
FunCreateObject m_cbCreateObj
Callback function for creating objects.
void SetLogManager(ILogMgr *pLogMgr) OVERRIDE
Set the log manager.
ITranslator * LoadTranslatorU8(LPCSTR strResId) OVERRIDE
Load a translator from a UTF-8 encoded resource.
IValueAnimator * LoadValueAnimator(LPCTSTR strResId) OVERRIDE
Load a value animator from a resource.
IXmlDoc * LoadXmlDocment(LPCTSTR strResId) OVERRIDE
Load an XML document from a resource.
IRealWndHandler * GetRealWndHander() OVERRIDE
Get the real window handler.
ILogMgr * GetLogManager() OVERRIDE
Get the log manager.
IRenderFactory * GetRenderFactory() OVERRIDE
Get the render factory.
IXmlDoc * LoadXmlDocmentU8(LPCSTR strResId) OVERRIDE
Load an XML document from a UTF-8 encoded resource.
SAutoRefPtr< IMsgLoopFactory > m_msgLoopFactory
Pointer to the message loop factory.
BOOL UnregisterSkinClass()
Unregister a skin class.
void SetScriptFactory(IScriptFactory *pScriptModule) OVERRIDE
Set the script factory.
void SetToolTipFactory(IToolTipFactory *pToolTipFac) OVERRIDE
Set the tooltip factory.
SArray< SAutoRefPtr< ITaskLoop > > m_lstTaskLoop
List of task loops.
BOOL SetMsgLoopFactory(IMsgLoopFactory *pMsgLoopFac) OVERRIDE
Set the message loop factory.
SAutoRefPtr< IAttrStorageFactory > m_pAttrStroageFactory
Pointer to the attribute storage factory.
void SetRealWndHandler(IRealWndHandler *pRealHandler) OVERRIDE
Set the real window handler.
void InitXmlNamedID(const LPCWSTR *pNames, const int *nIds, int nCount) OVERRIDE
Initialize XML named IDs from arrays.
void SetTranslator(ITranslatorMgr *pTrans) OVERRIDE
Set the translator manager.
IAnimation * LoadAnimation(LPCTSTR strResId) OVERRIDE
Load an animation from a resource.
SAutoRefPtr< IRenderFactory > m_RenderFactory
Pointer to the render factory.
HMODULE GetModule() SCONST OVERRIDE
Get the module handle.
BOOL RegisterSkinClass()
Register a skin class.
Smart pointer class for managing COM-style reference-counted objects.
Wrapper class for a critical section.
Manages named integer IDs.
Default implementation of ISystemObjectRegister.
void RegisterLayouts(SObjectFactoryMgr *objFactory) const
Register layout objects into the object factory.
Manager for object factories.
SObjectFactoryMgr(void)
Constructor for SObjectFactoryMgr.
BOOL TplUnregisterFactory()
Template method to unregister a factory for a specific object type.
BOOL TplRegisterFactory()
Template method to register a factory for a specific object type.
IBitmapS * LoadImage2(const SStringW &strImgID)
Loads an image using a type:name formatted string.
SResProviderMgr(void)
Constructor.
A class representing an ASCII string.
Implementation of IXmlDoc.
Class representing an XML node.
Interface for registering various system objects in SOUI.
Interface for message loops.
Interface for creating message loops.
Interface for handling real window operations.
Interface for Skin Objects.
Language Translation Interface.
Language Translation Interface Manager.
Interface for XML Document.