Changeset 4825 for trunk/src/user32/win32wmdiclient.cpp
- Timestamp:
- Dec 17, 2000, 4:04:14 PM (25 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/user32/win32wmdiclient.cpp
r4463 r4825 1 /* $Id: win32wmdiclient.cpp,v 1.3 0 2000-10-09 17:26:54sandervl Exp $ */1 /* $Id: win32wmdiclient.cpp,v 1.31 2000-12-17 15:04:12 sandervl Exp $ */ 2 2 /* 3 3 * Win32 MDI Client Window Class for OS/2 … … 541 541 HMENU oldFrameMenu = ::GetMenu(hwndFrame); 542 542 543 if (hmenuFrame && !IsMenu(hmenuFrame)) 544 { 545 dprintf(("Win32MDIClientWindow::setMDIMenu: hmenuFrame is not a menu handle\n")); 546 return 0L; 547 } 548 549 if (hmenuWindow && !IsMenu(hmenuWindow)) 550 { 551 dprintf(("Win32MDIClientWindow::setMDIMenu: hmenuWindow is not a menu handle\n")); 552 return 0L; 553 } 554 543 555 if( maximizedChild && hmenuFrame && hmenuFrame!=oldFrameMenu ) 544 556 restoreFrameMenu(maximizedChild); … … 556 568 if( nActiveChildren ) 557 569 { 558 INT j = i - nActiveChildren + 1; 559 char buffer[100]; 560 UINT id,state; 570 INT j; 571 LPWSTR buffer = NULL; 572 MENUITEMINFOW mii; 573 INT nbWindowsMenuItems; /* num of documents shown + "More Windows..." if present */ 574 575 if (nActiveChildren <= MDI_MOREWINDOWSLIMIT) 576 nbWindowsMenuItems = nActiveChildren; 577 else 578 nbWindowsMenuItems = MDI_MOREWINDOWSLIMIT + 1; 579 580 j = i - nbWindowsMenuItems + 1; 561 581 562 582 for( ; i >= j ; i-- ) 563 583 { 564 id = GetMenuItemID(hWindowMenu,i ); 565 state = GetMenuState(hWindowMenu,i,MF_BYPOSITION); 566 567 GetMenuStringA(hWindowMenu, i, buffer, 100, MF_BYPOSITION); 568 569 DeleteMenu(hWindowMenu, i , MF_BYPOSITION); 570 InsertMenuA(hmenuWindow, pos, MF_BYPOSITION | MF_STRING, 571 id, buffer); 572 CheckMenuItem(hmenuWindow ,pos , MF_BYPOSITION | (state & MF_CHECKED)); 584 memset(&mii, 0, sizeof(mii)); 585 mii.cbSize = sizeof(mii); 586 mii.fMask = MIIM_CHECKMARKS | MIIM_DATA | MIIM_ID | MIIM_STATE 587 | MIIM_SUBMENU | MIIM_TYPE | MIIM_BITMAP; 588 589 GetMenuItemInfoW(hWindowMenu, i, TRUE, &mii); 590 if(mii.cch) { /* Menu is MFT_STRING */ 591 mii.cch++; /* add room for '\0' */ 592 buffer = (LPWSTR)HeapAlloc(GetProcessHeap(), 0, 593 mii.cch * sizeof(WCHAR)); 594 mii.dwTypeData = buffer; 595 GetMenuItemInfoW(hWindowMenu, i, TRUE, &mii); 596 } 597 DeleteMenu(hWindowMenu, i, MF_BYPOSITION); 598 InsertMenuItemW(hmenuWindow, pos, TRUE, &mii); 599 if(buffer) { 600 HeapFree(GetProcessHeap(), 0, buffer); 601 buffer = NULL; 602 } 573 603 } 574 604 } … … 580 610 } 581 611 582 if ( hmenuFrame && hmenuFrame!=oldFrameMenu)612 if (hmenuFrame) 583 613 { 584 614 ::SetMenu(hwndFrame, hmenuFrame); 585 615 586 if (maximizedChild) 587 augmentFrameMenu(maximizedChild); 588 589 return oldFrameMenu; 616 if( hmenuFrame!=oldFrameMenu ) 617 { 618 if (maximizedChild) 619 augmentFrameMenu(maximizedChild); 620 621 return oldFrameMenu; 622 } 623 } 624 else 625 { 626 INT nItems = GetMenuItemCount(oldFrameMenu) - 1; 627 UINT iId = GetMenuItemID(oldFrameMenu,nItems) ; 628 629 if( !(iId == SC_RESTORE || iId == SC_CLOSE) ) 630 { 631 /* SetMenu() may already have been called, meaning that this window 632 * already has its menu. But they may have done a SetMenu() on 633 * an MDI window, and called MDISetMenu() after the fact, meaning 634 * that the "if" to this "else" wouldn't catch the need to 635 * augment the frame menu. 636 */ 637 if( maximizedChild ) 638 augmentFrameMenu(maximizedChild); 639 } 590 640 } 591 641 return 0;
Note:
See TracChangeset
for help on using the changeset viewer.