comctl32/treeview: Erase background on WM_PAINT if BeginPaint() tells us to do it.
This commit is contained in:
parent
a00d2235aa
commit
76859b0f47
|
@ -928,6 +928,17 @@ static void test_itemedit(void)
|
||||||
DestroyWindow(hTree);
|
DestroyWindow(hTree);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void test_treeview_classinfo(void)
|
||||||
|
{
|
||||||
|
WNDCLASSA cls;
|
||||||
|
|
||||||
|
memset(&cls, 0, sizeof(cls));
|
||||||
|
GetClassInfo(GetModuleHandleA("comctl32.dll"), WC_TREEVIEWA, &cls);
|
||||||
|
ok(cls.hbrBackground == NULL, "Expected NULL background brush, got %p\n", cls.hbrBackground);
|
||||||
|
ok(cls.style == (CS_GLOBALCLASS | CS_DBLCLKS), "Expected got %x\n", cls.style);
|
||||||
|
expect(0, cls.cbClsExtra);
|
||||||
|
}
|
||||||
|
|
||||||
START_TEST(treeview)
|
START_TEST(treeview)
|
||||||
{
|
{
|
||||||
HMODULE hComctl32;
|
HMODULE hComctl32;
|
||||||
|
@ -976,6 +987,7 @@ START_TEST(treeview)
|
||||||
test_callback();
|
test_callback();
|
||||||
test_expandinvisible();
|
test_expandinvisible();
|
||||||
test_itemedit();
|
test_itemedit();
|
||||||
|
test_treeview_classinfo();
|
||||||
|
|
||||||
PostMessageA(hMainWnd, WM_CLOSE, 0, 0);
|
PostMessageA(hMainWnd, WM_CLOSE, 0, 0);
|
||||||
while(GetMessageA(&msg,0,0,0)) {
|
while(GetMessageA(&msg,0,0,0)) {
|
||||||
|
|
|
@ -2788,19 +2788,27 @@ TREEVIEW_UpdateScrollBars(TREEVIEW_INFO *infoPtr)
|
||||||
infoPtr->uInternalStatus &= ~TV_HSCROLL;
|
infoPtr->uInternalStatus &= ~TV_HSCROLL;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* CtrlSpy doesn't mention this, but CorelDRAW's object manager needs it. */
|
static void
|
||||||
static LRESULT
|
TREEVIEW_FillBkgnd(const TREEVIEW_INFO *infoPtr, HDC hdc, const RECT *rc)
|
||||||
TREEVIEW_EraseBackground(const TREEVIEW_INFO *infoPtr, HDC hDC)
|
|
||||||
{
|
{
|
||||||
HBRUSH hBrush;
|
HBRUSH hBrush;
|
||||||
COLORREF clrBk = infoPtr->clrBk == -1 ? comctl32_color.clrWindow:
|
COLORREF clrBk = infoPtr->clrBk == -1 ? comctl32_color.clrWindow:
|
||||||
infoPtr->clrBk;
|
infoPtr->clrBk;
|
||||||
|
hBrush = CreateSolidBrush(clrBk);
|
||||||
|
FillRect(hdc, rc, hBrush);
|
||||||
|
DeleteObject(hBrush);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* CtrlSpy doesn't mention this, but CorelDRAW's object manager needs it. */
|
||||||
|
static LRESULT
|
||||||
|
TREEVIEW_EraseBackground(const TREEVIEW_INFO *infoPtr, HDC hdc)
|
||||||
|
{
|
||||||
RECT rect;
|
RECT rect;
|
||||||
|
|
||||||
hBrush = CreateSolidBrush(clrBk);
|
TRACE("%p\n", infoPtr);
|
||||||
|
|
||||||
GetClientRect(infoPtr->hwnd, &rect);
|
GetClientRect(infoPtr->hwnd, &rect);
|
||||||
FillRect(hDC, &rect, hBrush);
|
TREEVIEW_FillBkgnd(infoPtr, hdc, &rect);
|
||||||
DeleteObject(hBrush);
|
|
||||||
|
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
@ -2860,7 +2868,7 @@ TREEVIEW_Invalidate(const TREEVIEW_INFO *infoPtr, const TREEVIEW_ITEM *item)
|
||||||
}
|
}
|
||||||
|
|
||||||
static LRESULT
|
static LRESULT
|
||||||
TREEVIEW_Paint(TREEVIEW_INFO *infoPtr, WPARAM wParam)
|
TREEVIEW_Paint(TREEVIEW_INFO *infoPtr, HDC hdc_ref)
|
||||||
{
|
{
|
||||||
HDC hdc;
|
HDC hdc;
|
||||||
PAINTSTRUCT ps;
|
PAINTSTRUCT ps;
|
||||||
|
@ -2868,27 +2876,48 @@ TREEVIEW_Paint(TREEVIEW_INFO *infoPtr, WPARAM wParam)
|
||||||
|
|
||||||
TRACE("\n");
|
TRACE("\n");
|
||||||
|
|
||||||
if (wParam)
|
if (hdc_ref)
|
||||||
{
|
{
|
||||||
hdc = (HDC)wParam;
|
hdc = hdc_ref;
|
||||||
GetClientRect(infoPtr->hwnd, &rc);
|
GetClientRect(infoPtr->hwnd, &rc);
|
||||||
TREEVIEW_EraseBackground(infoPtr, hdc);
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
hdc = BeginPaint(infoPtr->hwnd, &ps);
|
hdc = BeginPaint(infoPtr->hwnd, &ps);
|
||||||
rc = ps.rcPaint;
|
rc = ps.rcPaint;
|
||||||
|
if(ps.fErase)
|
||||||
|
TREEVIEW_FillBkgnd(infoPtr, hdc, &rc);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(infoPtr->bRedraw) /* WM_SETREDRAW sets bRedraw */
|
if(infoPtr->bRedraw) /* WM_SETREDRAW sets bRedraw */
|
||||||
TREEVIEW_Refresh(infoPtr, hdc, &rc);
|
TREEVIEW_Refresh(infoPtr, hdc, &rc);
|
||||||
|
|
||||||
if (!wParam)
|
if (!hdc_ref)
|
||||||
EndPaint(infoPtr->hwnd, &ps);
|
EndPaint(infoPtr->hwnd, &ps);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static LRESULT
|
||||||
|
TREEVIEW_PrintClient(TREEVIEW_INFO *infoPtr, HDC hdc, DWORD options)
|
||||||
|
{
|
||||||
|
FIXME("Partial Stub: (hdc=%p options=0x%08x)\n", hdc, options);
|
||||||
|
|
||||||
|
if ((options & PRF_CHECKVISIBLE) && !IsWindowVisible(infoPtr->hwnd))
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
if (options & PRF_ERASEBKGND)
|
||||||
|
TREEVIEW_EraseBackground(infoPtr, hdc);
|
||||||
|
|
||||||
|
if (options & PRF_CLIENT)
|
||||||
|
{
|
||||||
|
RECT rc;
|
||||||
|
GetClientRect(infoPtr->hwnd, &rc);
|
||||||
|
TREEVIEW_Refresh(infoPtr, hdc, &rc);
|
||||||
|
}
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
/* Sorting **************************************************************/
|
/* Sorting **************************************************************/
|
||||||
|
|
||||||
|
@ -5707,8 +5736,10 @@ TREEVIEW_WindowProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
|
||||||
return TREEVIEW_NotifyFormat(infoPtr, (HWND)wParam, (UINT)lParam);
|
return TREEVIEW_NotifyFormat(infoPtr, (HWND)wParam, (UINT)lParam);
|
||||||
|
|
||||||
case WM_PRINTCLIENT:
|
case WM_PRINTCLIENT:
|
||||||
|
return TREEVIEW_PrintClient(infoPtr, (HDC)wParam, lParam);
|
||||||
|
|
||||||
case WM_PAINT:
|
case WM_PAINT:
|
||||||
return TREEVIEW_Paint(infoPtr, wParam);
|
return TREEVIEW_Paint(infoPtr, (HDC)wParam);
|
||||||
|
|
||||||
case WM_RBUTTONDOWN:
|
case WM_RBUTTONDOWN:
|
||||||
return TREEVIEW_RButtonDown(infoPtr, lParam);
|
return TREEVIEW_RButtonDown(infoPtr, lParam);
|
||||||
|
|
Loading…
Reference in New Issue