Author: mkupfer
Date: Fri Mar 6 19:47:44 2009
New Revision: 39888
URL:
http://svn.reactos.org/svn/reactos?rev=39888&view=rev
Log:
- more improved version, reduced calls, allocate ressources if needed only
Modified:
trunk/reactos/dll/win32/user32/windows/draw.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] Fri Mar 6 19:47:44 2009
@@ -1234,64 +1234,58 @@
return TRUE;
}
-/* Ported from WINE20020904 */
-/* Draw a menu control coming from DrawFrameControl() */
static BOOL UITOOLS95_DrawFrameMenu(HDC dc, LPRECT r, UINT uFlags)
{
- RECT myr;
- int SmallDiam = UITOOLS_MakeSquareRect(r, &myr);
- BOOL retval = TRUE;
- /* Start using Marlett-font instead of basic drawing */
LOGFONT lf;
HFONT hFont, hOldFont;
COLORREF clrsave;
-
+ INT bkmode;
+ TCHAR Symbol;
+ switch(uFlags & 0xff)
+ {
+ case DFCS_MENUARROW:
+ Symbol = '8';
+ break;
+
+ case DFCS_MENUBULLET:
+ Symbol = 'h';
+ break;
+
+ case DFCS_MENUCHECK:
+ Symbol = 'a';
+ break;
+
+ default:
+/*
+ DbgPrint("Invalid menu; flags=0x%04x\n", uFlags);
+*/
+ return FALSE;
+ }
+ /* acquire ressources only if valid menu */
ZeroMemory(&lf, sizeof(LOGFONT));
- lf.lfHeight = SmallDiam;
+ lf.lfHeight = r->bottom - r->top;
lf.lfWidth = 0;
lf.lfWeight = FW_NORMAL;
lf.lfCharSet = DEFAULT_CHARSET;
lstrcpy(lf.lfFaceName, TEXT("Marlett"));
hFont = CreateFontIndirect(&lf);
+ /* save font and text color */
hOldFont = SelectObject(dc, hFont);
+ clrsave = GetTextColor(dc);
+ bkmode = GetBkMode(dc);
+ /* set color and drawing mode */
SetBkMode(dc, TRANSPARENT);
- clrsave = GetTextColor(dc);
SetTextColor(dc, GetSysColor(COLOR_WINDOWTEXT));
-
FillRect(dc, r, (HBRUSH)GetStockObject(WHITE_BRUSH));
-
- switch(uFlags & 0xff)
- {
- case DFCS_MENUARROW:
- // FIXME: is "8" the correct symbol?
- TextOut(dc, myr.left, myr.top, TEXT("8"), 1);
- break;
-
- case DFCS_MENUBULLET:
- // FIXME: is "h" the correct symbol?
- TextOut(dc, myr.left, myr.top, TEXT("h"), 1);
- break;
-
- case DFCS_MENUCHECK:
- // FIXME: is "a" the correct symbol?
- TextOut(dc, myr.left, myr.top, TEXT("a"), 1);
- break;
-
- default:
-/*
- DbgPrint("Invalid menu; flags=0x%04x\n", uFlags);
-*/
- retval = FALSE;
- break;
- }
-
+ /* 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 retval;
-}
-
+ return TRUE;
+}
BOOL
WINAPI