diff --git a/dll/ime/msctfime/msctfime.cpp b/dll/ime/msctfime/msctfime.cpp index 884b01a500b..c1353076be1 100644 --- a/dll/ime/msctfime/msctfime.cpp +++ b/dll/ime/msctfime/msctfime.cpp @@ -3646,18 +3646,6 @@ VOID DetachIME(VOID) UnregisterImeClass(); } -/// @unimplemented -VOID InitUIFLib(VOID) -{ - //FIXME -} - -/// @unimplemented -VOID DoneUIFLib(VOID) -{ - //FIXME -} - /// @implemented BOOL ProcessAttach(HINSTANCE hinstDLL) { @@ -3670,7 +3658,7 @@ BOOL ProcessAttach(HINSTANCE hinstDLL) cicGetOSInfo(&g_uACP, &g_dwOSInfo); - InitUIFLib(); + cicInitUIFLib(); if (!TFInitLib()) return FALSE; @@ -3695,7 +3683,7 @@ VOID ProcessDetach(HINSTANCE hinstDLL) DeleteCriticalSection(&g_csLock); TLS::InternalDestroyTLS(); TLS::Uninitialize(); - DoneUIFLib(); + cicDoneUIFLib(); } /// @implemented diff --git a/dll/win32/msutb/msutb.cpp b/dll/win32/msutb/msutb.cpp index 29ecbe7d330..4ba8f878913 100644 --- a/dll/win32/msutb/msutb.cpp +++ b/dll/win32/msutb/msutb.cpp @@ -121,22 +121,6 @@ STDAPI DllGetClassObject(REFCLSID rclsid, REFIID riid, LPVOID *ppv) return gModule.DllGetClassObject(rclsid, riid, ppv); } -/** - * @unimplemented - */ -VOID InitUIFLib(VOID) -{ - //FIXME -} - -/** - * @unimplemented - */ -VOID DoneUIFLib(VOID) -{ - //FIXME -} - /** * @implemented */ @@ -167,7 +151,7 @@ BOOL ProcessAttach(HINSTANCE hinstDLL) cicGetOSInfo(&g_uACP, &g_dwOSInfo); TFInitLib(MsUtbCoCreateInstance); - InitUIFLib(); + cicInitUIFLib(); //CTrayIconWnd::RegisterClassW(); //FIXME @@ -184,7 +168,7 @@ BOOL ProcessAttach(HINSTANCE hinstDLL) */ VOID ProcessDetach(HINSTANCE hinstDLL) { - DoneUIFLib(); + cicDoneUIFLib(); TFUninitLib(); ::DeleteCriticalSection(&g_cs); gModule.Term(); diff --git a/dll/win32/msutb/precomp.h b/dll/win32/msutb/precomp.h index 0a77ed7f3ef..d4579a7511b 100644 --- a/dll/win32/msutb/precomp.h +++ b/dll/win32/msutb/precomp.h @@ -24,7 +24,7 @@ #include #include #undef STATUS_NO_MEMORY -#include +#include #include diff --git a/sdk/include/reactos/cicero/cicuif.h b/sdk/include/reactos/cicero/cicuif.h index 9745484075d..6bc52280640 100644 --- a/sdk/include/reactos/cicero/cicuif.h +++ b/sdk/include/reactos/cicero/cicuif.h @@ -9,6 +9,7 @@ #include "cicarray.h" +class CUIFSystemInfo; struct CUIFTheme; class CUIFObject; class CUIFWindow; @@ -21,6 +22,27 @@ class CUIFScheme; ///////////////////////////////////////////////////////////////////////////// +class CUIFSystemInfo : OSVERSIONINFO +{ +public: + static CUIFSystemInfo *s_pSystemInfo; + DWORD m_cBitsPixels; + BOOL m_bHighContrast1; + BOOL m_bHighContrast2; + + CUIFSystemInfo(); + void GetSystemMetrics(); + void Initialize(); +}; + +DECLSPEC_SELECTANY CUIFSystemInfo *CUIFSystemInfo::s_pSystemInfo = NULL; + +void cicInitUIFSys(void); +void cicDoneUIFSys(void); +void cicUpdateUIFSys(void); + +///////////////////////////////////////////////////////////////////////////// + #include // uxtheme.dll @@ -340,6 +362,80 @@ class CUIFWindow : public CUIFObject ///////////////////////////////////////////////////////////////////////////// +inline void cicInitUIFLib(void) +{ + cicInitUIFSys(); + cicInitUIFScheme(); + cicInitUIFUtil(); +} + +inline void cicDoneUIFLib(void) +{ + cicDoneUIFScheme(); + cicDoneUIFSys(); + cicDoneUIFUtil(); +} + +///////////////////////////////////////////////////////////////////////////// + +inline CUIFSystemInfo::CUIFSystemInfo() +{ + dwMajorVersion = 4; + dwMinorVersion = 0; + dwBuildNumber = 0; + dwPlatformId = VER_PLATFORM_WIN32_WINDOWS; + m_cBitsPixels = 8; + m_bHighContrast1 = m_bHighContrast2 = FALSE; +} + +inline void CUIFSystemInfo::GetSystemMetrics() +{ + HDC hDC = ::GetDC(NULL); + m_cBitsPixels = ::GetDeviceCaps(hDC, BITSPIXEL); + ::ReleaseDC(NULL, hDC); + + HIGHCONTRAST HighContrast = { sizeof(HighContrast) }; + ::SystemParametersInfo(SPI_GETHIGHCONTRAST, sizeof(HighContrast), &HighContrast, 0); + m_bHighContrast1 = !!(HighContrast.dwFlags & HCF_HIGHCONTRASTON); + COLORREF rgbBtnText = ::GetSysColor(COLOR_BTNTEXT); + COLORREF rgbBtnFace = ::GetSysColor(COLOR_BTNFACE); + const COLORREF black = RGB(0, 0, 0), white = RGB(255, 255, 255); + m_bHighContrast2 = (m_bHighContrast1 || + (rgbBtnText == black && rgbBtnFace == white) || + (rgbBtnText == white && rgbBtnFace == black)); +} + +inline void CUIFSystemInfo::Initialize() +{ + dwOSVersionInfoSize = sizeof(OSVERSIONINFO); + ::GetVersionEx(this); + GetSystemMetrics(); +} + +inline void cicInitUIFSys(void) +{ + CUIFSystemInfo::s_pSystemInfo = new(cicNoThrow) CUIFSystemInfo(); + if (CUIFSystemInfo::s_pSystemInfo) + CUIFSystemInfo::s_pSystemInfo->Initialize(); +} + +inline void cicDoneUIFSys(void) +{ + if (CUIFSystemInfo::s_pSystemInfo) + { + delete CUIFSystemInfo::s_pSystemInfo; + CUIFSystemInfo::s_pSystemInfo = NULL; + } +} + +inline void cicUpdateUIFSys(void) +{ + if (CUIFSystemInfo::s_pSystemInfo) + CUIFSystemInfo::s_pSystemInfo->GetSystemMetrics(); +} + +///////////////////////////////////////////////////////////////////////////// + inline HRESULT CUIFTheme::InternalOpenThemeData(HWND hWnd) { if (!hWnd || !m_pszClassList)