#ifndef __USYSTEM_H__ #define __USYSTEM_H__ #include "UBase.h" #include "UControl.h" class USystemImp; class UControl; // TODO : Under consideration, write the USystem interface to UControl? // USystemImp wrapper , for a clear interface. class UIAPI USystem { public: static USystem* Create(); void SetSoundInterface(IUSoundInterface* iSI); // temp interface. void SetDevice(void* pd3ddevice); BOOL Initialize(HWND hWnd); BOOL EnableIME(BOOL Enable = TRUE); void SetIMEEnable(BOOL Enable = TRUE); BOOL IsIMEEable(); void IniIMEWnd(HWND hWnd); void Shutdown(); void Release(); void SetDragCursorSize(const UPoint& CursorSize); void Update(float fDeltaTime); void Draw(); void Resize(int x, int y); void ResizeWindow(int x, int y); BOOL MouseMove(int x, int y); BOOL MouseBtnDown(UINT Btn); BOOL MouseBtnUp(UINT Btn); BOOL MouseWheel(int Delta); BOOL KeyDown(UINT Key); BOOL KeyUp(UINT Key); BOOL KeyPress(UINT Key); inline BOOL IsDragging() const; // In the UI system, the processing of characters is based on UNICODE, so // For the handling of WM_CHAR, it must be strictly distinguished. If the window class, window, window procedure is constructed for ANSI. // Then you must call ANSI version of the process, otherwise call UTF16. // Also, it is recommended to construct a UNICODE window so that the UI is handled much faster and safer. void KeyMessageA(UINT nMsg, UINT wParam, UINT lParam); void KeyMessageW(UINT nMsg, UINT wParam, UINT lParam); BOOL WindowKillForce(); BOOL ProcessIMEMessage(UINT nMsg, UINT wParam, UINT lParam); // Load the style of the control. Before creating the control, you must ensure that the corresponding style has been loaded. // (Refer to WIN32: RegisterClass must be used before CreateWindow) BOOL LoadControlStyle(const char* StyleFileName); UControlStyle* FindControlStyle(const char* StyleName); //BOOL RegisterControlStyle(const char* ); BOOL LoadAcceleratorKey(const char* keyFileName, bool bCover); BOOL SaveAcceleratorKey(const char* keyFileName); void UnLoadAccelertorKey(); UAccelarKey * FindAcceleratorKey(const char * AcceleratorKeyName); BOOL SetAcceleratorKey(const char* AcceleratorKeyName, UINT nKeycode, UINT nFlag); BOOL LoadColorTable(const char* ColorFileName); UColorTable* FindColor(const char * ColorName); USkinPtr LoadSkin(const char* filename); void DestorySkin(USkin* pSkin); // Create a dialog from template file. UControl* CreateDialogFromFile(const char* TemplateName); UControl* CreateDialogFromMemory(const char* pTemplate, int nSize); void DestoryControl(UControl* pControl); BOOL SetFrameControl(UControl* pFrameCtrl); // Similar to the behavior of MFC FrameWnd, becomes the active frame of the current desktop and replaces the original frame. UControl* GetCurFrame(); void PushDialog(UControl* pDialog); void PopDialog(UControl* pDialog); const UPoint& GetCursorPos() const; UControl* GetCapturedCtrl(); void CaptureControl(UControl* pTargetCtrl); void ReleaseCapture(UControl* pCapturedCtrl); UControl* GetFocus(); const char* GetRootPath() const; void SetRootPath(); URender* GetPlugin(); void __PlaySound(const char* pszSnd); void __PlaySound(int Index); void SetMouseControl(UControl* pWnd); BOOL InitSoftKeyBoardControl(); private: USystem(void); ~USystem(void); USystemImp* m_pSystem; BOOL m_IsIMEEable; }; #endif