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,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: