[UXTHEME] -Implement taking into account the flags set by SetThemeAppProperties....
[reactos.git] / reactos / dll / win32 / uxtheme / themehooks.c
index abd1940..f1dd079 100644 (file)
@@ -98,6 +98,16 @@ HTHEME GetNCCaptionTheme(HWND hWnd, DWORD style)
     if (pwndData == NULL)
         return NULL;
 
+    if (!(GetThemeAppProperties() & STAP_ALLOW_NONCLIENT))
+    {
+        if (pwndData->hthemeWindow)
+        {
+            CloseThemeData(pwndData->hthemeWindow);
+            pwndData->hthemeWindow = NULL;
+        }
+        return NULL;
+    }
+
     /* If the theme data was not cached, open it now */
     if (!pwndData->hthemeWindow)
         pwndData->hthemeWindow = OpenThemeDataEx(hWnd, L"WINDOW", OTD_NONCLIENT);
@@ -118,6 +128,16 @@ HTHEME GetNCScrollbarTheme(HWND hWnd, DWORD style)
     if (pwndData == NULL)
         return NULL;
 
+    if (!(GetThemeAppProperties() & STAP_ALLOW_NONCLIENT))
+    {
+        if (pwndData->hthemeScrollbar)
+        {
+            CloseThemeData(pwndData->hthemeScrollbar);
+            pwndData->hthemeScrollbar = NULL;
+        }
+        return NULL;
+    }
+
     /* If the theme data was not cached, open it now */
     if (!pwndData->hthemeScrollbar)
         pwndData->hthemeScrollbar = OpenThemeDataEx(hWnd, L"SCROLLBAR", OTD_NONCLIENT);
@@ -222,7 +242,7 @@ int OnPostWinPosChanged(HWND hWnd, WINDOWPOS* pWinPos)
     if (pwndData->UpdatingRgn == TRUE)
         return 0;
 
-    if(!IsAppThemed())
+    if(!IsAppThemed() || !(GetThemeAppProperties() & STAP_ALLOW_NONCLIENT))
     {
         if(pwndData->HasThemeRgn)
         {
@@ -248,7 +268,7 @@ int OnPostWinPosChanged(HWND hWnd, WINDOWPOS* pWinPos)
 static LRESULT CALLBACK
 ThemeDefWindowProcW(HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lParam)
 {      
-    if(!IsAppThemed())
+    if(!IsAppThemed() || !(GetThemeAppProperties() & STAP_ALLOW_NONCLIENT))
     {
         return g_user32ApiHook.DefWindowProcW(hWnd, 
                                             Msg, 
@@ -266,7 +286,7 @@ ThemeDefWindowProcW(HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lParam)
 static LRESULT CALLBACK
 ThemeDefWindowProcA(HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lParam)
 {
-    if(!IsAppThemed())
+    if(!IsAppThemed() || !(GetThemeAppProperties() & STAP_ALLOW_NONCLIENT))
     {
         return g_user32ApiHook.DefWindowProcA(hWnd, 
                                             Msg, 
@@ -456,7 +476,7 @@ ThemeDlgPostWindowProc(HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lParam, ULONG_
             HBRUSH* phbrush = (HBRUSH*)ret;
             HTHEME hTheme;
 
-            if (!IsAppThemed())
+            if(!IsAppThemed() || !(GetThemeAppProperties() & STAP_ALLOW_NONCLIENT))
                 break;
 
             if (!IsThemeDialogTextureEnabled (hWnd))
@@ -507,7 +527,7 @@ BOOL WINAPI ThemeGetScrollInfo(HWND hwnd, int fnBar, LPSCROLLINFO lpsi)
     BOOL ret;
 
     /* Avoid creating a window context if it is not needed */
-    if(!IsAppThemed())
+    if(!IsAppThemed() || !(GetThemeAppProperties() & STAP_ALLOW_NONCLIENT))
         goto dodefault;
 
     style = GetWindowLongW(hwnd, GWL_STYLE);