comctl32/treeview: Use cached colors instead of GetSysColor in TreeView.

This commit is contained in:
Nikolay Sivov 2009-05-17 23:08:44 +04:00 committed by Alexandre Julliard
parent 27f3a6d605
commit d93aab9c2a
1 changed files with 13 additions and 11 deletions

View File

@ -2306,7 +2306,7 @@ TREEVIEW_DrawItemLines(const TREEVIEW_INFO *infoPtr, HDC hdc, const TREEVIEW_ITE
& (TVS_LINESATROOT|TVS_HASLINES|TVS_HASBUTTONS)) & (TVS_LINESATROOT|TVS_HASLINES|TVS_HASBUTTONS))
> TVS_LINESATROOT); > TVS_LINESATROOT);
HBRUSH hbr, hbrOld; HBRUSH hbr, hbrOld;
COLORREF clrBk = infoPtr->clrBk == -1 ? GetSysColor(COLOR_WINDOW): COLORREF clrBk = infoPtr->clrBk == -1 ? comctl32_color.clrWindow:
infoPtr->clrBk; infoPtr->clrBk;
if (!lar && item->iLevel == 0) if (!lar && item->iLevel == 0)
@ -2460,26 +2460,26 @@ TREEVIEW_DrawItem(const TREEVIEW_INFO *infoPtr, HDC hdc, TREEVIEW_ITEM *wineItem
{ {
if ((wineItem->state & TVIS_DROPHILITED) || inFocus) if ((wineItem->state & TVIS_DROPHILITED) || inFocus)
{ {
nmcdhdr.clrTextBk = GetSysColor(COLOR_HIGHLIGHT); nmcdhdr.clrTextBk = comctl32_color.clrHighlight;
nmcdhdr.clrText = GetSysColor(COLOR_HIGHLIGHTTEXT); nmcdhdr.clrText = comctl32_color.clrHighlightText;
} }
else else
{ {
nmcdhdr.clrTextBk = GetSysColor(COLOR_BTNFACE); nmcdhdr.clrTextBk = comctl32_color.clrBtnFace;
if (infoPtr->clrText == -1) if (infoPtr->clrText == -1)
nmcdhdr.clrText = GetSysColor(COLOR_WINDOWTEXT); nmcdhdr.clrText = comctl32_color.clrWindowText;
else else
nmcdhdr.clrText = infoPtr->clrText; nmcdhdr.clrText = infoPtr->clrText;
} }
} }
else else
{ {
nmcdhdr.clrTextBk = infoPtr->clrBk == -1 ? GetSysColor(COLOR_WINDOW): nmcdhdr.clrTextBk = infoPtr->clrBk == -1 ? comctl32_color.clrWindow:
infoPtr->clrBk; infoPtr->clrBk;
if ((infoPtr->dwStyle & TVS_TRACKSELECT) && (wineItem == infoPtr->hotItem)) if ((infoPtr->dwStyle & TVS_TRACKSELECT) && (wineItem == infoPtr->hotItem))
nmcdhdr.clrText = comctl32_color.clrHighlight; nmcdhdr.clrText = comctl32_color.clrHighlight;
else if (infoPtr->clrText == -1) else if (infoPtr->clrText == -1)
nmcdhdr.clrText = GetSysColor(COLOR_WINDOWTEXT); nmcdhdr.clrText = comctl32_color.clrWindowText;
else else
nmcdhdr.clrText = infoPtr->clrText; nmcdhdr.clrText = infoPtr->clrText;
} }
@ -2786,7 +2786,7 @@ static LRESULT
TREEVIEW_EraseBackground(const TREEVIEW_INFO *infoPtr, HDC hDC) TREEVIEW_EraseBackground(const TREEVIEW_INFO *infoPtr, HDC hDC)
{ {
HBRUSH hBrush; HBRUSH hBrush;
COLORREF clrBk = infoPtr->clrBk == -1 ? GetSysColor(COLOR_WINDOW): COLORREF clrBk = infoPtr->clrBk == -1 ? comctl32_color.clrWindow:
infoPtr->clrBk; infoPtr->clrBk;
RECT rect; RECT rect;
@ -4885,7 +4885,7 @@ initialize_checkboxes(TREEVIEW_INFO *infoPtr)
SelectObject(hdc, hbmOld); SelectObject(hdc, hbmOld);
nIndex = ImageList_AddMasked(infoPtr->himlState, hbm, nIndex = ImageList_AddMasked(infoPtr->himlState, hbm,
GetSysColor(COLOR_WINDOW)); comctl32_color.clrWindow);
TRACE("checkbox index %d\n", nIndex); TRACE("checkbox index %d\n", nIndex);
DeleteObject(hbm); DeleteObject(hbm);
@ -4949,7 +4949,7 @@ TREEVIEW_Create(HWND hwnd, const CREATESTRUCTW *lpcs)
infoPtr->clrBk = -1; /* use system color */ infoPtr->clrBk = -1; /* use system color */
infoPtr->clrText = -1; /* use system color */ infoPtr->clrText = -1; /* use system color */
infoPtr->clrLine = RGB(128, 128, 128); infoPtr->clrLine = RGB(128, 128, 128);
infoPtr->clrInsertMark = GetSysColor(COLOR_BTNTEXT); infoPtr->clrInsertMark = comctl32_color.clrBtnText;
/* hwndToolTip */ /* hwndToolTip */
@ -5705,7 +5705,9 @@ TREEVIEW_WindowProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
case WM_STYLECHANGED: case WM_STYLECHANGED:
return TREEVIEW_StyleChanged(infoPtr, wParam, lParam); return TREEVIEW_StyleChanged(infoPtr, wParam, lParam);
/* WM_SYSCOLORCHANGE */ case WM_SYSCOLORCHANGE:
COMCTL32_RefreshSysColors();
return 0;
/* WM_SYSKEYDOWN */ /* WM_SYSKEYDOWN */