Ignore:
Timestamp:
Nov 21, 2001, 12:51:39 PM (24 years ago)
Author:
sandervl
Message:

menu + groupbox fixes

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/user32/menu.cpp

    r7195 r7409  
    1 /* $Id: menu.cpp,v 1.39 2001-10-24 15:41:53 sandervl Exp $*/
     1/* $Id: menu.cpp,v 1.40 2001-11-21 11:51:37 sandervl Exp $*/
    22/*
    33 * Menu functions
     
    302302//#define USER_HEAP_FREE(handle) HeapFree(GetProcessHeap(),0,(LPVOID)handle)
    303303
    304 HMENU getMenu(HWND hwnd)
    305 {
    306   Win32BaseWindow *win32wnd = Win32BaseWindow::GetWindowFromHandle(hwnd);
    307  
    308   if(win32wnd) {
    309       HMENU hmenu = win32wnd->GetMenu();
    310       RELEASE_WNDOBJ(win32wnd);
    311       return hmenu;
    312   }
    313   return (HMENU)0;
    314 }
    315 
    316 VOID setMenu(HWND hwnd,HMENU hMenu)
    317 {
    318   Win32BaseWindow *win32wnd = Win32BaseWindow::GetWindowFromHandle(hwnd);
    319 
    320   if (win32wnd) {
    321       win32wnd->SetMenu(hMenu);
    322       RELEASE_WNDOBJ(win32wnd);
    323   }
    324 }
    325 
    326304
    327305/***********************************************************************
     
    14681446    HFONT hfontOld = 0;
    14691447
    1470     lppop = MENU_GetMenu(getMenu(hwnd));
     1448    lppop = MENU_GetMenu(GetMenu(hwnd));
    14711449    if (lppop == NULL || lprect == NULL)
    14721450    {
     
    15181496      {
    15191497        OffsetRect(&lppop->items[i].rect,-lprect->left,-lprect->top);
    1520         MENU_DrawMenuItem( hwnd,getMenu(hwnd), GetWindow(hwnd,GW_OWNER),
     1498        MENU_DrawMenuItem( hwnd,GetMenu(hwnd), GetWindow(hwnd,GW_OWNER),
    15211499                         memDC, &lppop->items[i], lppop->Height, TRUE, ODA_DRAWENTIRE );
    15221500        OffsetRect(&lppop->items[i].rect,lprect->left,lprect->top);
     
    22662244        {
    22672245            ht = ((ht == HTSYSMENU) && !inMenuBar) ? (UINT)(getSysMenu(menu->hWnd))
    2268                  : ((ht == HTMENU) && inMenuBar) ? (UINT)(getMenu(menu->hWnd)) : 0;
     2246                 : ((ht == HTMENU) && inMenuBar) ? (UINT)(GetMenu(menu->hWnd)) : 0;
    22692247        }
    22702248   }
     
    25612539                /* switch to the menu bar */
    25622540
    2563                 if( (GetWindowLongA(pmt->hOwnerWnd,GWL_STYLE) & WS_CHILD) || !getMenu(pmt->hOwnerWnd) )
     2541                if( (GetWindowLongA(pmt->hOwnerWnd,GWL_STYLE) & WS_CHILD) || !GetMenu(pmt->hOwnerWnd) )
    25642542                {
    25652543                    return FALSE;
    25662544                }
    25672545
    2568                 hNewMenu = getMenu(pmt->hOwnerWnd);
     2546                hNewMenu = GetMenu(pmt->hOwnerWnd);
    25692547                if( vk == VK_LEFT )
    25702548                {
     
    25962574                    hNewMenu =  getSysMenu(hNewWnd);
    25972575                }
    2598                 else if( (GetWindowLongA(hNewWnd,GWL_STYLE) & WS_CHILD) || (getMenu(hNewWnd) != hNewMenu) )
     2576                else if( (GetWindowLongA(hNewWnd,GWL_STYLE) & WS_CHILD) || (GetMenu(hNewWnd) != hNewMenu) )
    25992577                {
    26002578                    /* FIXME: Not sure what to do here, perhaps,
     
    31633141void MENU_TrackMouseMenuBar( HWND hWnd, INT ht, POINT pt )
    31643142{
    3165     HMENU hMenu = (ht == 0) ? getMenu(hWnd):getSysMenu(hWnd);
     3143    HMENU hMenu = (ht == 0) ? GetMenu(hWnd):getSysMenu(hWnd);
    31663144    UINT wFlags = TPM_ENTERIDLEEX | TPM_BUTTONDOWN | TPM_LEFTALIGN | TPM_LEFTBUTTON;
    31673145
     
    31853163void MENU_TrackMouseMenuBar_MouseMove(HWND hwnd,POINT pt,BOOL OnMenu)
    31863164{
    3187     HMENU hMenu = getMenu(hwnd);
     3165    HMENU hMenu = GetMenu(hwnd);
    31883166    MENUITEM *item = NULL;
    31893167    RECT rect;
     
    32623240
    32633241    if( (GetWindowLongA(hWnd,GWL_STYLE) & (WS_CHILD | WS_MINIMIZE)) ||
    3264         !getMenu(hWnd) || vkey == VK_SPACE )
     3242        !GetMenu(hWnd) || vkey == VK_SPACE )
    32653243    {
    32663244        if( !(GetWindowLongA(hWnd,GWL_STYLE) & WS_SYSMENU) ) return;
     
    32703248    }
    32713249    else
    3272         hTrackMenu = getMenu(hWnd);
     3250        hTrackMenu = GetMenu(hWnd);
    32733251
    32743252    if (IsMenu( hTrackMenu ))
     
    34563434    //             hwnd, menubarWidth, orgX, orgY );
    34573435
    3458     if (!(lppop = MENU_GetMenu(getMenu(hwnd))))
     3436    if (!(lppop = MENU_GetMenu(GetMenu(hwnd))))
    34593437    {
    34603438        return 0;
     
    41434121    HMENU retvalue;
    41444122
    4145     dprintf(("USER32: GetMenu %x", hWnd));
    4146 
    4147     if (GetWindowLongA(hWnd,GWL_STYLE) & WS_CHILD) return 0;
    4148     else return getMenu(hWnd);
     4123    dprintf(("USER32: GetMenu %x %x", hWnd, GetWindowLongA( hWnd, GWL_ID )));
     4124
     4125    if (GetWindowLongA(hWnd,GWL_STYLE) & WS_CHILD) {
     4126        dprintf(("WARNING: window is child; no menu"));
     4127        return 0;
     4128    }
     4129    retvalue = (HMENU)GetWindowLongA( hWnd, GWL_ID );
     4130    if(MENU_GetMenu(retvalue) != NULL) {
     4131        return retvalue;
     4132    }
     4133    return 0;
    41494134}
    41504135
     
    41694154        if (GetCapture() == hWnd) ReleaseCapture();
    41704155
    4171         setMenu(hWnd,hMenu);
    41724156        if (hMenu != 0)
    41734157        {
     
    41824166            lpmenu->Height = 0;  /* Make sure we recalculate the size */
    41834167        }
     4168        SetWindowLongA( hWnd, GWL_ID, hMenu );
     4169
     4170#ifdef __WIN32OS2__
    41844171//SvL: This fixes the menu in standard mine sweeper (window isn't visible
    41854172//     when SetMenu is called)
    41864173//        if (IsWindowVisible(hWnd))
     4174#endif
    41874175            SetWindowPos( hWnd, 0, 0, 0, 0, 0, SWP_NOSIZE | SWP_NOMOVE |
    41884176                        SWP_NOACTIVATE | SWP_NOZORDER | SWP_FRAMECHANGED );
     
    42024190    dprintf(("USER32: GetSubMenu %x %d", hMenu, nPos));
    42034191
     4192#ifdef __WIN32OS2__
     4193    if (!(lpmi = MENU_FindItem(&hMenu,(UINT*)&nPos,MF_BYPOSITION)))  {
     4194        SetLastError(ERROR_INVALID_HANDLE);
     4195        return 0;
     4196    }
     4197#else
    42044198    if (!(lpmi = MENU_FindItem(&hMenu,(UINT*)&nPos,MF_BYPOSITION))) return 0;
     4199#endif
     4200
    42054201    if (!(lpmi->fType & MF_POPUP)) return 0;
    42064202    return lpmi->hSubMenu;
     
    42174213    dprintf(("USER32: DrawMenuBar %x", hWnd));
    42184214
    4219     if (!(GetWindowLongA(hWnd,GWL_STYLE) & WS_CHILD) && getMenu(hWnd))
    4220     {
    4221         lppop = MENU_GetMenu(getMenu(hWnd));
     4215    if (!(GetWindowLongA(hWnd,GWL_STYLE) & WS_CHILD) && GetMenu(hWnd))
     4216    {
     4217        lppop = MENU_GetMenu(GetMenu(hWnd));
    42224218        if (lppop == NULL)
    42234219        {
Note: See TracChangeset for help on using the changeset viewer.