Got rid of GetSysColorPen.

This commit is contained in:
Alexandre Julliard 2002-05-20 18:15:28 +00:00
parent 11b35c0b4c
commit 4344c368cb
14 changed files with 87 additions and 65 deletions

View File

@ -693,7 +693,7 @@ static void PB_Paint( HWND hwnd, HDC hDC, UINT action )
/* Send WM_CTLCOLOR to allow changing the font (the colors are fixed) */ /* Send WM_CTLCOLOR to allow changing the font (the colors are fixed) */
if ((hFont = get_button_font( hwnd ))) SelectObject( hDC, hFont ); if ((hFont = get_button_font( hwnd ))) SelectObject( hDC, hFont );
SendMessageW( GetParent(hwnd), WM_CTLCOLORBTN, hDC, (LPARAM)hwnd ); SendMessageW( GetParent(hwnd), WM_CTLCOLORBTN, hDC, (LPARAM)hwnd );
hOldPen = (HPEN)SelectObject(hDC, GetSysColorPen(COLOR_WINDOWFRAME)); hOldPen = (HPEN)SelectObject(hDC, SYSCOLOR_GetPen(COLOR_WINDOWFRAME));
hOldBrush =(HBRUSH)SelectObject(hDC,GetSysColorBrush(COLOR_BTNFACE)); hOldBrush =(HBRUSH)SelectObject(hDC,GetSysColorBrush(COLOR_BTNFACE));
oldBkMode = SetBkMode(hDC, TRANSPARENT); oldBkMode = SetBkMode(hDC, TRANSPARENT);
@ -972,7 +972,7 @@ static void GB_Paint( HWND hwnd, HDC hDC, UINT action )
GetClientRect( hwnd, &rc); GetClientRect( hwnd, &rc);
if (TWEAK_WineLook == WIN31_LOOK) { if (TWEAK_WineLook == WIN31_LOOK) {
HPEN hPrevPen = SelectObject( hDC, HPEN hPrevPen = SelectObject( hDC,
GetSysColorPen(COLOR_WINDOWFRAME)); SYSCOLOR_GetPen(COLOR_WINDOWFRAME));
HBRUSH hPrevBrush = SelectObject( hDC, HBRUSH hPrevBrush = SelectObject( hDC,
GetStockObject(NULL_BRUSH) ); GetStockObject(NULL_BRUSH) );

View File

@ -1027,7 +1027,7 @@ static LRESULT COMBO_Paint(LPHEADCOMBO lphc, HDC hParamDC)
*/ */
if (TWEAK_WineLook == WIN31_LOOK) if (TWEAK_WineLook == WIN31_LOOK)
{ {
HPEN hPrevPen = SelectObject( hDC, GetSysColorPen(COLOR_WINDOWFRAME) ); HPEN hPrevPen = SelectObject( hDC, SYSCOLOR_GetPen(COLOR_WINDOWFRAME) );
Rectangle( hDC, Rectangle( hDC,
lphc->textRect.left, lphc->textRect.top, lphc->textRect.left, lphc->textRect.top,

View File

@ -1218,7 +1218,7 @@ static void MENU_DrawMenuItem( HWND hwnd, HMENU hmenu, HWND hwndOwner, HDC hdc,
} }
else else
{ {
SelectObject( hdc, GetSysColorPen(COLOR_WINDOWFRAME) ); SelectObject( hdc, SYSCOLOR_GetPen(COLOR_WINDOWFRAME) );
MoveToEx( hdc, rect.left, 0, NULL ); MoveToEx( hdc, rect.left, 0, NULL );
LineTo( hdc, rect.left, height ); LineTo( hdc, rect.left, height );
} }
@ -1237,7 +1237,7 @@ static void MENU_DrawMenuItem( HWND hwnd, HMENU hmenu, HWND hwndOwner, HDC hdc,
} }
else else
{ {
SelectObject( hdc, GetSysColorPen(COLOR_WINDOWFRAME) ); SelectObject( hdc, SYSCOLOR_GetPen(COLOR_WINDOWFRAME) );
MoveToEx( hdc, rect.left, rect.top + SEPARATOR_HEIGHT/2, NULL ); MoveToEx( hdc, rect.left, rect.top + SEPARATOR_HEIGHT/2, NULL );
LineTo( hdc, rect.right, rect.top + SEPARATOR_HEIGHT/2 ); LineTo( hdc, rect.right, rect.top + SEPARATOR_HEIGHT/2 );
} }
@ -1280,7 +1280,7 @@ static void MENU_DrawMenuItem( HWND hwnd, HMENU hmenu, HWND hwndOwner, HDC hdc,
/* helper lines for debugging */ /* helper lines for debugging */
/* FrameRect(hdc, &rect, GetStockObject(BLACK_BRUSH)); /* FrameRect(hdc, &rect, GetStockObject(BLACK_BRUSH));
SelectObject( hdc, GetSysColorPen(COLOR_WINDOWFRAME) ); SelectObject( hdc, SYSCOLOR_GetPen(COLOR_WINDOWFRAME) );
MoveToEx( hdc, rect.left, (rect.top + rect.bottom)/2, NULL ); MoveToEx( hdc, rect.left, (rect.top + rect.bottom)/2, NULL );
LineTo( hdc, rect.right, (rect.top + rect.bottom)/2 ); LineTo( hdc, rect.right, (rect.top + rect.bottom)/2 );
*/ */
@ -1545,13 +1545,13 @@ UINT MENU_DrawMenuBar( HDC hDC, LPRECT lprect, HWND hwnd,
if (TWEAK_WineLook == WIN31_LOOK) if (TWEAK_WineLook == WIN31_LOOK)
{ {
SelectObject( hDC, GetSysColorPen(COLOR_WINDOWFRAME) ); SelectObject( hDC, SYSCOLOR_GetPen(COLOR_WINDOWFRAME) );
MoveToEx( hDC, lprect->left, lprect->bottom, NULL ); MoveToEx( hDC, lprect->left, lprect->bottom, NULL );
LineTo( hDC, lprect->right, lprect->bottom ); LineTo( hDC, lprect->right, lprect->bottom );
} }
else else
{ {
SelectObject( hDC, GetSysColorPen(COLOR_3DFACE)); SelectObject( hDC, SYSCOLOR_GetPen(COLOR_3DFACE));
MoveToEx( hDC, lprect->left, lprect->bottom, NULL ); MoveToEx( hDC, lprect->left, lprect->bottom, NULL );
LineTo( hDC, lprect->right, lprect->bottom ); LineTo( hDC, lprect->right, lprect->bottom );
} }

View File

@ -591,7 +591,7 @@ static void SCROLL_DrawInterior_9x( HWND hwnd, HDC hdc, INT nBar,
hBrush = DEFWND_ControlColor( hdc, CTLCOLOR_SCROLLBAR ); hBrush = DEFWND_ControlColor( hdc, CTLCOLOR_SCROLLBAR );
} }
hSavePen = SelectObject( hdc, GetSysColorPen(COLOR_WINDOWFRAME) ); hSavePen = SelectObject( hdc, SYSCOLOR_GetPen(COLOR_WINDOWFRAME) );
hSaveBrush = SelectObject( hdc, hBrush ); hSaveBrush = SelectObject( hdc, hBrush );
/* Calculate the scroll rectangle */ /* Calculate the scroll rectangle */
@ -692,7 +692,7 @@ static void SCROLL_DrawInterior( HWND hwnd, HDC hdc, INT nBar,
hBrush = DEFWND_ControlColor( hdc, CTLCOLOR_SCROLLBAR ); hBrush = DEFWND_ControlColor( hdc, CTLCOLOR_SCROLLBAR );
} }
} }
hSavePen = SelectObject( hdc, GetSysColorPen(COLOR_WINDOWFRAME) ); hSavePen = SelectObject( hdc, SYSCOLOR_GetPen(COLOR_WINDOWFRAME) );
hSaveBrush = SelectObject( hdc, hBrush ); hSaveBrush = SelectObject( hdc, hBrush );
/* Calculate the scroll rectangle */ /* Calculate the scroll rectangle */

View File

@ -179,8 +179,8 @@ static BOOL UITOOLS95_DrawDiagEdge(HDC hdc, LPRECT rc,
} }
} }
if(InnerI != -1) InnerPen = GetSysColorPen(InnerI); if(InnerI != -1) InnerPen = SYSCOLOR_GetPen(InnerI);
if(OuterI != -1) OuterPen = GetSysColorPen(OuterI); if(OuterI != -1) OuterPen = SYSCOLOR_GetPen(OuterI);
MoveToEx(hdc, 0, 0, &SavePoint); MoveToEx(hdc, 0, 0, &SavePoint);
@ -331,7 +331,7 @@ static BOOL UITOOLS95_DrawDiagEdge(HDC hdc, LPRECT rc,
HBRUSH hb = GetSysColorBrush(uFlags & BF_MONO ? COLOR_WINDOW HBRUSH hb = GetSysColorBrush(uFlags & BF_MONO ? COLOR_WINDOW
:COLOR_BTNFACE); :COLOR_BTNFACE);
HPEN hpsave; HPEN hpsave;
HPEN hp = GetSysColorPen(uFlags & BF_MONO ? COLOR_WINDOW HPEN hp = SYSCOLOR_GetPen(uFlags & BF_MONO ? COLOR_WINDOW
: COLOR_BTNFACE); : COLOR_BTNFACE);
hbsave = (HBRUSH)SelectObject(hdc, hb); hbsave = (HBRUSH)SelectObject(hdc, hb);
hpsave = (HPEN)SelectObject(hdc, hp); hpsave = (HPEN)SelectObject(hdc, hp);
@ -493,10 +493,10 @@ static BOOL UITOOLS95_DrawRectEdge(HDC hdc, LPRECT rc,
if((uFlags & BF_BOTTOMRIGHT) == BF_BOTTOMRIGHT) RBpenplus = 1; if((uFlags & BF_BOTTOMRIGHT) == BF_BOTTOMRIGHT) RBpenplus = 1;
if((uFlags & BF_TOPLEFT) == BF_TOPLEFT) LTpenplus = 1; if((uFlags & BF_TOPLEFT) == BF_TOPLEFT) LTpenplus = 1;
if(LTInnerI != -1) LTInnerPen = GetSysColorPen(LTInnerI); if(LTInnerI != -1) LTInnerPen = SYSCOLOR_GetPen(LTInnerI);
if(LTOuterI != -1) LTOuterPen = GetSysColorPen(LTOuterI); if(LTOuterI != -1) LTOuterPen = SYSCOLOR_GetPen(LTOuterI);
if(RBInnerI != -1) RBInnerPen = GetSysColorPen(RBInnerI); if(RBInnerI != -1) RBInnerPen = SYSCOLOR_GetPen(RBInnerI);
if(RBOuterI != -1) RBOuterPen = GetSysColorPen(RBOuterI); if(RBOuterI != -1) RBOuterPen = SYSCOLOR_GetPen(RBOuterI);
MoveToEx(hdc, 0, 0, &SavePoint); MoveToEx(hdc, 0, 0, &SavePoint);
@ -807,7 +807,7 @@ static BOOL UITOOLS95_DFC_ButtonRadio(HDC dc, LPRECT r, UINT uFlags)
{ {
if(uFlags & (DFCS_FLAT|DFCS_MONO)) if(uFlags & (DFCS_FLAT|DFCS_MONO))
{ {
hpsave = (HPEN)SelectObject(dc, GetSysColorPen(COLOR_WINDOWFRAME)); hpsave = (HPEN)SelectObject(dc, SYSCOLOR_GetPen(COLOR_WINDOWFRAME));
hbsave = (HBRUSH)SelectObject(dc, GetSysColorBrush(COLOR_WINDOWFRAME)); hbsave = (HBRUSH)SelectObject(dc, GetSysColorBrush(COLOR_WINDOWFRAME));
Ellipse(dc, myr.left, myr.top, myr.right, myr.bottom); Ellipse(dc, myr.left, myr.top, myr.right, myr.bottom);
SelectObject(dc, hbsave); SelectObject(dc, hbsave);
@ -815,11 +815,11 @@ static BOOL UITOOLS95_DFC_ButtonRadio(HDC dc, LPRECT r, UINT uFlags)
} }
else else
{ {
hpsave = (HPEN)SelectObject(dc, GetSysColorPen(COLOR_BTNHIGHLIGHT)); hpsave = (HPEN)SelectObject(dc, SYSCOLOR_GetPen(COLOR_BTNHIGHLIGHT));
hbsave = (HBRUSH)SelectObject(dc, GetSysColorBrush(COLOR_BTNHIGHLIGHT)); hbsave = (HBRUSH)SelectObject(dc, GetSysColorBrush(COLOR_BTNHIGHLIGHT));
Pie(dc, myr.left, myr.top, myr.right+1, myr.bottom+1, myr.left-1, myr.bottom, myr.right+1, myr.top); Pie(dc, myr.left, myr.top, myr.right+1, myr.bottom+1, myr.left-1, myr.bottom, myr.right+1, myr.top);
SelectObject(dc, GetSysColorPen(COLOR_BTNSHADOW)); SelectObject(dc, SYSCOLOR_GetPen(COLOR_BTNSHADOW));
SelectObject(dc, GetSysColorBrush(COLOR_BTNSHADOW)); SelectObject(dc, GetSysColorBrush(COLOR_BTNSHADOW));
Pie(dc, myr.left, myr.top, myr.right+1, myr.bottom+1, myr.right+1, myr.top, myr.left-1, myr.bottom); Pie(dc, myr.left, myr.top, myr.right+1, myr.bottom+1, myr.right+1, myr.top, myr.left-1, myr.bottom);
@ -828,11 +828,11 @@ static BOOL UITOOLS95_DFC_ButtonRadio(HDC dc, LPRECT r, UINT uFlags)
myr.top += BorderShrink; myr.top += BorderShrink;
myr.bottom -= BorderShrink; myr.bottom -= BorderShrink;
SelectObject(dc, GetSysColorPen(COLOR_3DLIGHT)); SelectObject(dc, SYSCOLOR_GetPen(COLOR_3DLIGHT));
SelectObject(dc, GetSysColorBrush(COLOR_3DLIGHT)); SelectObject(dc, GetSysColorBrush(COLOR_3DLIGHT));
Pie(dc, myr.left, myr.top, myr.right+1, myr.bottom+1, myr.left-1, myr.bottom, myr.right+1, myr.top); Pie(dc, myr.left, myr.top, myr.right+1, myr.bottom+1, myr.left-1, myr.bottom, myr.right+1, myr.top);
SelectObject(dc, GetSysColorPen(COLOR_3DDKSHADOW)); SelectObject(dc, SYSCOLOR_GetPen(COLOR_3DDKSHADOW));
SelectObject(dc, GetSysColorBrush(COLOR_3DDKSHADOW)); SelectObject(dc, GetSysColorBrush(COLOR_3DDKSHADOW));
Pie(dc, myr.left, myr.top, myr.right+1, myr.bottom+1, myr.right+1, myr.top, myr.left-1, myr.bottom); Pie(dc, myr.left, myr.top, myr.right+1, myr.bottom+1, myr.right+1, myr.top, myr.left-1, myr.bottom);
SelectObject(dc, hbsave); SelectObject(dc, hbsave);
@ -845,7 +845,7 @@ static BOOL UITOOLS95_DFC_ButtonRadio(HDC dc, LPRECT r, UINT uFlags)
myr.top = yc - i+i/2; myr.top = yc - i+i/2;
myr.bottom = yc + i/2; myr.bottom = yc + i/2;
i= !(uFlags & (DFCS_INACTIVE|DFCS_PUSHED)) ? COLOR_WINDOW : COLOR_BTNFACE; i= !(uFlags & (DFCS_INACTIVE|DFCS_PUSHED)) ? COLOR_WINDOW : COLOR_BTNFACE;
hpsave = (HPEN)SelectObject(dc, GetSysColorPen(i)); hpsave = (HPEN)SelectObject(dc, SYSCOLOR_GetPen(i));
hbsave = (HBRUSH)SelectObject(dc, GetSysColorBrush(i)); hbsave = (HBRUSH)SelectObject(dc, GetSysColorBrush(i));
Ellipse(dc, myr.left, myr.top, myr.right, myr.bottom); Ellipse(dc, myr.left, myr.top, myr.right, myr.bottom);
SelectObject(dc, hbsave); SelectObject(dc, hbsave);
@ -863,7 +863,7 @@ static BOOL UITOOLS95_DFC_ButtonRadio(HDC dc, LPRECT r, UINT uFlags)
i = uFlags & DFCS_INACTIVE ? COLOR_BTNSHADOW : COLOR_WINDOWTEXT; i = uFlags & DFCS_INACTIVE ? COLOR_BTNSHADOW : COLOR_WINDOWTEXT;
hbsave = (HBRUSH)SelectObject(dc, GetSysColorBrush(i)); hbsave = (HBRUSH)SelectObject(dc, GetSysColorBrush(i));
hpsave = (HPEN)SelectObject(dc, GetSysColorPen(i)); hpsave = (HPEN)SelectObject(dc, SYSCOLOR_GetPen(i));
Ellipse(dc, myr.left, myr.top, myr.right, myr.bottom); Ellipse(dc, myr.left, myr.top, myr.right, myr.bottom);
SelectObject(dc, hpsave); SelectObject(dc, hpsave);
SelectObject(dc, hbsave); SelectObject(dc, hbsave);
@ -965,7 +965,7 @@ static BOOL UITOOLS95_DrawFrameCaption(HDC dc, LPRECT r, UINT uFlags)
INT height = myr.bottom - myr.top - 6; INT height = myr.bottom - myr.top - 6;
INT numLines = (width / 6) + 1; INT numLines = (width / 6) + 1;
hpsave = (HPEN)SelectObject(dc, GetSysColorPen(colorIdx)); hpsave = (HPEN)SelectObject(dc, SYSCOLOR_GetPen(colorIdx));
start.x = myr.left + 2; start.x = myr.left + 2;
start.y = myr.top + 2; start.y = myr.top + 2;
@ -1090,7 +1090,7 @@ static BOOL UITOOLS95_DrawFrameCaption(HDC dc, LPRECT r, UINT uFlags)
{ {
/* If we have an inactive button, then you see a shadow */ /* If we have an inactive button, then you see a shadow */
hbsave = (HBRUSH)SelectObject(dc, GetSysColorBrush(COLOR_BTNHIGHLIGHT)); hbsave = (HBRUSH)SelectObject(dc, GetSysColorBrush(COLOR_BTNHIGHLIGHT));
hpsave = (HPEN)SelectObject(dc, GetSysColorPen(COLOR_BTNHIGHLIGHT)); hpsave = (HPEN)SelectObject(dc, SYSCOLOR_GetPen(COLOR_BTNHIGHLIGHT));
Polygon(dc, Line1, Line1N); Polygon(dc, Line1, Line1N);
if(Line2N > 0) if(Line2N > 0)
Polygon(dc, Line2, Line2N); Polygon(dc, Line2, Line2N);
@ -1115,7 +1115,7 @@ static BOOL UITOOLS95_DrawFrameCaption(HDC dc, LPRECT r, UINT uFlags)
/* Make the final picture */ /* Make the final picture */
hbsave = (HBRUSH)SelectObject(dc, GetSysColorBrush(colorIdx)); hbsave = (HBRUSH)SelectObject(dc, GetSysColorBrush(colorIdx));
hpsave = (HPEN)SelectObject(dc, GetSysColorPen(colorIdx)); hpsave = (HPEN)SelectObject(dc, SYSCOLOR_GetPen(colorIdx));
Polygon(dc, Line1, Line1N); Polygon(dc, Line1, Line1N);
if(Line2N > 0) if(Line2N > 0)
@ -1193,13 +1193,13 @@ static BOOL UITOOLS95_DrawFrameScroll(HDC dc, LPRECT r, UINT uFlags)
hbsave = (HBRUSH)SelectObject(dc, GetStockObject(NULL_BRUSH)); hbsave = (HBRUSH)SelectObject(dc, GetStockObject(NULL_BRUSH));
if(uFlags & (DFCS_MONO|DFCS_FLAT)) if(uFlags & (DFCS_MONO|DFCS_FLAT))
{ {
hp = hp2 = GetSysColorPen(COLOR_WINDOWFRAME); hp = hp2 = SYSCOLOR_GetPen(COLOR_WINDOWFRAME);
hb = hb2 = GetSysColorBrush(COLOR_WINDOWFRAME); hb = hb2 = GetSysColorBrush(COLOR_WINDOWFRAME);
} }
else else
{ {
hp = GetSysColorPen(COLOR_BTNHIGHLIGHT); hp = SYSCOLOR_GetPen(COLOR_BTNHIGHLIGHT);
hp2 = GetSysColorPen(COLOR_BTNSHADOW); hp2 = SYSCOLOR_GetPen(COLOR_BTNSHADOW);
hb = GetSysColorBrush(COLOR_BTNHIGHLIGHT); hb = GetSysColorBrush(COLOR_BTNHIGHLIGHT);
hb2 = GetSysColorBrush(COLOR_BTNSHADOW); hb2 = GetSysColorBrush(COLOR_BTNSHADOW);
} }
@ -1276,7 +1276,7 @@ static BOOL UITOOLS95_DrawFrameScroll(HDC dc, LPRECT r, UINT uFlags)
if(uFlags & DFCS_INACTIVE) if(uFlags & DFCS_INACTIVE)
{ {
hbsave = (HBRUSH)SelectObject(dc, GetSysColorBrush(COLOR_BTNHIGHLIGHT)); hbsave = (HBRUSH)SelectObject(dc, GetSysColorBrush(COLOR_BTNHIGHLIGHT));
hpsave = (HPEN)SelectObject(dc, GetSysColorPen(COLOR_BTNHIGHLIGHT)); hpsave = (HPEN)SelectObject(dc, SYSCOLOR_GetPen(COLOR_BTNHIGHLIGHT));
Polygon(dc, Line, 3); Polygon(dc, Line, 3);
SelectObject(dc, hpsave); SelectObject(dc, hpsave);
SelectObject(dc, hbsave); SelectObject(dc, hbsave);
@ -1291,7 +1291,7 @@ static BOOL UITOOLS95_DrawFrameScroll(HDC dc, LPRECT r, UINT uFlags)
i = uFlags & DFCS_INACTIVE ? COLOR_BTNSHADOW : COLOR_BTNTEXT; i = uFlags & DFCS_INACTIVE ? COLOR_BTNSHADOW : COLOR_BTNTEXT;
hbsave = (HBRUSH)SelectObject(dc, GetSysColorBrush(i)); hbsave = (HBRUSH)SelectObject(dc, GetSysColorBrush(i));
hpsave = (HPEN)SelectObject(dc, GetSysColorPen(i)); hpsave = (HPEN)SelectObject(dc, SYSCOLOR_GetPen(i));
Polygon(dc, Line, 3); Polygon(dc, Line, 3);
SelectObject(dc, hpsave); SelectObject(dc, hpsave);
SelectObject(dc, hbsave); SelectObject(dc, hbsave);

View File

@ -79,14 +79,15 @@ static void
PAGER_DrawHorzArrow (HDC hdc, RECT r, INT colorRef, BOOL left) PAGER_DrawHorzArrow (HDC hdc, RECT r, INT colorRef, BOOL left)
{ {
INT x, y, w, h; INT x, y, w, h;
HPEN hOldPen; HPEN hPen, hOldPen;
w = r.right - r.left + 1; w = r.right - r.left + 1;
h = r.bottom - r.top + 1; h = r.bottom - r.top + 1;
if ((h < MIN_ARROW_WIDTH) || (w < MIN_ARROW_HEIGHT)) if ((h < MIN_ARROW_WIDTH) || (w < MIN_ARROW_HEIGHT))
return; /* refuse to draw partial arrow */ return; /* refuse to draw partial arrow */
hOldPen = SelectObject ( hdc, GetSysColorPen (colorRef)); if (!(hPen = CreatePen( PS_SOLID, 1, GetSysColor( colorRef )))) return;
hOldPen = SelectObject ( hdc, hPen );
if (left) if (left)
{ {
x = r.left + ((w - MIN_ARROW_HEIGHT) / 2) + 3; x = r.left + ((w - MIN_ARROW_HEIGHT) / 2) + 3;
@ -111,6 +112,7 @@ PAGER_DrawHorzArrow (HDC hdc, RECT r, INT colorRef, BOOL left)
} }
SelectObject( hdc, hOldPen ); SelectObject( hdc, hOldPen );
DeleteObject( hPen );
} }
/* the vertical arrows are: /* the vertical arrows are:
@ -126,14 +128,15 @@ static void
PAGER_DrawVertArrow (HDC hdc, RECT r, INT colorRef, BOOL up) PAGER_DrawVertArrow (HDC hdc, RECT r, INT colorRef, BOOL up)
{ {
INT x, y, w, h; INT x, y, w, h;
HPEN hOldPen; HPEN hPen, hOldPen;
w = r.right - r.left + 1; w = r.right - r.left + 1;
h = r.bottom - r.top + 1; h = r.bottom - r.top + 1;
if ((h < MIN_ARROW_WIDTH) || (w < MIN_ARROW_HEIGHT)) if ((h < MIN_ARROW_WIDTH) || (w < MIN_ARROW_HEIGHT))
return; /* refuse to draw partial arrow */ return; /* refuse to draw partial arrow */
hOldPen = SelectObject ( hdc, GetSysColorPen (colorRef)); if (!(hPen = CreatePen( PS_SOLID, 1, GetSysColor( colorRef )))) return;
hOldPen = SelectObject ( hdc, hPen );
if (up) if (up)
{ {
x = r.left + ((w - MIN_ARROW_HEIGHT) / 2) + 1; x = r.left + ((w - MIN_ARROW_HEIGHT) / 2) + 1;
@ -158,6 +161,7 @@ PAGER_DrawVertArrow (HDC hdc, RECT r, INT colorRef, BOOL up)
} }
SelectObject( hdc, hOldPen ); SelectObject( hdc, hOldPen );
DeleteObject( hPen );
} }
static void static void

View File

@ -82,7 +82,7 @@ static inline LPCSTR debugstr_t(LPCWSTR text, BOOL isW)
static void static void
STATUSBAR_DrawSizeGrip (HDC hdc, LPRECT lpRect) STATUSBAR_DrawSizeGrip (HDC hdc, LPRECT lpRect)
{ {
HPEN hOldPen; HPEN hPenFace, hPenShadow, hPenHighlight, hOldPen;
POINT pt; POINT pt;
INT i; INT i;
@ -91,7 +91,8 @@ STATUSBAR_DrawSizeGrip (HDC hdc, LPRECT lpRect)
pt.x = lpRect->right - 1; pt.x = lpRect->right - 1;
pt.y = lpRect->bottom - 1; pt.y = lpRect->bottom - 1;
hOldPen = SelectObject (hdc, GetSysColorPen (COLOR_3DFACE)); hPenFace = CreatePen( PS_SOLID, 1, GetSysColor( COLOR_3DFACE ));
hOldPen = SelectObject( hdc, hPenFace );
MoveToEx (hdc, pt.x - 12, pt.y, NULL); MoveToEx (hdc, pt.x - 12, pt.y, NULL);
LineTo (hdc, pt.x, pt.y); LineTo (hdc, pt.x, pt.y);
LineTo (hdc, pt.x, pt.y - 13); LineTo (hdc, pt.x, pt.y - 13);
@ -99,7 +100,8 @@ STATUSBAR_DrawSizeGrip (HDC hdc, LPRECT lpRect)
pt.x--; pt.x--;
pt.y--; pt.y--;
SelectObject (hdc, GetSysColorPen (COLOR_3DSHADOW)); hPenShadow = CreatePen( PS_SOLID, 1, GetSysColor( COLOR_3DSHADOW ));
SelectObject( hdc, hPenShadow );
for (i = 1; i < 11; i += 4) { for (i = 1; i < 11; i += 4) {
MoveToEx (hdc, pt.x - i, pt.y, NULL); MoveToEx (hdc, pt.x - i, pt.y, NULL);
LineTo (hdc, pt.x + 1, pt.y - i - 1); LineTo (hdc, pt.x + 1, pt.y - i - 1);
@ -108,13 +110,17 @@ STATUSBAR_DrawSizeGrip (HDC hdc, LPRECT lpRect)
LineTo (hdc, pt.x + 1, pt.y - i - 2); LineTo (hdc, pt.x + 1, pt.y - i - 2);
} }
SelectObject (hdc, GetSysColorPen (COLOR_3DHIGHLIGHT)); hPenHighlight = CreatePen( PS_SOLID, 1, GetSysColor( COLOR_3DHIGHLIGHT ));
SelectObject( hdc, hPenHighlight );
for (i = 3; i < 13; i += 4) { for (i = 3; i < 13; i += 4) {
MoveToEx (hdc, pt.x - i, pt.y, NULL); MoveToEx (hdc, pt.x - i, pt.y, NULL);
LineTo (hdc, pt.x + 1, pt.y - i - 1); LineTo (hdc, pt.x + 1, pt.y - i - 1);
} }
SelectObject (hdc, hOldPen); SelectObject (hdc, hOldPen);
DeleteObject( hPenFace );
DeleteObject( hPenShadow );
DeleteObject( hPenHighlight );
} }

View File

@ -1317,7 +1317,7 @@ TAB_DrawItemInterior
RECT localRect; RECT localRect;
HPEN htextPen = GetSysColorPen (COLOR_BTNTEXT); HPEN htextPen;
HPEN holdPen; HPEN holdPen;
INT oldBkMode; INT oldBkMode;
@ -1368,6 +1368,7 @@ TAB_DrawItemInterior
/* /*
* Text pen * Text pen
*/ */
htextPen = CreatePen( PS_SOLID, 1, GetSysColor(COLOR_BTNTEXT) );
holdPen = SelectObject(hdc, htextPen); holdPen = SelectObject(hdc, htextPen);
oldBkMode = SetBkMode(hdc, TRANSPARENT); oldBkMode = SetBkMode(hdc, TRANSPARENT);
@ -1603,6 +1604,7 @@ TAB_DrawItemInterior
*/ */
SetBkMode(hdc, oldBkMode); SetBkMode(hdc, oldBkMode);
SelectObject(hdc, holdPen); SelectObject(hdc, holdPen);
DeleteObject( htextPen );
} }
/****************************************************************************** /******************************************************************************
@ -1634,9 +1636,9 @@ static void TAB_DrawItem(
if (isVisible) if (isVisible)
{ {
HBRUSH hbr = CreateSolidBrush (GetSysColor(COLOR_BTNFACE)); HBRUSH hbr = CreateSolidBrush (GetSysColor(COLOR_BTNFACE));
HPEN hwPen = GetSysColorPen (COLOR_3DHILIGHT); HPEN hwPen = CreatePen( PS_SOLID, 1, GetSysColor(COLOR_3DHILIGHT) );
HPEN hbPen = GetSysColorPen (COLOR_3DDKSHADOW); HPEN hbPen = CreatePen( PS_SOLID, 1, GetSysColor(COLOR_3DDKSHADOW) );
HPEN hShade = GetSysColorPen (COLOR_BTNSHADOW); HPEN hShade = CreatePen( PS_SOLID, 1, GetSysColor(COLOR_BTNSHADOW) );
HPEN holdPen; HPEN holdPen;
BOOL deleteBrush = TRUE; BOOL deleteBrush = TRUE;
@ -1885,6 +1887,9 @@ static void TAB_DrawItem(
/* Cleanup */ /* Cleanup */
SelectObject(hdc, holdPen); SelectObject(hdc, holdPen);
DeleteObject( hwPen );
DeleteObject( hbPen );
DeleteObject( hShade );
if (deleteBrush) DeleteObject(hbr); if (deleteBrush) DeleteObject(hbr);
} }
} }
@ -1899,9 +1904,9 @@ static void TAB_DrawBorder (HWND hwnd, HDC hdc)
{ {
TAB_INFO *infoPtr = TAB_GetInfoPtr(hwnd); TAB_INFO *infoPtr = TAB_GetInfoPtr(hwnd);
HPEN htmPen; HPEN htmPen;
HPEN hwPen = GetSysColorPen (COLOR_3DHILIGHT); HPEN hwPen = CreatePen( PS_SOLID, 1, GetSysColor(COLOR_3DHILIGHT) );
HPEN hbPen = GetSysColorPen (COLOR_3DDKSHADOW); HPEN hbPen = CreatePen( PS_SOLID, 1, GetSysColor(COLOR_3DDKSHADOW) );
HPEN hShade = GetSysColorPen (COLOR_BTNSHADOW); HPEN hShade = CreatePen( PS_SOLID, 1, GetSysColor(COLOR_BTNSHADOW) );
RECT rect; RECT rect;
DWORD lStyle = GetWindowLongA(hwnd, GWL_STYLE); DWORD lStyle = GetWindowLongA(hwnd, GWL_STYLE);
@ -1957,6 +1962,9 @@ static void TAB_DrawBorder (HWND hwnd, HDC hdc)
LineTo (hdc, rect.left, rect.bottom - 1); LineTo (hdc, rect.left, rect.bottom - 1);
SelectObject(hdc, htmPen); SelectObject(hdc, htmPen);
DeleteObject( hwPen );
DeleteObject( hbPen );
DeleteObject( hShade );
} }
/****************************************************************************** /******************************************************************************

View File

@ -467,7 +467,10 @@ static void
TOOLBAR_DrawArrow (HDC hdc, INT left, INT top, INT colorRef) TOOLBAR_DrawArrow (HDC hdc, INT left, INT top, INT colorRef)
{ {
INT x, y; INT x, y;
SelectObject ( hdc, GetSysColorPen (colorRef)); HPEN hPen, hOldPen;
if (!(hPen = CreatePen( PS_SOLID, 1, GetSysColor( colorRef )))) return;
hOldPen = SelectObject ( hdc, hPen );
x = left + 2; x = left + 2;
y = top + 8; y = top + 8;
MoveToEx (hdc, x, y, NULL); MoveToEx (hdc, x, y, NULL);
@ -476,6 +479,8 @@ TOOLBAR_DrawArrow (HDC hdc, INT left, INT top, INT colorRef)
LineTo (hdc, x+3, y++); x++; LineTo (hdc, x+3, y++); x++;
MoveToEx (hdc, x, y, NULL); MoveToEx (hdc, x, y, NULL);
LineTo (hdc, x+1, y++); LineTo (hdc, x+1, y++);
SelectObject( hdc, hOldPen );
DeleteObject( hPen );
} }
/* /*
@ -1986,7 +1991,7 @@ TOOLBAR_CustomizeDialogProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
LPDRAWITEMSTRUCT lpdis = (LPDRAWITEMSTRUCT)lParam; LPDRAWITEMSTRUCT lpdis = (LPDRAWITEMSTRUCT)lParam;
RECT rcButton; RECT rcButton;
RECT rcText; RECT rcText;
HPEN hOldPen; HPEN hPen, hOldPen;
HBRUSH hOldBrush; HBRUSH hOldBrush;
COLORREF oldText = 0; COLORREF oldText = 0;
COLORREF oldBk = 0; COLORREF oldBk = 0;
@ -2005,7 +2010,9 @@ TOOLBAR_CustomizeDialogProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
oldText = SetTextColor (lpdis->hDC, comctl32_color.clrGrayText); oldText = SetTextColor (lpdis->hDC, comctl32_color.clrGrayText);
else else
oldText = SetTextColor (lpdis->hDC, (lpdis->itemState & ODS_FOCUS)?comctl32_color.clrHighlightText:comctl32_color.clrWindowText); oldText = SetTextColor (lpdis->hDC, (lpdis->itemState & ODS_FOCUS)?comctl32_color.clrHighlightText:comctl32_color.clrWindowText);
hOldPen = SelectObject (lpdis->hDC, GetSysColorPen ((lpdis->itemState & ODS_SELECTED)?COLOR_HIGHLIGHT:COLOR_WINDOW)); hPen = CreatePen( PS_SOLID, 1,
GetSysColor( (lpdis->itemState & ODS_SELECTED)?COLOR_HIGHLIGHT:COLOR_WINDOW));
hOldPen = SelectObject (lpdis->hDC, hPen );
hOldBrush = SelectObject (lpdis->hDC, GetSysColorBrush ((lpdis->itemState & ODS_FOCUS)?COLOR_HIGHLIGHT:COLOR_WINDOW)); hOldBrush = SelectObject (lpdis->hDC, GetSysColorBrush ((lpdis->itemState & ODS_FOCUS)?COLOR_HIGHLIGHT:COLOR_WINDOW));
/* fill background rectangle */ /* fill background rectangle */
@ -2038,7 +2045,7 @@ TOOLBAR_CustomizeDialogProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
SelectObject (lpdis->hDC, hOldPen); SelectObject (lpdis->hDC, hOldPen);
SetBkColor (lpdis->hDC, oldBk); SetBkColor (lpdis->hDC, oldBk);
SetTextColor (lpdis->hDC, oldText); SetTextColor (lpdis->hDC, oldText);
DeleteObject( hPen );
return TRUE; return TRUE;
} }
return FALSE; return FALSE;

View File

@ -675,6 +675,5 @@ init UserClientDllInitialize
################################################################ ################################################################
# Wine extensions: extra useful functions not exported under Windows # Wine extensions: extra useful functions not exported under Windows
# #
@ stdcall GetSysColorPen(long) GetSysColorPen
@ stdcall wvsnprintfA(ptr long str ptr) wvsnprintfA @ stdcall wvsnprintfA(ptr long str ptr) wvsnprintfA
@ stdcall wvsnprintfW(ptr long wstr ptr) wvsnprintfW @ stdcall wvsnprintfW(ptr long wstr ptr) wvsnprintfW

View File

@ -132,6 +132,9 @@ extern WINE_LOOK TWEAK_WineLook;
/* gray brush cache */ /* gray brush cache */
extern HBRUSH CACHE_GetPattern55AABrush(void); extern HBRUSH CACHE_GetPattern55AABrush(void);
/* syscolor.c */
extern HPEN SYSCOLOR_GetPen( INT index );
extern DWORD USER16_AlertableWait; extern DWORD USER16_AlertableWait;
#endif /* __WINE_USER_H */ #endif /* __WINE_USER_H */

View File

@ -4243,7 +4243,6 @@ HRESULT WINAPI PrivateExtractIconsW(LPCWSTR,INT,DWORD,DWORD,HICON*,DWORD,UIN
/* Extra functions that don't exist in the Windows API */ /* Extra functions that don't exist in the Windows API */
HPEN WINAPI GetSysColorPen(INT);
INT WINAPI wvsnprintfA(LPSTR,UINT,LPCSTR,va_list); INT WINAPI wvsnprintfA(LPSTR,UINT,LPCSTR,va_list);
INT WINAPI wvsnprintfW(LPWSTR,UINT,LPCWSTR,va_list); INT WINAPI wvsnprintfW(LPWSTR,UINT,LPCWSTR,va_list);
#define wvsnprintf WINELIB_NAME_AW(wvsnprintf) #define wvsnprintf WINELIB_NAME_AW(wvsnprintf)

View File

@ -1313,7 +1313,7 @@ static void NC_DrawCaption95(
HPEN hPrevPen; HPEN hPrevPen;
HMENU hSysMenu; HMENU hSysMenu;
hPrevPen = SelectObject( hdc, GetSysColorPen( hPrevPen = SelectObject( hdc, SYSCOLOR_GetPen(
((exStyle & (WS_EX_STATICEDGE|WS_EX_CLIENTEDGE| ((exStyle & (WS_EX_STATICEDGE|WS_EX_CLIENTEDGE|
WS_EX_DLGMODALFRAME)) == WS_EX_STATICEDGE) ? WS_EX_DLGMODALFRAME)) == WS_EX_STATICEDGE) ?
COLOR_WINDOWFRAME : COLOR_3DFACE) ); COLOR_WINDOWFRAME : COLOR_3DFACE) );
@ -1427,7 +1427,7 @@ static void NC_DoNCPaint( HWND hwnd, HRGN clip, BOOL suppress_menupaint )
rect.right = rectWindow.right - rectWindow.left; rect.right = rectWindow.right - rectWindow.left;
rect.bottom = rectWindow.bottom - rectWindow.top; rect.bottom = rectWindow.bottom - rectWindow.top;
SelectObject( hdc, GetSysColorPen(COLOR_WINDOWFRAME) ); SelectObject( hdc, SYSCOLOR_GetPen(COLOR_WINDOWFRAME) );
if (HAS_ANYFRAME( dwStyle, dwExStyle )) if (HAS_ANYFRAME( dwStyle, dwExStyle ))
{ {
@ -1568,7 +1568,7 @@ static void NC_DoNCPaint95(
rectClip = rect; rectClip = rect;
} }
SelectObject( hdc, GetSysColorPen(COLOR_WINDOWFRAME) ); SelectObject( hdc, SYSCOLOR_GetPen(COLOR_WINDOWFRAME) );
if (HAS_STATICOUTERFRAME(dwStyle, dwExStyle)) { if (HAS_STATICOUTERFRAME(dwStyle, dwExStyle)) {
DrawEdge (hdc, &rect, BDR_SUNKENOUTER, BF_RECT | BF_ADJUST); DrawEdge (hdc, &rect, BDR_SUNKENOUTER, BF_RECT | BF_ADJUST);

View File

@ -386,13 +386,9 @@ HBRUSH WINAPI GetSysColorBrush( INT index )
/*********************************************************************** /***********************************************************************
* GetSysColorPen (USER32.@) (Not a Windows API) * SYSCOLOR_GetPen
*
* This function is new to the Wine lib -- it does not exist in
* Windows. However, it is a natural complement for GetSysColorBrush
* in the Win32 API and is needed quite a bit inside Wine.
*/ */
HPEN WINAPI GetSysColorPen( INT index ) HPEN SYSCOLOR_GetPen( INT index )
{ {
/* We can assert here, because this function is internal to Wine */ /* We can assert here, because this function is internal to Wine */
assert (0 <= index && index < NUM_SYS_COLORS); assert (0 <= index && index < NUM_SYS_COLORS);