[WIN32K:NTUSER]
[reactos.git] / reactos / win32ss / user / ntuser / nonclient.c
index 0f1b5cf..b3ec244 100644 (file)
@@ -679,17 +679,11 @@ IntIsScrollBarVisible(PWND pWnd, INT hBar)
   return !(sbi.rgstate[0] & STATE_SYSTEM_OFFSCREEN);
 }
 
-BOOL
-UserHasMenu(PWND pWnd, ULONG Style)
-{
-   return (!(Style & WS_CHILD) && UlongToHandle(pWnd->IDMenu) != 0);
-}
-
 /*
  * FIXME:
  * - Cache bitmaps, then just bitblt instead of calling DFC() (and
  *   wasting precious CPU cycles) every time
- * - Center the buttons verticaly in the rect
+ * - Center the buttons vertically in the rect
  */
 VOID
 UserDrawCaptionButton(PWND pWnd, LPRECT Rect, DWORD Style, DWORD ExStyle, HDC hDC, BOOL bDown, ULONG Type)
@@ -751,8 +745,7 @@ UserDrawCaptionButton(PWND pWnd, LPRECT Rect, DWORD Style, DWORD ExStyle, HDC hD
           PMENU pSysMenu = IntGetSystemMenu(pWnd, FALSE);
           UINT MenuState = IntGetMenuState(UserHMGetHandle(pSysMenu), SC_CLOSE, MF_BYCOMMAND); /* in case of error MenuState==0xFFFFFFFF */
 
-         /* FIXME: A tool window has a smaller Close button */
-
+         /* A tool window has a smaller Close button */
          if (ExStyle & WS_EX_TOOLWINDOW)
          {
             TempRect.left = TempRect.right - UserGetSystemMetrics(SM_CXSMSIZE);
@@ -853,7 +846,7 @@ VOID UserDrawCaptionBar(
 
    if (!(Flags & DC_NOVISIBLE) && !IntIsWindowVisible(pWnd)) return;
 
-   ERR("UserDrawCaptionBar: pWnd %p, hDc %p, Flags 0x%x.\n", pWnd, hDC, Flags);
+   TRACE("UserDrawCaptionBar: pWnd %p, hDc %p, Flags 0x%x.\n", pWnd, hDC, Flags);
 
    Style = pWnd->style;
    ExStyle = pWnd->ExStyle;
@@ -950,13 +943,10 @@ VOID UserDrawCaptionBar(
 
    if (!(Style & WS_MINIMIZE))
    {
-      PMENU menu = UserGetMenuObject(UlongToHandle(pWnd->IDMenu));
       /* Draw menu bar */
-      if (menu && !(Style & WS_CHILD))
+      if (HAS_MENU(pWnd, Style))
       {
-          TempRect = CurrentRect;
-          TempRect.bottom = TempRect.top + menu->cyMenu;
-          CurrentRect.top += MENU_DrawMenuBar(hDC, &TempRect, pWnd, FALSE);
+          CurrentRect.top += MENU_DrawMenuBar(hDC, &CurrentRect, pWnd, FALSE);
       }
 
       if (ExStyle & WS_EX_CLIENTEDGE)
@@ -1119,13 +1109,13 @@ NC_DoNCPaint(PWND pWnd, HDC hDC, INT Flags)
 
    if (!(Style & WS_MINIMIZE))
    {
-     PMENU menu = UserGetMenuObject(UlongToHandle(pWnd->IDMenu));
      /* Draw menu bar */
-     if (menu && !(Style & WS_CHILD))
+     if (HAS_MENU(pWnd, Style))
      {
-         TempRect = CurrentRect;
-         TempRect.bottom = TempRect.top + menu->cyMenu;
-         if (!(Flags & DC_NOSENDMSG)) CurrentRect.top += MENU_DrawMenuBar(hDC, &TempRect, pWnd, FALSE);
+         if (!(Flags & DC_NOSENDMSG))
+         {
+             CurrentRect.top += MENU_DrawMenuBar(hDC, &CurrentRect, pWnd, FALSE);
+         }
      }
 
      if (ExStyle & WS_EX_CLIENTEDGE)
@@ -1226,7 +1216,7 @@ LRESULT NC_HandleNCCalcSize( PWND Wnd, WPARAM wparam, RECTL *Rect, BOOL Suspende
             Rect->top += UserGetSystemMetrics(SM_CYCAPTION);
       }
 
-      if (Wnd->IDMenu && ((Wnd->style & (WS_CHILD | WS_POPUP)) != WS_CHILD))
+      if (HAS_MENU(Wnd, Style))
       {
          HDC hDC = UserGetDCEx(Wnd, 0, DCX_USESTYLE | DCX_WINDOW);