Only draw a themed border when edit control has WS_EX_CLIENTEDGE

style.
This commit is contained in:
Frank Richter 2005-08-18 10:48:45 +00:00 committed by Alexandre Julliard
parent 23f192d299
commit 2f47050c32
1 changed files with 39 additions and 35 deletions

View File

@ -35,12 +35,14 @@
WINE_DEFAULT_DEBUG_CHANNEL(themingedit); WINE_DEFAULT_DEBUG_CHANNEL(themingedit);
/* Draw themed border */ /* Draw themed border */
static void nc_paint (HWND hwnd, HRGN region) static void nc_paint (HTHEME theme, HWND hwnd, HRGN region)
{
HRGN cliprgn = region;
DWORD exStyle = GetWindowLongW (hwnd, GWL_EXSTYLE);
if (exStyle & WS_EX_CLIENTEDGE)
{ {
HTHEME theme = GetWindowTheme (hwnd);
HDC dc; HDC dc;
RECT r; RECT r;
HRGN cliprgn;
int cxEdge = GetSystemMetrics (SM_CXEDGE), int cxEdge = GetSystemMetrics (SM_CXEDGE),
cyEdge = GetSystemMetrics (SM_CYEDGE); cyEdge = GetSystemMetrics (SM_CYEDGE);
int part = EP_EDITTEXT; int part = EP_EDITTEXT;
@ -56,6 +58,7 @@ static void nc_paint (HWND hwnd, HRGN region)
GetWindowRect(hwnd, &r); GetWindowRect(hwnd, &r);
/* New clipping region passed to default proc to exclude border */
cliprgn = CreateRectRgn (r.left + cxEdge, r.top + cyEdge, cliprgn = CreateRectRgn (r.left + cxEdge, r.top + cyEdge,
r.right - cxEdge, r.bottom - cyEdge); r.right - cxEdge, r.bottom - cyEdge);
if (region != (HRGN)1) if (region != (HRGN)1)
@ -69,8 +72,9 @@ static void nc_paint (HWND hwnd, HRGN region)
DrawThemeParentBackground(hwnd, dc, &r); DrawThemeParentBackground(hwnd, dc, &r);
DrawThemeBackground (theme, dc, part, state, &r, 0); DrawThemeBackground (theme, dc, part, state, &r, 0);
ReleaseDC(hwnd, dc); 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); DefWindowProcW (hwnd, WM_NCPAINT, (WPARAM)cliprgn, 0);
} }
@ -113,7 +117,7 @@ LRESULT CALLBACK THEMING_EditSubclassProc (HWND hwnd, UINT msg,
case WM_NCPAINT: case WM_NCPAINT:
theme = GetWindowTheme( hwnd ); theme = GetWindowTheme( hwnd );
if (!theme) return THEMING_CallOriginalClass (hwnd, msg, wParam, lParam); if (!theme) return THEMING_CallOriginalClass (hwnd, msg, wParam, lParam);
nc_paint (hwnd, (HRGN)wParam); nc_paint (theme, hwnd, (HRGN)wParam);
break; break;
case WM_ENABLE: case WM_ENABLE: