From 16e9237a8c027aa06d31c7d624c286d76c8e5a95 Mon Sep 17 00:00:00 2001 From: Alexandre Julliard Date: Thu, 18 May 2000 00:12:23 +0000 Subject: [PATCH] Francois Boisvert System icons in the small caption bars are displayed with the right size. --- windows/nonclient.c | 44 ++++++++++++++++++++++++++++++++------------ 1 file changed, 32 insertions(+), 12 deletions(-) diff --git a/windows/nonclient.c b/windows/nonclient.c index c5308179c5b..8fc3eb0b3f4 100644 --- a/windows/nonclient.c +++ b/windows/nonclient.c @@ -1127,21 +1127,41 @@ static void NC_DrawCloseButton95 (HWND hwnd, HDC hdc, BOOL down, BOOL bGrayed) NC_GetInsideRect95( hwnd, &rect ); - hdcMem = CreateCompatibleDC( hdc ); - hBmp = down ? hbitmapCloseD : hbitmapClose; - hOldBmp = SelectObject (hdcMem, hBmp); - GetObjectA (hBmp, sizeof(BITMAP), &bmp); + /* A tool window has a smaller Close button */ + if(wndPtr->dwExStyle & WS_EX_TOOLWINDOW) + { + RECT toolRect; + INT iBmpHeight = 11; /* Windows does not use SM_CXSMSIZE and SM_CYSMSIZE */ + INT iBmpWidth = 11; /* it uses 11x11 for the close button in tool window */ + INT iCaptionHeight = GetSystemMetrics(SM_CYSMCAPTION); - BitBlt (hdc, rect.right - (GetSystemMetrics(SM_CYCAPTION) + 1 + bmp.bmWidth) / 2, - rect.top + (GetSystemMetrics(SM_CYCAPTION) - 1 - bmp.bmHeight) / 2, - bmp.bmWidth, bmp.bmHeight, hdcMem, 0, 0, SRCCOPY); + toolRect.top = rect.top + (iCaptionHeight - 1 - iBmpHeight) / 2; + toolRect.left = rect.right - (iCaptionHeight + 1 + iBmpWidth) / 2; + toolRect.bottom = toolRect.top + iBmpHeight; + toolRect.right = toolRect.left + iBmpWidth; + DrawFrameControl(hdc,&toolRect, + DFC_CAPTION,DFCS_CAPTIONCLOSE | + down ? DFCS_PUSHED : 0 | + bGrayed ? DFCS_INACTIVE : 0); + } + else + { + hdcMem = CreateCompatibleDC( hdc ); + hBmp = down ? hbitmapCloseD : hbitmapClose; + hOldBmp = SelectObject (hdcMem, hBmp); + GetObjectA (hBmp, sizeof(BITMAP), &bmp); - if(bGrayed) - NC_DrawGrayButton(hdc,rect.right - (GetSystemMetrics(SM_CYCAPTION) + 1 + bmp.bmWidth) / 2 + 2, - rect.top + (GetSystemMetrics(SM_CYCAPTION) - 1 - bmp.bmHeight) / 2 + 2); + BitBlt (hdc, rect.right - (GetSystemMetrics(SM_CYCAPTION) + 1 + bmp.bmWidth) / 2, + rect.top + (GetSystemMetrics(SM_CYCAPTION) - 1 - bmp.bmHeight) / 2, + bmp.bmWidth, bmp.bmHeight, hdcMem, 0, 0, SRCCOPY); - SelectObject (hdcMem, hOldBmp); - DeleteDC (hdcMem); + if(bGrayed) + NC_DrawGrayButton(hdc,rect.right - (GetSystemMetrics(SM_CYCAPTION) + 1 + bmp.bmWidth) / 2 + 2, + rect.top + (GetSystemMetrics(SM_CYCAPTION) - 1 - bmp.bmHeight) / 2 + 2); + + SelectObject (hdcMem, hOldBmp); + DeleteDC (hdcMem); + } } WIN_ReleaseWndPtr(wndPtr); }