Author: mkupfer
Date: Wed Mar 11 02:48:21 2009
New Revision: 39942
URL:
http://svn.reactos.org/svn/reactos?rev=39942&view=rev
Log:
- fix the bitmap and memdc issue for menu items (popup arrow, check and radio symbols)
Modified:
trunk/reactos/dll/win32/user32/windows/draw.c
trunk/reactos/dll/win32/user32/windows/menu.c
Modified: trunk/reactos/dll/win32/user32/windows/draw.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/user32/windows/d…
==============================================================================
--- trunk/reactos/dll/win32/user32/windows/draw.c [iso-8859-1] (original)
+++ trunk/reactos/dll/win32/user32/windows/draw.c [iso-8859-1] Wed Mar 11 02:48:21 2009
@@ -1048,8 +1048,6 @@
{
LOGFONT lf;
HFONT hFont, hOldFont;
- COLORREF clrsave;
- INT bkmode;
TCHAR Symbol;
switch(uFlags & 0xff)
{
@@ -1079,20 +1077,12 @@
lf.lfCharSet = DEFAULT_CHARSET;
lstrcpy(lf.lfFaceName, TEXT("Marlett"));
hFont = CreateFontIndirect(&lf);
- /* save font and text color */
+ /* save font */
hOldFont = SelectObject(dc, hFont);
- clrsave = GetTextColor(dc);
- bkmode = GetBkMode(dc);
- /* set color and drawing mode */
- SetBkMode(dc, TRANSPARENT);
- SetTextColor(dc, GetSysColor(COLOR_WINDOWTEXT));
- FillRect(dc, r, (HBRUSH)GetStockObject(WHITE_BRUSH));
/* draw selected symbol */
TextOut(dc, r->left, r->top, &Symbol, 1);
/* restore previous settings */
- SetTextColor(dc, clrsave);
SelectObject(dc, hOldFont);
- SetBkMode(dc, bkmode);
DeleteObject(hFont);
return TRUE;
}
Modified: trunk/reactos/dll/win32/user32/windows/menu.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/user32/windows/m…
==============================================================================
--- trunk/reactos/dll/win32/user32/windows/menu.c [iso-8859-1] (original)
+++ trunk/reactos/dll/win32/user32/windows/menu.c [iso-8859-1] Wed Mar 11 02:48:21 2009
@@ -605,22 +605,10 @@
/* Draw the popup-menu arrow */
if (0 != (Item->fType & MF_POPUP))
{
- INT y = Rect.top + Rect.bottom;
- UINT CheckBitmapWidth = GetSystemMetrics(SM_CXMENUCHECK);
- UINT CheckBitmapHeight = GetSystemMetrics(SM_CYMENUCHECK);
- RECT r;
- HBITMAP bm = CreateBitmap(CheckBitmapWidth, CheckBitmapHeight, 1, 1, NULL);
- HDC DcMem = CreateCompatibleDC(Dc);
- SelectObject(DcMem, bm);
- SetRect( &r, 0, 0, CheckBitmapWidth, CheckBitmapHeight);
- DrawFrameControl(DcMem, &r, DFC_MENU, DFCS_MENUARROW);
- BitBlt(Dc, Rect.right - CheckBitmapWidth, (y - r.bottom) / 2, r.right,
r.bottom, DcMem, 0, 0, SRCCOPY );
- DeleteDC(DcMem);
- DeleteObject(bm);
- /*
- SetRect(&r,Rect.right - CheckBitmapWidth, (y - CheckBitmapHeight) / 2,
Rect.right, Rect.bottom);
- DrawFrameControl(Dc, &r, DFC_MENU, DFCS_MENUARROW);
- */
+ RECT rectTemp;
+ CopyRect(&rectTemp, &Rect);
+ rectTemp.left = rectTemp.right - GetSystemMetrics(SM_CXMENUCHECK);
+ DrawFrameControl(Dc, &rectTemp, DFC_MENU, DFCS_MENUARROW);
}
return;
}
@@ -736,18 +724,12 @@
}
else if (0 != (Item->fState & MF_CHECKED)) /* standard bitmaps */
{
- RECT r;
- HBITMAP bm = CreateBitmap(CheckBitmapWidth, CheckBitmapHeight, 1, 1, NULL);
- HDC DcMem = CreateCompatibleDC(Dc);
- SelectObject(DcMem, bm);
- SetRect( &r, 0, 0, CheckBitmapWidth, CheckBitmapHeight);
- DrawFrameControl(DcMem, &r, DFC_MENU,
+ RECT rectTemp;
+ CopyRect(&rectTemp, &Rect);
+ rectTemp.right = rectTemp.left + GetSystemMetrics(SM_CXMENUCHECK);
+ DrawFrameControl(Dc, &rectTemp, DFC_MENU,
0 != (Item->fType & MFT_RADIOCHECK) ?
DFCS_MENUBULLET : DFCS_MENUCHECK);
- BitBlt(Dc, Rc.left, (y - r.bottom) / 2, r.right, r.bottom,
- DcMem, 0, 0, SRCCOPY );
- DeleteDC(DcMem);
- DeleteObject(bm);
checked = TRUE;
}
}
@@ -758,19 +740,10 @@
/* Draw the popup-menu arrow */
if (0 != (Item->fType & MF_POPUP))
{
- RECT r;
- HBITMAP bm = CreateBitmap(CheckBitmapWidth, CheckBitmapHeight, 1, 1, NULL);
- HDC DcMem = CreateCompatibleDC(Dc);
- SelectObject(DcMem, bm);
- SetRect( &r, 0, 0, CheckBitmapWidth, CheckBitmapHeight);
- DrawFrameControl(DcMem, &r, DFC_MENU, DFCS_MENUARROW);
- BitBlt(Dc, Rect.right - CheckBitmapWidth, (y - r.bottom) / 2, r.right, r.bottom,
DcMem, 0, 0, SRCCOPY );
- DeleteDC(DcMem);
- DeleteObject(bm);
- /*
- SetRect(&r,Rect.right - CheckBitmapWidth, (y - CheckBitmapHeight) / 2,
Rect.right, Rect.bottom);
- DrawFrameControl(Dc, &r, DFC_MENU, DFCS_MENUARROW);
- */
+ RECT rectTemp;
+ CopyRect(&rectTemp, &Rect);
+ rectTemp.left = rectTemp.right - GetSystemMetrics(SM_CXMENUCHECK);
+ DrawFrameControl(Dc, &rectTemp, DFC_MENU, DFCS_MENUARROW);
}
Rect.left += 4;
if( !(MenuInfo->dwStyle & MNS_NOCHECK))