From 2f47050c3209e3ead397c71e2a98de685fa9c8db Mon Sep 17 00:00:00 2001 From: Frank Richter Date: Thu, 18 Aug 2005 10:48:45 +0000 Subject: [PATCH] Only draw a themed border when edit control has WS_EX_CLIENTEDGE style. --- dlls/comctl32/theme_edit.c | 74 ++++++++++++++++++++------------------ 1 file changed, 39 insertions(+), 35 deletions(-) diff --git a/dlls/comctl32/theme_edit.c b/dlls/comctl32/theme_edit.c index c13840a5d6e..a76889702a1 100644 --- a/dlls/comctl32/theme_edit.c +++ b/dlls/comctl32/theme_edit.c @@ -35,42 +35,46 @@ WINE_DEFAULT_DEBUG_CHANNEL(themingedit); /* Draw themed border */ -static void nc_paint (HWND hwnd, HRGN region) +static void nc_paint (HTHEME theme, HWND hwnd, HRGN region) { - HTHEME theme = GetWindowTheme (hwnd); - HDC dc; - RECT r; - HRGN cliprgn; - int cxEdge = GetSystemMetrics (SM_CXEDGE), - cyEdge = GetSystemMetrics (SM_CYEDGE); - int part = EP_EDITTEXT; - int state = ETS_NORMAL; - DWORD dwStyle = GetWindowLongW (hwnd, GWL_STYLE); + HRGN cliprgn = region; + DWORD exStyle = GetWindowLongW (hwnd, GWL_EXSTYLE); + if (exStyle & WS_EX_CLIENTEDGE) + { + HDC dc; + RECT r; + int cxEdge = GetSystemMetrics (SM_CXEDGE), + cyEdge = GetSystemMetrics (SM_CYEDGE); + int part = EP_EDITTEXT; + int state = ETS_NORMAL; + DWORD dwStyle = GetWindowLongW (hwnd, GWL_STYLE); + + if (!IsWindowEnabled (hwnd)) + state = ETS_DISABLED; + else if (dwStyle & ES_READONLY) + state = ETS_READONLY; + else if (GetFocus() == hwnd) + state = ETS_FOCUSED; + + GetWindowRect(hwnd, &r); + + /* New clipping region passed to default proc to exclude border */ + cliprgn = CreateRectRgn (r.left + cxEdge, r.top + cyEdge, + r.right - cxEdge, r.bottom - cyEdge); + if (region != (HRGN)1) + CombineRgn (cliprgn, cliprgn, region, RGN_AND); + OffsetRect(&r, -r.left, -r.top); + + dc = GetDCEx(hwnd, region, DCX_WINDOW|DCX_INTERSECTRGN); + OffsetRect(&r, -r.left, -r.top); + + if (IsThemeBackgroundPartiallyTransparent (theme, part, state)) + DrawThemeParentBackground(hwnd, dc, &r); + DrawThemeBackground (theme, dc, part, state, &r, 0); + ReleaseDC(hwnd, dc); + } - if (!IsWindowEnabled (hwnd)) - state = ETS_DISABLED; - else if (dwStyle & ES_READONLY) - state = ETS_READONLY; - else if (GetFocus() == hwnd) - state = ETS_FOCUSED; - - GetWindowRect(hwnd, &r); - - cliprgn = CreateRectRgn (r.left + cxEdge, r.top + cyEdge, - r.right - cxEdge, r.bottom - cyEdge); - if (region != (HRGN)1) - CombineRgn (cliprgn, cliprgn, region, RGN_AND); - OffsetRect(&r, -r.left, -r.top); - - dc = GetDCEx(hwnd, region, DCX_WINDOW|DCX_INTERSECTRGN); - OffsetRect(&r, -r.left, -r.top); - - if (IsThemeBackgroundPartiallyTransparent (theme, part, state)) - DrawThemeParentBackground(hwnd, dc, &r); - DrawThemeBackground (theme, dc, part, state, &r, 0); - ReleaseDC(hwnd, dc); - - /* Call default proc to get the scrollbars etc. painted */ + /* Call default proc to get the scrollbars etc. also painted */ DefWindowProcW (hwnd, WM_NCPAINT, (WPARAM)cliprgn, 0); } @@ -113,7 +117,7 @@ LRESULT CALLBACK THEMING_EditSubclassProc (HWND hwnd, UINT msg, case WM_NCPAINT: theme = GetWindowTheme( hwnd ); if (!theme) return THEMING_CallOriginalClass (hwnd, msg, wParam, lParam); - nc_paint (hwnd, (HRGN)wParam); + nc_paint (theme, hwnd, (HRGN)wParam); break; case WM_ENABLE: