From 5bb8f968f641d8a14e3b61036af682a1bfd38566 Mon Sep 17 00:00:00 2001 From: Frank Richter Date: Fri, 15 Jul 2005 16:32:37 +0000 Subject: [PATCH] Make dialog theme texture setting non-global (ie a per-window setting). --- dlls/uxtheme/draw.c | 23 +++++++++++++++++++++-- dlls/uxtheme/system.c | 11 ++++++++--- 2 files changed, 29 insertions(+), 5 deletions(-) diff --git a/dlls/uxtheme/draw.c b/dlls/uxtheme/draw.c index ac03763861a..24f9095def9 100644 --- a/dlls/uxtheme/draw.c +++ b/dlls/uxtheme/draw.c @@ -41,7 +41,7 @@ WINE_DEFAULT_DEBUG_CHANNEL(uxtheme); * Defines and global variables */ -DWORD dwDialogTextureFlags; +extern ATOM atDialogThemeEnabled; /***********************************************************************/ @@ -50,8 +50,19 @@ DWORD dwDialogTextureFlags; */ HRESULT WINAPI EnableThemeDialogTexture(HWND hwnd, DWORD dwFlags) { + static const WCHAR szTab[] = { 'T','a','b',0 }; + HRESULT hr; + TRACE("(%p,0x%08lx\n", hwnd, dwFlags); - dwDialogTextureFlags = dwFlags; + hr = SetPropW (hwnd, MAKEINTATOMW (atDialogThemeEnabled), + (HANDLE)(dwFlags|0x80000000)); + /* 0x80000000 serves as a "flags set" flag */ + if (FAILED(hr)) + return hr; + if (dwFlags & ETDT_USETABTEXTURE) + return SetWindowTheme (hwnd, NULL, szTab); + else + return SetWindowTheme (hwnd, NULL, NULL); return S_OK; } @@ -60,7 +71,15 @@ HRESULT WINAPI EnableThemeDialogTexture(HWND hwnd, DWORD dwFlags) */ BOOL WINAPI IsThemeDialogTextureEnabled(HWND hwnd) { + DWORD dwDialogTextureFlags; TRACE("(%p)\n", hwnd); + + dwDialogTextureFlags = (DWORD)GetPropW (hwnd, + MAKEINTATOMW (atDialogThemeEnabled)); + if (dwDialogTextureFlags == 0) + /* Means EnableThemeDialogTexture wasn't called for this dialog */ + return TRUE; + return (dwDialogTextureFlags & ETDT_ENABLE) && !(dwDialogTextureFlags & ETDT_DISABLE); } diff --git a/dlls/uxtheme/system.c b/dlls/uxtheme/system.c index 1d9a7b1f517..5d10dc7710a 100644 --- a/dlls/uxtheme/system.c +++ b/dlls/uxtheme/system.c @@ -62,6 +62,7 @@ DWORD dwThemeAppProperties = STAP_ALLOW_NONCLIENT | STAP_ALLOW_CONTROLS; ATOM atWindowTheme; ATOM atSubAppName; ATOM atSubIdList; +ATOM atDialogThemeEnabled; BOOL bThemeActive = FALSE; WCHAR szCurrentTheme[MAX_PATH]; @@ -224,12 +225,16 @@ void UXTHEME_InitSystem(HINSTANCE hInst) static const WCHAR szSubIdList[] = { 'u','x','_','s','u','b','i','d','l','s','t','\0' }; + static const WCHAR szDialogThemeEnabled[] = { + 'u','x','_','d','i','a','l','o','g','t','h','e','m','e','\0' + }; hDllInst = hInst; - atWindowTheme = GlobalAddAtomW(szWindowTheme); - atSubAppName = GlobalAddAtomW(szSubAppName); - atSubIdList = GlobalAddAtomW(szSubIdList); + atWindowTheme = GlobalAddAtomW(szWindowTheme); + atSubAppName = GlobalAddAtomW(szSubAppName); + atSubIdList = GlobalAddAtomW(szSubIdList); + atDialogThemeEnabled = GlobalAddAtomW(szDialogThemeEnabled); UXTHEME_LoadTheme(); }