user32.DrawMenuBarTemp implementation

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi,

This patch finishes off the collection of DrawXxxTemp functions. It
shouldn't change the flow of execution (and if it does, please fix it). It
basically moves the code which currently resides in the internal function
into the exported function. The exported function has been tested with
Desk.cpl (Win2k SP3). The internal function can probably be eliminated
entirely after this patch (with some thinking), but I played it safe and let
it be.

ChangeLog:
- Move internal implementation into the exported function DrawMenuBarTemp
Index: wine/controls/menu.c
===================================================================
RCS file: /home/wine/wine/controls/menu.c,v
retrieving revision 1.158
diff -u -r1.158 menu.c
--- wine/controls/menu.c	8 Jan 2003 21:09:28 -0000	1.158
+++ wine/controls/menu.c	11 Jan 2003 21:06:59 -0000
@@ -177,6 +177,7 @@
 
 static LRESULT WINAPI PopupMenuWndProc( HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam );
 
+DWORD WINAPI DrawMenuBarTemp(HWND hwnd, HDC hDC, LPRECT lprect, HMENU hMenu, HFONT hFont);
 
 /*********************************************************************
  * menu class descriptor
@@ -1515,63 +1516,29 @@
                          BOOL suppress_draw)
 {
     LPPOPUPMENU lppop;
-    UINT i,retvalue;
     HFONT hfontOld = 0;
     HMENU hMenu = GetMenu(hwnd);
 
     lppop = MENU_GetMenu( hMenu );
     if (lppop == NULL || lprect == NULL)
     {
-        retvalue = GetSystemMetrics(SM_CYMENU);
-        goto END;
+        return GetSystemMetrics(SM_CYMENU);
     }
 
-    TRACE("(%p, %p, %p)\n", hDC, lprect, lppop);
-
-    hfontOld = SelectObject( hDC, hMenuFont);
-
-    if (lppop->Height == 0)
-        MENU_MenuBarCalcSize(hDC, lprect, lppop, hwnd);
-
-    lprect->bottom = lprect->top + lppop->Height;
-
     if (suppress_draw)
     {
-        retvalue = lppop->Height;
-        goto END;
-    }
+	hfontOld = SelectObject( hDC, hMenuFont);
 
-    FillRect(hDC, lprect, GetSysColorBrush(COLOR_MENU) );
+	if (lppop->Height == 0)
+		MENU_MenuBarCalcSize(hDC, lprect, lppop, hwnd);
 
-    if (TWEAK_WineLook == WIN31_LOOK)
-    {
-	SelectObject( hDC, SYSCOLOR_GetPen(COLOR_WINDOWFRAME) );
-	MoveToEx( hDC, lprect->left, lprect->bottom, NULL );
-	LineTo( hDC, lprect->right, lprect->bottom );
-    }
-    else
-    {
-	SelectObject( hDC, SYSCOLOR_GetPen(COLOR_3DFACE));
-	MoveToEx( hDC, lprect->left, lprect->bottom, NULL );
-	LineTo( hDC, lprect->right, lprect->bottom );
-    }
-
-    if (lppop->nItems == 0)
-    {
-        retvalue = GetSystemMetrics(SM_CYMENU);
-        goto END;
-    }
+	lprect->bottom = lprect->top + lppop->Height;
 
-    for (i = 0; i < lppop->nItems; i++)
-    {
-        MENU_DrawMenuItem( hwnd, hMenu, hwnd,
-                           hDC, &lppop->items[i], lppop->Height, TRUE, ODA_DRAWENTIRE );
+        if (hfontOld) SelectObject( hDC, hfontOld);
+	return lppop->Height;
     }
-    retvalue = lppop->Height;
-
-END:
-    if (hfontOld) SelectObject (hDC, hfontOld);
-    return retvalue;
+    else
+        return DrawMenuBarTemp(hwnd, hDC, lprect, hMenu, NULL);
 }
 
 
@@ -3861,10 +3830,64 @@
  *
  * Not 100% sure about the param names, but close.
  */
-DWORD WINAPI DrawMenuBarTemp(HWND someHWND, HDC someHDC, LPRECT someRECT, HMENU someHMENU, HFONT someFONT)
+DWORD WINAPI DrawMenuBarTemp(HWND hwnd, HDC hDC, LPRECT lprect, HMENU hMenu, HFONT hFont)
 {
-    FIXME("(%p, %p, %p, %p, %p): stub\n", someHWND, someHDC, someRECT, someHMENU, someFONT);
-    return 0;
+    LPPOPUPMENU lppop;
+    UINT i,retvalue;
+    HFONT hfontOld = 0;
+    if (!hMenu)
+        hMenu = GetMenu(hwnd);
+
+    if (!hFont)
+        hFont = hMenuFont;
+
+    lppop = MENU_GetMenu( hMenu );
+    if (lppop == NULL || lprect == NULL)
+    {
+        retvalue = GetSystemMetrics(SM_CYMENU);
+        goto END;
+    }
+
+    TRACE("(%p, %p, %p, %p, %p)\n", hwnd, hDC, lprect, hMenu, hFont);
+
+    hfontOld = SelectObject( hDC, hFont);
+
+    if (lppop->Height == 0)
+        MENU_MenuBarCalcSize(hDC, lprect, lppop, hwnd);
+
+    lprect->bottom = lprect->top + lppop->Height;
+
+    FillRect(hDC, lprect, GetSysColorBrush(COLOR_MENU) );
+
+    if (TWEAK_WineLook == WIN31_LOOK)
+    {
+	SelectObject( hDC, SYSCOLOR_GetPen(COLOR_WINDOWFRAME) );
+	MoveToEx( hDC, lprect->left, lprect->bottom, NULL );
+	LineTo( hDC, lprect->right, lprect->bottom );
+    }
+    else
+    {
+	SelectObject( hDC, SYSCOLOR_GetPen(COLOR_3DFACE));
+	MoveToEx( hDC, lprect->left, lprect->bottom, NULL );
+	LineTo( hDC, lprect->right, lprect->bottom );
+    }
+
+    if (lppop->nItems == 0)
+    {
+        retvalue = GetSystemMetrics(SM_CYMENU);
+        goto END;
+    }
+
+    for (i = 0; i < lppop->nItems; i++)
+    {
+        MENU_DrawMenuItem( hwnd, hMenu, hwnd,
+                           hDC, &lppop->items[i], lppop->Height, TRUE, ODA_DRAWENTIRE );
+    }
+    retvalue = lppop->Height;
+
+END:
+    if (hfontOld) SelectObject (hDC, hfontOld);
+    return retvalue;
 }
 
 /***********************************************************************

[Index of Archives]     [Gimp for Windows]     [Red Hat]     [Samba]     [Yosemite Camping]     [Graphics Cards]     [Wine Home]

  Powered by Linux