Text/Bkgnd color fixes.

This commit is contained in:
Guy Albertelli 2002-01-29 16:52:24 +00:00 committed by Alexandre Julliard
parent 6d694d8ed6
commit 390c6dfb93
1 changed files with 26 additions and 18 deletions

View File

@ -569,13 +569,18 @@ REBAR_DrawBand (HDC hdc, REBAR_INFO *infoPtr, REBAR_BAND *lpBand)
/* need to handle CDRF_NEWFONT here */ /* need to handle CDRF_NEWFONT here */
INT oldBkMode = SetBkMode (hdc, TRANSPARENT); INT oldBkMode = SetBkMode (hdc, TRANSPARENT);
COLORREF oldcolor = CLR_NONE; COLORREF oldcolor = CLR_NONE;
oldcolor = SetTextColor (hdc, (lpBand->clrFore != CLR_NONE) ? COLORREF new;
lpBand->clrFore : infoPtr->clrBtnText); if (lpBand->clrFore != CLR_NONE) {
new = (lpBand->clrFore == CLR_DEFAULT) ? infoPtr->clrBtnText :
lpBand->clrFore;
oldcolor = SetTextColor (hdc, new);
}
DrawTextW (hdc, lpBand->lpText, -1, &lpBand->rcCapText, DrawTextW (hdc, lpBand->lpText, -1, &lpBand->rcCapText,
DT_CENTER | DT_VCENTER | DT_SINGLELINE); DT_CENTER | DT_VCENTER | DT_SINGLELINE);
if (oldBkMode != TRANSPARENT) if (oldBkMode != TRANSPARENT)
SetBkMode (hdc, oldBkMode); SetBkMode (hdc, oldBkMode);
SetTextColor (hdc, oldcolor); if (lpBand->clrFore != CLR_NONE)
SetTextColor (hdc, oldcolor);
SelectObject (hdc, hOldFont); SelectObject (hdc, hOldFont);
} }
@ -2078,7 +2083,7 @@ REBAR_InternalEraseBkGnd (REBAR_INFO *infoPtr, WPARAM wParam, LPARAM lParam, REC
INT i, oldrow; INT i, oldrow;
HDC hdc = (HDC)wParam; HDC hdc = (HDC)wParam;
RECT rect; RECT rect;
COLORREF old, new; COLORREF old = CLR_NONE, new;
oldrow = -1; oldrow = -1;
for(i=0; i<infoPtr->uNumBands; i++) { for(i=0; i<infoPtr->uNumBands; i++) {
@ -2124,25 +2129,28 @@ REBAR_InternalEraseBkGnd (REBAR_INFO *infoPtr, WPARAM wParam, LPARAM lParam, REC
} }
/* draw the actual background */ /* draw the actual background */
if (lpBand->clrBack != CLR_NONE) if (lpBand->clrBack != CLR_NONE) {
new = lpBand->clrBack; new = (lpBand->clrBack == CLR_DEFAULT) ? infoPtr->clrBtnFace :
else lpBand->clrBack;
new = infoPtr->clrBtnFace;
rect = lpBand->rcBand;
#if GLATESTING #if GLATESTING
/* testing only - make background green to see it */ /* testing only - make background green to see it */
new = RGB(0,128,0); new = RGB(0,128,0);
#endif #endif
old = SetBkColor (hdc, new); old = SetBkColor (hdc, new);
}
rect = lpBand->rcBand;
TRACE("%s background color=0x%06lx, band (%d,%d)-(%d,%d), clip (%d,%d)-(%d,%d)\n", TRACE("%s background color=0x%06lx, band (%d,%d)-(%d,%d), clip (%d,%d)-(%d,%d)\n",
(lpBand->clrBack == CLR_NONE) ? "std" : "", (lpBand->clrBack == CLR_NONE) ? "none" :
new, ((lpBand->clrBack == CLR_DEFAULT) ? "dft" : ""),
GetBkColor(hdc),
lpBand->rcBand.left,lpBand->rcBand.top, lpBand->rcBand.left,lpBand->rcBand.top,
lpBand->rcBand.right,lpBand->rcBand.bottom, lpBand->rcBand.right,lpBand->rcBand.bottom,
clip->left, clip->top, clip->left, clip->top,
clip->right, clip->bottom); clip->right, clip->bottom);
ExtTextOutA (hdc, 0, 0, ETO_OPAQUE, &rect, NULL, 0, 0); ExtTextOutA (hdc, 0, 0, ETO_OPAQUE, &rect, NULL, 0, 0);
SetBkColor (hdc, old); if (lpBand->clrBack != CLR_NONE)
SetBkColor (hdc, old);
} }
return TRUE; return TRUE;
} }
@ -2589,7 +2597,7 @@ REBAR_GetBandInfoA (REBAR_INFO *infoPtr, WPARAM wParam, LPARAM lParam)
if (lprbbi->fMask & RBBIM_COLORS) { if (lprbbi->fMask & RBBIM_COLORS) {
lprbbi->clrFore = lpBand->clrFore; lprbbi->clrFore = lpBand->clrFore;
lprbbi->clrBack = lpBand->clrBack; lprbbi->clrBack = lpBand->clrBack;
if (lprbbi->clrBack == CLR_NONE) if (lprbbi->clrBack == CLR_DEFAULT)
lprbbi->clrBack = infoPtr->clrBtnFace; lprbbi->clrBack = infoPtr->clrBtnFace;
} }
@ -2675,7 +2683,7 @@ REBAR_GetBandInfoW (REBAR_INFO *infoPtr, WPARAM wParam, LPARAM lParam)
if (lprbbi->fMask & RBBIM_COLORS) { if (lprbbi->fMask & RBBIM_COLORS) {
lprbbi->clrFore = lpBand->clrFore; lprbbi->clrFore = lpBand->clrFore;
lprbbi->clrBack = lpBand->clrBack; lprbbi->clrBack = lpBand->clrBack;
if (lprbbi->clrBack == CLR_NONE) if (lprbbi->clrBack == CLR_DEFAULT)
lprbbi->clrBack = infoPtr->clrBtnFace; lprbbi->clrBack = infoPtr->clrBtnFace;
} }
@ -2773,7 +2781,7 @@ REBAR_GetBkColor (REBAR_INFO *infoPtr)
{ {
COLORREF clr = infoPtr->clrBk; COLORREF clr = infoPtr->clrBk;
if (clr == CLR_NONE) if (clr == CLR_DEFAULT)
clr = infoPtr->clrBtnFace; clr = infoPtr->clrBtnFace;
TRACE("background color 0x%06lx!\n", clr); TRACE("background color 0x%06lx!\n", clr);