Commit 3e467a13 authored by Zhiyi Zhang's avatar Zhiyi Zhang Committed by Alexandre Julliard

uxtheme: Allow EnableThemeDialogTexture() to set flags in multiple steps.

For example, set ETDT_USETABTEXTURE first and then set ETDT_ENABLE to activate dialog theming. Signed-off-by: 's avatarZhiyi Zhang <zzhang@codeweavers.com> Signed-off-by: 's avatarAlexandre Julliard <julliard@winehq.org>
parent 22d27236
......@@ -52,14 +52,32 @@ extern ATOM atDialogThemeEnabled;
/***********************************************************************
* EnableThemeDialogTexture (UXTHEME.@)
*/
HRESULT WINAPI EnableThemeDialogTexture(HWND hwnd, DWORD dwFlags)
HRESULT WINAPI EnableThemeDialogTexture(HWND hwnd, DWORD new_flag)
{
DWORD old_flag = 0;
BOOL res;
TRACE("(%p,0x%08x\n", hwnd, dwFlags);
res = SetPropW (hwnd, (LPCWSTR)MAKEINTATOM(atDialogThemeEnabled),
UlongToHandle(dwFlags|0x80000000));
/* 0x80000000 serves as a "flags set" flag */
TRACE("(%p,%#x\n", hwnd, new_flag);
new_flag &= ETDT_VALIDBITS;
if (new_flag == 0)
return S_OK;
if (new_flag & ETDT_DISABLE)
{
new_flag = ETDT_DISABLE;
old_flag = 0;
}
if (new_flag & ~ETDT_DISABLE)
{
old_flag = HandleToUlong(GetPropW(hwnd, (LPCWSTR)MAKEINTATOM(atDialogThemeEnabled)));
old_flag &= ~ETDT_DISABLE;
}
new_flag = new_flag | old_flag;
res = SetPropW(hwnd, (LPCWSTR)MAKEINTATOM(atDialogThemeEnabled), UlongToHandle(new_flag));
return res ? S_OK : HRESULT_FROM_WIN32(GetLastError());
}
......
......@@ -1645,16 +1645,15 @@ static void test_EnableThemeDialogTexture(void)
{
DWORD flag;
BOOL enabled;
BOOL todo;
}
invalid_flag_tests[] =
{
{0, FALSE, TRUE},
{0, FALSE},
{ETDT_DISABLE | ETDT_ENABLE, FALSE},
{ETDT_ENABLETAB | ETDT_ENABLEAEROWIZARDTAB, TRUE},
{ETDT_USETABTEXTURE | ETDT_USEAEROWIZARDTABTEXTURE, TRUE},
{ETDT_VALIDBITS, FALSE},
{~ETDT_VALIDBITS, FALSE, TRUE},
{~ETDT_VALIDBITS, FALSE},
{~ETDT_VALIDBITS | ETDT_DISABLE, FALSE}
};
......@@ -1989,7 +1988,6 @@ static void test_EnableThemeDialogTexture(void)
hr = EnableThemeDialogTexture(dialog, invalid_flag_tests[i].flag);
ok(hr == S_OK, "EnableThemeDialogTexture failed, hr %#x.\n", hr);
ret = IsThemeDialogTextureEnabled(dialog);
todo_wine_if(invalid_flag_tests[i].todo)
ok(ret == invalid_flag_tests[i].enabled, "Wrong dialog texture status.\n");
EndDialog(dialog, 0);
......@@ -2020,7 +2018,6 @@ static void test_EnableThemeDialogTexture(void)
"EnableThemeDialogTexture first flag", FALSE);
ret = IsThemeDialogTextureEnabled(dialog);
/* Non-zero flags without ETDT_DISABLE enables dialog texture */
todo_wine_if(flags[i] == 0)
ok(ret == (!(flags[i] & ETDT_DISABLE) && flags[i]), "Wrong dialog texture status.\n");
child = GetDlgItem(dialog, 100);
......@@ -2045,7 +2042,6 @@ static void test_EnableThemeDialogTexture(void)
if (flags[j])
ok(ret == !(flags[j] & ETDT_DISABLE), "Wrong dialog texture status.\n");
else
todo_wine_if(!flags[i] || flags[i] == ETDT_DISABLE || flags[i] == (ETDT_DISABLE | ETDT_ENABLE))
ok(ret == (!(flags[i] & ETDT_DISABLE) && flags[i]), "Wrong dialog texture status.\n");
lr = SendMessageA(dialog, WM_ERASEBKGND, (WPARAM)child_hdc, 0);
ok(lr != 0, "WM_ERASEBKGND failed.\n");
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment