Module: wine Branch: master Commit: f35960200a18c8ac0fc54a0bfe0ecc6eabc92ce1 URL: http://source.winehq.org/git/wine.git/?a=commit;h=f35960200a18c8ac0fc54a0bfe...
Author: Nikolay Sivov bunglehead@gmail.com Date: Mon Mar 2 16:15:45 2009 -0500
comctl32: Correctly report systemcolor use for Treeview background.
---
dlls/comctl32/tests/treeview.c | 8 +++----- dlls/comctl32/treeview.c | 18 ++++++++++++------ 2 files changed, 15 insertions(+), 11 deletions(-)
diff --git a/dlls/comctl32/tests/treeview.c b/dlls/comctl32/tests/treeview.c index f93b485..9ef6a99 100644 --- a/dlls/comctl32/tests/treeview.c +++ b/dlls/comctl32/tests/treeview.c @@ -427,11 +427,9 @@ static void TestGetSetBkColor(void) { COLORREF crColor = RGB(0,0,0);
- todo_wine{ - /* If the value is -1, the control is using the system color for the background color. */ - crColor = (COLORREF)SendMessage( hTree, TVM_GETBKCOLOR, 0, 0 ); - ok(crColor == -1, "Default background color reported as 0x%.8x\n", crColor); - } + /* If the value is -1, the control is using the system color for the background color. */ + crColor = (COLORREF)SendMessage( hTree, TVM_GETBKCOLOR, 0, 0 ); + ok(crColor == -1, "Default background color reported as 0x%.8x\n", crColor);
/* Test for black background */ SendMessage( hTree, TVM_SETBKCOLOR, 0, (LPARAM)RGB(0,0,0) ); diff --git a/dlls/comctl32/treeview.c b/dlls/comctl32/treeview.c index abc6fc7..43ae7b6 100644 --- a/dlls/comctl32/treeview.c +++ b/dlls/comctl32/treeview.c @@ -2306,11 +2306,13 @@ TREEVIEW_DrawItemLines(const TREEVIEW_INFO *infoPtr, HDC hdc, const TREEVIEW_ITE & (TVS_LINESATROOT|TVS_HASLINES|TVS_HASBUTTONS)) > TVS_LINESATROOT); HBRUSH hbr, hbrOld; + COLORREF clrBk = infoPtr->clrBk == -1 ? GetSysColor(COLOR_WINDOW): + infoPtr->clrBk;
if (!lar && item->iLevel == 0) return;
- hbr = CreateSolidBrush(infoPtr->clrBk); + hbr = CreateSolidBrush(clrBk); hbrOld = SelectObject(hdc, hbr);
centerx = (item->linesOffset + item->stateOffset) / 2; @@ -2423,8 +2425,8 @@ TREEVIEW_DrawItemLines(const TREEVIEW_INFO *infoPtr, HDC hdc, const TREEVIEW_ITE { Rectangle(hdc, centerx - 1, centery - plussize + 1, centerx + 2, centery + plussize); - SetPixel(hdc, centerx - 1, centery, infoPtr->clrBk); - SetPixel(hdc, centerx + 1, centery, infoPtr->clrBk); + SetPixel(hdc, centerx - 1, centery, clrBk); + SetPixel(hdc, centerx + 1, centery, clrBk); } } } @@ -2472,7 +2474,8 @@ TREEVIEW_DrawItem(const TREEVIEW_INFO *infoPtr, HDC hdc, TREEVIEW_ITEM *wineItem } else { - nmcdhdr.clrTextBk = infoPtr->clrBk; + nmcdhdr.clrTextBk = infoPtr->clrBk == -1 ? GetSysColor(COLOR_WINDOW): + infoPtr->clrBk; if ((infoPtr->dwStyle & TVS_TRACKSELECT) && (wineItem == infoPtr->hotItem)) nmcdhdr.clrText = comctl32_color.clrHighlight; else if (infoPtr->clrText == -1) @@ -2782,9 +2785,12 @@ TREEVIEW_UpdateScrollBars(TREEVIEW_INFO *infoPtr) static LRESULT TREEVIEW_EraseBackground(const TREEVIEW_INFO *infoPtr, HDC hDC) { - HBRUSH hBrush = CreateSolidBrush(infoPtr->clrBk); + HBRUSH hBrush; + COLORREF clrBk = infoPtr->clrBk == -1 ? GetSysColor(COLOR_WINDOW): + infoPtr->clrBk; RECT rect;
+ hBrush = CreateSolidBrush(clrBk); GetClientRect(infoPtr->hwnd, &rect); FillRect(hDC, &rect, hBrush); DeleteObject(hBrush); @@ -4937,7 +4943,7 @@ TREEVIEW_Create(HWND hwnd, const CREATESTRUCTW *lpcs)
infoPtr->scrollX = 0;
- infoPtr->clrBk = GetSysColor(COLOR_WINDOW); + infoPtr->clrBk = -1; /* use system color */ infoPtr->clrText = -1; /* use system color */ infoPtr->clrLine = RGB(128, 128, 128); infoPtr->clrInsertMark = GetSysColor(COLOR_BTNTEXT);