From 4344c368cb2646dea1e7acdac6e9e999f8b383c1 Mon Sep 17 00:00:00 2001 From: Alexandre Julliard Date: Mon, 20 May 2002 18:15:28 +0000 Subject: [PATCH] Got rid of GetSysColorPen. --- controls/button.c | 4 ++-- controls/combo.c | 2 +- controls/menu.c | 10 +++++----- controls/scroll.c | 4 ++-- controls/uitools.c | 44 ++++++++++++++++++++--------------------- dlls/comctl32/pager.c | 16 +++++++++------ dlls/comctl32/status.c | 16 ++++++++++----- dlls/comctl32/tab.c | 22 ++++++++++++++------- dlls/comctl32/toolbar.c | 15 ++++++++++---- dlls/user/user32.spec | 1 - include/user.h | 3 +++ include/winuser.h | 1 - windows/nonclient.c | 6 +++--- windows/syscolor.c | 8 ++------ 14 files changed, 87 insertions(+), 65 deletions(-) diff --git a/controls/button.c b/controls/button.c index c99512f8554..7aa1854088f 100644 --- a/controls/button.c +++ b/controls/button.c @@ -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) */ if ((hFont = get_button_font( hwnd ))) SelectObject( hDC, hFont ); 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)); oldBkMode = SetBkMode(hDC, TRANSPARENT); @@ -972,7 +972,7 @@ static void GB_Paint( HWND hwnd, HDC hDC, UINT action ) GetClientRect( hwnd, &rc); if (TWEAK_WineLook == WIN31_LOOK) { HPEN hPrevPen = SelectObject( hDC, - GetSysColorPen(COLOR_WINDOWFRAME)); + SYSCOLOR_GetPen(COLOR_WINDOWFRAME)); HBRUSH hPrevBrush = SelectObject( hDC, GetStockObject(NULL_BRUSH) ); diff --git a/controls/combo.c b/controls/combo.c index 3c29b6691bb..bfb6fa4462e 100644 --- a/controls/combo.c +++ b/controls/combo.c @@ -1027,7 +1027,7 @@ static LRESULT COMBO_Paint(LPHEADCOMBO lphc, HDC hParamDC) */ if (TWEAK_WineLook == WIN31_LOOK) { - HPEN hPrevPen = SelectObject( hDC, GetSysColorPen(COLOR_WINDOWFRAME) ); + HPEN hPrevPen = SelectObject( hDC, SYSCOLOR_GetPen(COLOR_WINDOWFRAME) ); Rectangle( hDC, lphc->textRect.left, lphc->textRect.top, diff --git a/controls/menu.c b/controls/menu.c index dcbdc17eeff..f5a66834575 100644 --- a/controls/menu.c +++ b/controls/menu.c @@ -1218,7 +1218,7 @@ static void MENU_DrawMenuItem( HWND hwnd, HMENU hmenu, HWND hwndOwner, HDC hdc, } else { - SelectObject( hdc, GetSysColorPen(COLOR_WINDOWFRAME) ); + SelectObject( hdc, SYSCOLOR_GetPen(COLOR_WINDOWFRAME) ); MoveToEx( hdc, rect.left, 0, NULL ); LineTo( hdc, rect.left, height ); } @@ -1237,7 +1237,7 @@ static void MENU_DrawMenuItem( HWND hwnd, HMENU hmenu, HWND hwndOwner, HDC hdc, } else { - SelectObject( hdc, GetSysColorPen(COLOR_WINDOWFRAME) ); + SelectObject( hdc, SYSCOLOR_GetPen(COLOR_WINDOWFRAME) ); MoveToEx( hdc, rect.left, rect.top + SEPARATOR_HEIGHT/2, NULL ); 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 */ /* 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 ); 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) { - SelectObject( hDC, GetSysColorPen(COLOR_WINDOWFRAME) ); + SelectObject( hDC, SYSCOLOR_GetPen(COLOR_WINDOWFRAME) ); MoveToEx( hDC, lprect->left, lprect->bottom, NULL ); LineTo( hDC, lprect->right, lprect->bottom ); } else { - SelectObject( hDC, GetSysColorPen(COLOR_3DFACE)); + SelectObject( hDC, SYSCOLOR_GetPen(COLOR_3DFACE)); MoveToEx( hDC, lprect->left, lprect->bottom, NULL ); LineTo( hDC, lprect->right, lprect->bottom ); } diff --git a/controls/scroll.c b/controls/scroll.c index 7e5c56e3fd1..9ae664d4c2f 100644 --- a/controls/scroll.c +++ b/controls/scroll.c @@ -591,7 +591,7 @@ static void SCROLL_DrawInterior_9x( HWND hwnd, HDC hdc, INT nBar, hBrush = DEFWND_ControlColor( hdc, CTLCOLOR_SCROLLBAR ); } - hSavePen = SelectObject( hdc, GetSysColorPen(COLOR_WINDOWFRAME) ); + hSavePen = SelectObject( hdc, SYSCOLOR_GetPen(COLOR_WINDOWFRAME) ); hSaveBrush = SelectObject( hdc, hBrush ); /* Calculate the scroll rectangle */ @@ -692,7 +692,7 @@ static void SCROLL_DrawInterior( HWND hwnd, HDC hdc, INT nBar, hBrush = DEFWND_ControlColor( hdc, CTLCOLOR_SCROLLBAR ); } } - hSavePen = SelectObject( hdc, GetSysColorPen(COLOR_WINDOWFRAME) ); + hSavePen = SelectObject( hdc, SYSCOLOR_GetPen(COLOR_WINDOWFRAME) ); hSaveBrush = SelectObject( hdc, hBrush ); /* Calculate the scroll rectangle */ diff --git a/controls/uitools.c b/controls/uitools.c index 7669246a8a5..68fb2f90d53 100644 --- a/controls/uitools.c +++ b/controls/uitools.c @@ -179,8 +179,8 @@ static BOOL UITOOLS95_DrawDiagEdge(HDC hdc, LPRECT rc, } } - if(InnerI != -1) InnerPen = GetSysColorPen(InnerI); - if(OuterI != -1) OuterPen = GetSysColorPen(OuterI); + if(InnerI != -1) InnerPen = SYSCOLOR_GetPen(InnerI); + if(OuterI != -1) OuterPen = SYSCOLOR_GetPen(OuterI); 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 :COLOR_BTNFACE); HPEN hpsave; - HPEN hp = GetSysColorPen(uFlags & BF_MONO ? COLOR_WINDOW + HPEN hp = SYSCOLOR_GetPen(uFlags & BF_MONO ? COLOR_WINDOW : COLOR_BTNFACE); hbsave = (HBRUSH)SelectObject(hdc, hb); 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_TOPLEFT) == BF_TOPLEFT) LTpenplus = 1; - if(LTInnerI != -1) LTInnerPen = GetSysColorPen(LTInnerI); - if(LTOuterI != -1) LTOuterPen = GetSysColorPen(LTOuterI); - if(RBInnerI != -1) RBInnerPen = GetSysColorPen(RBInnerI); - if(RBOuterI != -1) RBOuterPen = GetSysColorPen(RBOuterI); + if(LTInnerI != -1) LTInnerPen = SYSCOLOR_GetPen(LTInnerI); + if(LTOuterI != -1) LTOuterPen = SYSCOLOR_GetPen(LTOuterI); + if(RBInnerI != -1) RBInnerPen = SYSCOLOR_GetPen(RBInnerI); + if(RBOuterI != -1) RBOuterPen = SYSCOLOR_GetPen(RBOuterI); 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)) { - hpsave = (HPEN)SelectObject(dc, GetSysColorPen(COLOR_WINDOWFRAME)); + hpsave = (HPEN)SelectObject(dc, SYSCOLOR_GetPen(COLOR_WINDOWFRAME)); hbsave = (HBRUSH)SelectObject(dc, GetSysColorBrush(COLOR_WINDOWFRAME)); Ellipse(dc, myr.left, myr.top, myr.right, myr.bottom); SelectObject(dc, hbsave); @@ -815,11 +815,11 @@ static BOOL UITOOLS95_DFC_ButtonRadio(HDC dc, LPRECT r, UINT uFlags) } else { - hpsave = (HPEN)SelectObject(dc, GetSysColorPen(COLOR_BTNHIGHLIGHT)); + hpsave = (HPEN)SelectObject(dc, SYSCOLOR_GetPen(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); - SelectObject(dc, GetSysColorPen(COLOR_BTNSHADOW)); + SelectObject(dc, SYSCOLOR_GetPen(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); @@ -828,11 +828,11 @@ static BOOL UITOOLS95_DFC_ButtonRadio(HDC dc, LPRECT r, UINT uFlags) myr.top += BorderShrink; myr.bottom -= BorderShrink; - SelectObject(dc, GetSysColorPen(COLOR_3DLIGHT)); + SelectObject(dc, SYSCOLOR_GetPen(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); - SelectObject(dc, GetSysColorPen(COLOR_3DDKSHADOW)); + SelectObject(dc, SYSCOLOR_GetPen(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); 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.bottom = yc + i/2; 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)); Ellipse(dc, myr.left, myr.top, myr.right, myr.bottom); 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; 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); SelectObject(dc, hpsave); 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 numLines = (width / 6) + 1; - hpsave = (HPEN)SelectObject(dc, GetSysColorPen(colorIdx)); + hpsave = (HPEN)SelectObject(dc, SYSCOLOR_GetPen(colorIdx)); start.x = myr.left + 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 */ 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); if(Line2N > 0) Polygon(dc, Line2, Line2N); @@ -1115,7 +1115,7 @@ static BOOL UITOOLS95_DrawFrameCaption(HDC dc, LPRECT r, UINT uFlags) /* Make the final picture */ hbsave = (HBRUSH)SelectObject(dc, GetSysColorBrush(colorIdx)); - hpsave = (HPEN)SelectObject(dc, GetSysColorPen(colorIdx)); + hpsave = (HPEN)SelectObject(dc, SYSCOLOR_GetPen(colorIdx)); Polygon(dc, Line1, Line1N); if(Line2N > 0) @@ -1193,13 +1193,13 @@ static BOOL UITOOLS95_DrawFrameScroll(HDC dc, LPRECT r, UINT uFlags) hbsave = (HBRUSH)SelectObject(dc, GetStockObject(NULL_BRUSH)); if(uFlags & (DFCS_MONO|DFCS_FLAT)) { - hp = hp2 = GetSysColorPen(COLOR_WINDOWFRAME); + hp = hp2 = SYSCOLOR_GetPen(COLOR_WINDOWFRAME); hb = hb2 = GetSysColorBrush(COLOR_WINDOWFRAME); } else { - hp = GetSysColorPen(COLOR_BTNHIGHLIGHT); - hp2 = GetSysColorPen(COLOR_BTNSHADOW); + hp = SYSCOLOR_GetPen(COLOR_BTNHIGHLIGHT); + hp2 = SYSCOLOR_GetPen(COLOR_BTNSHADOW); hb = GetSysColorBrush(COLOR_BTNHIGHLIGHT); hb2 = GetSysColorBrush(COLOR_BTNSHADOW); } @@ -1276,7 +1276,7 @@ static BOOL UITOOLS95_DrawFrameScroll(HDC dc, LPRECT r, UINT uFlags) if(uFlags & DFCS_INACTIVE) { 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); SelectObject(dc, hpsave); 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; hbsave = (HBRUSH)SelectObject(dc, GetSysColorBrush(i)); - hpsave = (HPEN)SelectObject(dc, GetSysColorPen(i)); + hpsave = (HPEN)SelectObject(dc, SYSCOLOR_GetPen(i)); Polygon(dc, Line, 3); SelectObject(dc, hpsave); SelectObject(dc, hbsave); diff --git a/dlls/comctl32/pager.c b/dlls/comctl32/pager.c index 8d9b204d851..fa4a1bbea06 100644 --- a/dlls/comctl32/pager.c +++ b/dlls/comctl32/pager.c @@ -79,14 +79,15 @@ static void PAGER_DrawHorzArrow (HDC hdc, RECT r, INT colorRef, BOOL left) { INT x, y, w, h; - HPEN hOldPen; - + HPEN hPen, hOldPen; + w = r.right - r.left + 1; h = r.bottom - r.top + 1; if ((h < MIN_ARROW_WIDTH) || (w < MIN_ARROW_HEIGHT)) 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) { 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 ); + DeleteObject( hPen ); } /* the vertical arrows are: @@ -126,14 +128,15 @@ static void PAGER_DrawVertArrow (HDC hdc, RECT r, INT colorRef, BOOL up) { INT x, y, w, h; - HPEN hOldPen; - + HPEN hPen, hOldPen; + w = r.right - r.left + 1; h = r.bottom - r.top + 1; if ((h < MIN_ARROW_WIDTH) || (w < MIN_ARROW_HEIGHT)) 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) { 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 ); + DeleteObject( hPen ); } static void diff --git a/dlls/comctl32/status.c b/dlls/comctl32/status.c index de632047aaf..e9d3c7aa4c3 100644 --- a/dlls/comctl32/status.c +++ b/dlls/comctl32/status.c @@ -82,7 +82,7 @@ static inline LPCSTR debugstr_t(LPCWSTR text, BOOL isW) static void STATUSBAR_DrawSizeGrip (HDC hdc, LPRECT lpRect) { - HPEN hOldPen; + HPEN hPenFace, hPenShadow, hPenHighlight, hOldPen; POINT pt; INT i; @@ -91,7 +91,8 @@ STATUSBAR_DrawSizeGrip (HDC hdc, LPRECT lpRect) pt.x = lpRect->right - 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); LineTo (hdc, pt.x, pt.y); LineTo (hdc, pt.x, pt.y - 13); @@ -99,7 +100,8 @@ STATUSBAR_DrawSizeGrip (HDC hdc, LPRECT lpRect) pt.x--; 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) { MoveToEx (hdc, pt.x - i, pt.y, NULL); 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); } - SelectObject (hdc, GetSysColorPen (COLOR_3DHIGHLIGHT)); + hPenHighlight = CreatePen( PS_SOLID, 1, GetSysColor( COLOR_3DHIGHLIGHT )); + SelectObject( hdc, hPenHighlight ); for (i = 3; i < 13; i += 4) { MoveToEx (hdc, pt.x - i, pt.y, NULL); LineTo (hdc, pt.x + 1, pt.y - i - 1); } - SelectObject (hdc, hOldPen); + SelectObject (hdc, hOldPen); + DeleteObject( hPenFace ); + DeleteObject( hPenShadow ); + DeleteObject( hPenHighlight ); } diff --git a/dlls/comctl32/tab.c b/dlls/comctl32/tab.c index 59e23f16ddf..dc2e7247f91 100644 --- a/dlls/comctl32/tab.c +++ b/dlls/comctl32/tab.c @@ -1317,7 +1317,7 @@ TAB_DrawItemInterior RECT localRect; - HPEN htextPen = GetSysColorPen (COLOR_BTNTEXT); + HPEN htextPen; HPEN holdPen; INT oldBkMode; @@ -1368,6 +1368,7 @@ TAB_DrawItemInterior /* * Text pen */ + htextPen = CreatePen( PS_SOLID, 1, GetSysColor(COLOR_BTNTEXT) ); holdPen = SelectObject(hdc, htextPen); oldBkMode = SetBkMode(hdc, TRANSPARENT); @@ -1603,6 +1604,7 @@ TAB_DrawItemInterior */ SetBkMode(hdc, oldBkMode); SelectObject(hdc, holdPen); + DeleteObject( htextPen ); } /****************************************************************************** @@ -1634,9 +1636,9 @@ static void TAB_DrawItem( if (isVisible) { HBRUSH hbr = CreateSolidBrush (GetSysColor(COLOR_BTNFACE)); - HPEN hwPen = GetSysColorPen (COLOR_3DHILIGHT); - HPEN hbPen = GetSysColorPen (COLOR_3DDKSHADOW); - HPEN hShade = GetSysColorPen (COLOR_BTNSHADOW); + HPEN hwPen = CreatePen( PS_SOLID, 1, GetSysColor(COLOR_3DHILIGHT) ); + HPEN hbPen = CreatePen( PS_SOLID, 1, GetSysColor(COLOR_3DDKSHADOW) ); + HPEN hShade = CreatePen( PS_SOLID, 1, GetSysColor(COLOR_BTNSHADOW) ); HPEN holdPen; BOOL deleteBrush = TRUE; @@ -1885,6 +1887,9 @@ static void TAB_DrawItem( /* Cleanup */ SelectObject(hdc, holdPen); + DeleteObject( hwPen ); + DeleteObject( hbPen ); + DeleteObject( hShade ); if (deleteBrush) DeleteObject(hbr); } } @@ -1899,9 +1904,9 @@ static void TAB_DrawBorder (HWND hwnd, HDC hdc) { TAB_INFO *infoPtr = TAB_GetInfoPtr(hwnd); HPEN htmPen; - HPEN hwPen = GetSysColorPen (COLOR_3DHILIGHT); - HPEN hbPen = GetSysColorPen (COLOR_3DDKSHADOW); - HPEN hShade = GetSysColorPen (COLOR_BTNSHADOW); + HPEN hwPen = CreatePen( PS_SOLID, 1, GetSysColor(COLOR_3DHILIGHT) ); + HPEN hbPen = CreatePen( PS_SOLID, 1, GetSysColor(COLOR_3DDKSHADOW) ); + HPEN hShade = CreatePen( PS_SOLID, 1, GetSysColor(COLOR_BTNSHADOW) ); RECT rect; 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); SelectObject(hdc, htmPen); + DeleteObject( hwPen ); + DeleteObject( hbPen ); + DeleteObject( hShade ); } /****************************************************************************** diff --git a/dlls/comctl32/toolbar.c b/dlls/comctl32/toolbar.c index e4f58ebb20a..9a7b03133f5 100644 --- a/dlls/comctl32/toolbar.c +++ b/dlls/comctl32/toolbar.c @@ -467,7 +467,10 @@ static void TOOLBAR_DrawArrow (HDC hdc, INT left, INT top, INT colorRef) { 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; y = top + 8; 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++; MoveToEx (hdc, x, y, NULL); 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; RECT rcButton; RECT rcText; - HPEN hOldPen; + HPEN hPen, hOldPen; HBRUSH hOldBrush; COLORREF oldText = 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); else 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)); /* fill background rectangle */ @@ -2038,7 +2045,7 @@ TOOLBAR_CustomizeDialogProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam) SelectObject (lpdis->hDC, hOldPen); SetBkColor (lpdis->hDC, oldBk); SetTextColor (lpdis->hDC, oldText); - + DeleteObject( hPen ); return TRUE; } return FALSE; diff --git a/dlls/user/user32.spec b/dlls/user/user32.spec index c941cfca5a2..003b6d99ded 100644 --- a/dlls/user/user32.spec +++ b/dlls/user/user32.spec @@ -675,6 +675,5 @@ init UserClientDllInitialize ################################################################ # Wine extensions: extra useful functions not exported under Windows # -@ stdcall GetSysColorPen(long) GetSysColorPen @ stdcall wvsnprintfA(ptr long str ptr) wvsnprintfA @ stdcall wvsnprintfW(ptr long wstr ptr) wvsnprintfW diff --git a/include/user.h b/include/user.h index 7cf9661523d..58b7b160cc6 100644 --- a/include/user.h +++ b/include/user.h @@ -132,6 +132,9 @@ extern WINE_LOOK TWEAK_WineLook; /* gray brush cache */ extern HBRUSH CACHE_GetPattern55AABrush(void); +/* syscolor.c */ +extern HPEN SYSCOLOR_GetPen( INT index ); + extern DWORD USER16_AlertableWait; #endif /* __WINE_USER_H */ diff --git a/include/winuser.h b/include/winuser.h index 0b0f5b9c435..5de2b961b2d 100644 --- a/include/winuser.h +++ b/include/winuser.h @@ -4243,7 +4243,6 @@ HRESULT WINAPI PrivateExtractIconsW(LPCWSTR,INT,DWORD,DWORD,HICON*,DWORD,UIN /* Extra functions that don't exist in the Windows API */ -HPEN WINAPI GetSysColorPen(INT); INT WINAPI wvsnprintfA(LPSTR,UINT,LPCSTR,va_list); INT WINAPI wvsnprintfW(LPWSTR,UINT,LPCWSTR,va_list); #define wvsnprintf WINELIB_NAME_AW(wvsnprintf) diff --git a/windows/nonclient.c b/windows/nonclient.c index 29c4552b5be..1ca2b336265 100644 --- a/windows/nonclient.c +++ b/windows/nonclient.c @@ -1313,7 +1313,7 @@ static void NC_DrawCaption95( HPEN hPrevPen; HMENU hSysMenu; - hPrevPen = SelectObject( hdc, GetSysColorPen( + hPrevPen = SelectObject( hdc, SYSCOLOR_GetPen( ((exStyle & (WS_EX_STATICEDGE|WS_EX_CLIENTEDGE| WS_EX_DLGMODALFRAME)) == WS_EX_STATICEDGE) ? 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.bottom = rectWindow.bottom - rectWindow.top; - SelectObject( hdc, GetSysColorPen(COLOR_WINDOWFRAME) ); + SelectObject( hdc, SYSCOLOR_GetPen(COLOR_WINDOWFRAME) ); if (HAS_ANYFRAME( dwStyle, dwExStyle )) { @@ -1568,7 +1568,7 @@ static void NC_DoNCPaint95( rectClip = rect; } - SelectObject( hdc, GetSysColorPen(COLOR_WINDOWFRAME) ); + SelectObject( hdc, SYSCOLOR_GetPen(COLOR_WINDOWFRAME) ); if (HAS_STATICOUTERFRAME(dwStyle, dwExStyle)) { DrawEdge (hdc, &rect, BDR_SUNKENOUTER, BF_RECT | BF_ADJUST); diff --git a/windows/syscolor.c b/windows/syscolor.c index 5f8be9c2959..83f838360ac 100644 --- a/windows/syscolor.c +++ b/windows/syscolor.c @@ -386,13 +386,9 @@ HBRUSH WINAPI GetSysColorBrush( INT index ) /*********************************************************************** - * GetSysColorPen (USER32.@) (Not a Windows API) - * - * 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. + * SYSCOLOR_GetPen */ -HPEN WINAPI GetSysColorPen( INT index ) +HPEN SYSCOLOR_GetPen( INT index ) { /* We can assert here, because this function is internal to Wine */ assert (0 <= index && index < NUM_SYS_COLORS);