Only draw a themed border when edit control has WS_EX_CLIENTEDGE
style.
This commit is contained in:
parent
23f192d299
commit
2f47050c32
|
@ -35,42 +35,46 @@
|
||||||
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)
|
||||||
{
|
{
|
||||||
HTHEME theme = GetWindowTheme (hwnd);
|
HRGN cliprgn = region;
|
||||||
HDC dc;
|
DWORD exStyle = GetWindowLongW (hwnd, GWL_EXSTYLE);
|
||||||
RECT r;
|
if (exStyle & WS_EX_CLIENTEDGE)
|
||||||
HRGN cliprgn;
|
{
|
||||||
int cxEdge = GetSystemMetrics (SM_CXEDGE),
|
HDC dc;
|
||||||
cyEdge = GetSystemMetrics (SM_CYEDGE);
|
RECT r;
|
||||||
int part = EP_EDITTEXT;
|
int cxEdge = GetSystemMetrics (SM_CXEDGE),
|
||||||
int state = ETS_NORMAL;
|
cyEdge = GetSystemMetrics (SM_CYEDGE);
|
||||||
DWORD dwStyle = GetWindowLongW (hwnd, GWL_STYLE);
|
int part = EP_EDITTEXT;
|
||||||
|
int state = ETS_NORMAL;
|
||||||
|
DWORD dwStyle = GetWindowLongW (hwnd, GWL_STYLE);
|
||||||
|
|
||||||
if (!IsWindowEnabled (hwnd))
|
if (!IsWindowEnabled (hwnd))
|
||||||
state = ETS_DISABLED;
|
state = ETS_DISABLED;
|
||||||
else if (dwStyle & ES_READONLY)
|
else if (dwStyle & ES_READONLY)
|
||||||
state = ETS_READONLY;
|
state = ETS_READONLY;
|
||||||
else if (GetFocus() == hwnd)
|
else if (GetFocus() == hwnd)
|
||||||
state = ETS_FOCUSED;
|
state = ETS_FOCUSED;
|
||||||
|
|
||||||
GetWindowRect(hwnd, &r);
|
GetWindowRect(hwnd, &r);
|
||||||
|
|
||||||
cliprgn = CreateRectRgn (r.left + cxEdge, r.top + cyEdge,
|
/* New clipping region passed to default proc to exclude border */
|
||||||
r.right - cxEdge, r.bottom - cyEdge);
|
cliprgn = CreateRectRgn (r.left + cxEdge, r.top + cyEdge,
|
||||||
if (region != (HRGN)1)
|
r.right - cxEdge, r.bottom - cyEdge);
|
||||||
CombineRgn (cliprgn, cliprgn, region, RGN_AND);
|
if (region != (HRGN)1)
|
||||||
OffsetRect(&r, -r.left, -r.top);
|
CombineRgn (cliprgn, cliprgn, region, RGN_AND);
|
||||||
|
OffsetRect(&r, -r.left, -r.top);
|
||||||
|
|
||||||
dc = GetDCEx(hwnd, region, DCX_WINDOW|DCX_INTERSECTRGN);
|
dc = GetDCEx(hwnd, region, DCX_WINDOW|DCX_INTERSECTRGN);
|
||||||
OffsetRect(&r, -r.left, -r.top);
|
OffsetRect(&r, -r.left, -r.top);
|
||||||
|
|
||||||
if (IsThemeBackgroundPartiallyTransparent (theme, part, state))
|
if (IsThemeBackgroundPartiallyTransparent (theme, part, state))
|
||||||
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:
|
||||||
|
|
Loading…
Reference in New Issue