Index: trunk/src/user32/button.cpp
===================================================================
--- trunk/src/user32/button.cpp	(revision 7408)
+++ trunk/src/user32/button.cpp	(revision 7409)
@@ -1,3 +1,3 @@
-/* $Id: button.cpp,v 1.43 2001-08-29 10:37:25 phaller Exp $ */
+/* $Id: button.cpp,v 1.44 2001-11-21 11:51:37 sandervl Exp $ */
 /* File: button.cpp -- Button type widgets
  *
@@ -336,4 +336,33 @@
 
   DefWindowProcA(hwnd,WM_SETTEXT,wParam,lParam);
+#ifdef __WIN32OS2__
+  BUTTONINFO* infoPtr = (BUTTONINFO*)GetInfoPtr(hwnd);
+  if ((dwStyle & 0x0f) == BS_GROUPBOX) {
+    RECT rc;
+    TEXTMETRICA tm;
+    HDC  hdc = GetDC(hwnd);
+    int  fh1 = 0, fh2 = 0;
+
+    // select old font (if exists)
+    if (infoPtr->hFont) {
+       SelectObject (hdc, infoPtr->hFont);
+       GetTextMetricsA (hdc, &tm);
+       fh1 = tm.tmHeight;
+    }
+    // select new font (if exists)
+    if (wParam) {
+       SelectObject (hdc, wParam);
+       GetTextMetricsA (hdc, &tm);
+       fh2 = tm.tmHeight;
+    }
+    // Erases top border line and (old) text background
+    GetClientRect(hwnd, &rc);
+    rc.bottom = rc.top + max( fh1, fh2) + 1;
+    HBRUSH hbr = GetControlBrush( hwnd, hdc, CTLCOLOR_STATIC );
+    FillRect(hdc, &rc, hbr);
+    ReleaseDC(hwnd,hdc);
+  }
+#endif
+
   if (dwStyle & WS_VISIBLE) PAINT_BUTTON(hwnd,dwStyle & 0x0f,ODA_DRAWENTIRE);
 
Index: trunk/src/user32/menu.cpp
===================================================================
--- trunk/src/user32/menu.cpp	(revision 7408)
+++ trunk/src/user32/menu.cpp	(revision 7409)
@@ -1,3 +1,3 @@
-/* $Id: menu.cpp,v 1.39 2001-10-24 15:41:53 sandervl Exp $*/
+/* $Id: menu.cpp,v 1.40 2001-11-21 11:51:37 sandervl Exp $*/
 /*
  * Menu functions
@@ -302,26 +302,4 @@
 //#define USER_HEAP_FREE(handle) HeapFree(GetProcessHeap(),0,(LPVOID)handle)
 
-HMENU getMenu(HWND hwnd)
-{
-  Win32BaseWindow *win32wnd = Win32BaseWindow::GetWindowFromHandle(hwnd);
-  
-  if(win32wnd) {
-      HMENU hmenu = win32wnd->GetMenu();
-      RELEASE_WNDOBJ(win32wnd);
-      return hmenu;
-  }
-  return (HMENU)0;
-}
-
-VOID setMenu(HWND hwnd,HMENU hMenu)
-{
-  Win32BaseWindow *win32wnd = Win32BaseWindow::GetWindowFromHandle(hwnd);
-
-  if (win32wnd) {
-      win32wnd->SetMenu(hMenu);
-      RELEASE_WNDOBJ(win32wnd);
-  }
-}
-
 
 /***********************************************************************
@@ -1468,5 +1446,5 @@
     HFONT hfontOld = 0;
 
-    lppop = MENU_GetMenu(getMenu(hwnd));
+    lppop = MENU_GetMenu(GetMenu(hwnd));
     if (lppop == NULL || lprect == NULL)
     {
@@ -1518,5 +1496,5 @@
       {
         OffsetRect(&lppop->items[i].rect,-lprect->left,-lprect->top);
-        MENU_DrawMenuItem( hwnd,getMenu(hwnd), GetWindow(hwnd,GW_OWNER),
+        MENU_DrawMenuItem( hwnd,GetMenu(hwnd), GetWindow(hwnd,GW_OWNER),
                          memDC, &lppop->items[i], lppop->Height, TRUE, ODA_DRAWENTIRE );
         OffsetRect(&lppop->items[i].rect,lprect->left,lprect->top);
@@ -2266,5 +2244,5 @@
         {
             ht = ((ht == HTSYSMENU) && !inMenuBar) ? (UINT)(getSysMenu(menu->hWnd))
-                 : ((ht == HTMENU) && inMenuBar) ? (UINT)(getMenu(menu->hWnd)) : 0;
+                 : ((ht == HTMENU) && inMenuBar) ? (UINT)(GetMenu(menu->hWnd)) : 0;
         }
    }
@@ -2561,10 +2539,10 @@
                 /* switch to the menu bar */
 
-                if( (GetWindowLongA(pmt->hOwnerWnd,GWL_STYLE) & WS_CHILD) || !getMenu(pmt->hOwnerWnd) )
+                if( (GetWindowLongA(pmt->hOwnerWnd,GWL_STYLE) & WS_CHILD) || !GetMenu(pmt->hOwnerWnd) )
                 {
                     return FALSE;
                 }
 
-                hNewMenu = getMenu(pmt->hOwnerWnd);
+                hNewMenu = GetMenu(pmt->hOwnerWnd);
                 if( vk == VK_LEFT )
                 {
@@ -2596,5 +2574,5 @@
                     hNewMenu =  getSysMenu(hNewWnd);
                 }
-                else if( (GetWindowLongA(hNewWnd,GWL_STYLE) & WS_CHILD) || (getMenu(hNewWnd) != hNewMenu) )
+                else if( (GetWindowLongA(hNewWnd,GWL_STYLE) & WS_CHILD) || (GetMenu(hNewWnd) != hNewMenu) )
                 {
                     /* FIXME: Not sure what to do here, perhaps,
@@ -3163,5 +3141,5 @@
 void MENU_TrackMouseMenuBar( HWND hWnd, INT ht, POINT pt )
 {
-    HMENU hMenu = (ht == 0) ? getMenu(hWnd):getSysMenu(hWnd);
+    HMENU hMenu = (ht == 0) ? GetMenu(hWnd):getSysMenu(hWnd);
     UINT wFlags = TPM_ENTERIDLEEX | TPM_BUTTONDOWN | TPM_LEFTALIGN | TPM_LEFTBUTTON;
 
@@ -3185,5 +3163,5 @@
 void MENU_TrackMouseMenuBar_MouseMove(HWND hwnd,POINT pt,BOOL OnMenu)
 {
-    HMENU hMenu = getMenu(hwnd);
+    HMENU hMenu = GetMenu(hwnd);
     MENUITEM *item = NULL;
     RECT rect;
@@ -3262,5 +3240,5 @@
 
     if( (GetWindowLongA(hWnd,GWL_STYLE) & (WS_CHILD | WS_MINIMIZE)) ||
-        !getMenu(hWnd) || vkey == VK_SPACE )
+        !GetMenu(hWnd) || vkey == VK_SPACE )
     {
         if( !(GetWindowLongA(hWnd,GWL_STYLE) & WS_SYSMENU) ) return;
@@ -3270,5 +3248,5 @@
     }
     else
-        hTrackMenu = getMenu(hWnd);
+        hTrackMenu = GetMenu(hWnd);
 
     if (IsMenu( hTrackMenu ))
@@ -3456,5 +3434,5 @@
     //             hwnd, menubarWidth, orgX, orgY );
 
-    if (!(lppop = MENU_GetMenu(getMenu(hwnd))))
+    if (!(lppop = MENU_GetMenu(GetMenu(hwnd))))
     {
         return 0;
@@ -4143,8 +4121,15 @@
     HMENU retvalue;
 
-    dprintf(("USER32: GetMenu %x", hWnd));
-
-    if (GetWindowLongA(hWnd,GWL_STYLE) & WS_CHILD) return 0;
-    else return getMenu(hWnd);
+    dprintf(("USER32: GetMenu %x %x", hWnd, GetWindowLongA( hWnd, GWL_ID )));
+
+    if (GetWindowLongA(hWnd,GWL_STYLE) & WS_CHILD) {
+        dprintf(("WARNING: window is child; no menu"));
+        return 0;
+    }
+    retvalue = (HMENU)GetWindowLongA( hWnd, GWL_ID );
+    if(MENU_GetMenu(retvalue) != NULL) {
+        return retvalue;
+    }
+    return 0;
 }
 
@@ -4169,5 +4154,4 @@
         if (GetCapture() == hWnd) ReleaseCapture();
 
-        setMenu(hWnd,hMenu);
         if (hMenu != 0)
         {
@@ -4182,7 +4166,11 @@
             lpmenu->Height = 0;  /* Make sure we recalculate the size */
         }
+        SetWindowLongA( hWnd, GWL_ID, hMenu );
+
+#ifdef __WIN32OS2__
 //SvL: This fixes the menu in standard mine sweeper (window isn't visible
 //     when SetMenu is called)
 //        if (IsWindowVisible(hWnd))
+#endif
             SetWindowPos( hWnd, 0, 0, 0, 0, 0, SWP_NOSIZE | SWP_NOMOVE |
                         SWP_NOACTIVATE | SWP_NOZORDER | SWP_FRAMECHANGED );
@@ -4202,5 +4190,13 @@
     dprintf(("USER32: GetSubMenu %x %d", hMenu, nPos));
 
+#ifdef __WIN32OS2__
+    if (!(lpmi = MENU_FindItem(&hMenu,(UINT*)&nPos,MF_BYPOSITION)))  {
+        SetLastError(ERROR_INVALID_HANDLE);
+        return 0;
+    }
+#else
     if (!(lpmi = MENU_FindItem(&hMenu,(UINT*)&nPos,MF_BYPOSITION))) return 0;
+#endif
+
     if (!(lpmi->fType & MF_POPUP)) return 0;
     return lpmi->hSubMenu;
@@ -4217,7 +4213,7 @@
     dprintf(("USER32: DrawMenuBar %x", hWnd));
 
-    if (!(GetWindowLongA(hWnd,GWL_STYLE) & WS_CHILD) && getMenu(hWnd))
-    {
-        lppop = MENU_GetMenu(getMenu(hWnd));
+    if (!(GetWindowLongA(hWnd,GWL_STYLE) & WS_CHILD) && GetMenu(hWnd))
+    {
+        lppop = MENU_GetMenu(GetMenu(hWnd));
         if (lppop == NULL)
         {
Index: trunk/src/user32/win32wbase.cpp
===================================================================
--- trunk/src/user32/win32wbase.cpp	(revision 7408)
+++ trunk/src/user32/win32wbase.cpp	(revision 7409)
@@ -1,3 +1,3 @@
-/* $Id: win32wbase.cpp,v 1.300 2001-11-17 17:49:38 sandervl Exp $ */
+/* $Id: win32wbase.cpp,v 1.301 2001-11-21 11:51:38 sandervl Exp $ */
 /*
  * Win32 Window Base Class for OS/2
@@ -3705,4 +3705,5 @@
 
         case GWL_ID:
+                dprintf(("GWL_ID old %x, new %x", getWindowId(), value));
                 oldval = getWindowId();
                 setWindowId(value);
Index: trunk/src/user32/win32wbase.h
===================================================================
--- trunk/src/user32/win32wbase.h	(revision 7408)
+++ trunk/src/user32/win32wbase.h	(revision 7409)
@@ -1,3 +1,3 @@
-/* $Id: win32wbase.h,v 1.133 2001-11-14 14:36:03 phaller Exp $ */
+/* $Id: win32wbase.h,v 1.134 2001-11-21 11:51:38 sandervl Exp $ */
 /*
  * Win32 Window Base Class for OS/2
@@ -120,5 +120,5 @@
     !(style & (WS_CHILD | WS_POPUP))
 
-#define HAS_MENU() (!(getStyle() & WS_CHILD) && (GetMenu() != 0))
+#define HAS_MENU() (!(getStyle() & WS_CHILD) && (getWindowId() != 0))
 
 #define STATE_INIT	         0   //initial state
@@ -239,6 +239,4 @@
          PVOID  getExtraPtr()                   { return pExtra; };
 
-         HMENU  GetMenu()                           { return dwIDMenu; };
-         VOID   SetMenu(HMENU newMenu)              { dwIDMenu = newMenu; };
          void   SetSysMenu(HMENU hSystemMenu)       { hSysMenu = hSystemMenu; };
          HMENU  GetSysMenu()                        { return hSysMenu; }
Index: trunk/src/user32/winaccel.cpp
===================================================================
--- trunk/src/user32/winaccel.cpp	(revision 7408)
+++ trunk/src/user32/winaccel.cpp	(revision 7409)
@@ -1,3 +1,3 @@
-/* $Id: winaccel.cpp,v 1.9 2001-09-19 15:39:52 sandervl Exp $ */
+/* $Id: winaccel.cpp,v 1.10 2001-11-21 11:51:39 sandervl Exp $ */
 /*
  * Win32 accelerator key functions for OS/2
@@ -91,5 +91,5 @@
                     }
 
-                    hMenu = (window->getStyle() & WS_CHILD) ? 0 : (HMENU)window->GetMenu();
+                    hMenu = GetMenu(hWnd);
 
                     iSysStat = (window->GetSysMenu()) ? GetMenuState(GetSubMenu(window->GetSysMenu(), 0),
