Changeset 4757 for trunk/src/user32/menu.cpp
- Timestamp:
- Dec 5, 2000, 2:05:52 PM (25 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/user32/menu.cpp
r4665 r4757 1 /* $Id: menu.cpp,v 1.2 7 2000-11-21 15:17:12sandervl Exp $*/1 /* $Id: menu.cpp,v 1.28 2000-12-05 13:05:50 sandervl Exp $*/ 2 2 /* 3 3 * Menu functions … … 31 31 #include "menu.h" 32 32 33 #ifdef __WIN32OS2__ 34 #include <objhandle.h> 35 33 36 #define DBG_LOCALLOG DBG_menu 34 37 #include "dbglocal.h" 38 #endif 35 39 36 40 //DEFAULT_DEBUG_CHANNEL(menu) … … 100 104 #define MENU_MAGIC 0x554d /* 'MU' */ 101 105 102 #ifdef __WIN32OS2__103 //******************************************************************************104 //Used by our menu code (we don't want any logging)105 //******************************************************************************106 BOOL IsWindowInternal(HWND hwnd)107 {108 Win32BaseWindow *window;109 110 window = Win32BaseWindow::GetWindowFromHandle(hwnd);111 if(!window) {112 return FALSE;113 }114 return window->IsWindow();115 }116 #define IS_A_MENU(pmenu) ((pmenu) && !IsWindowInternal((HWND)pmenu) && (pmenu)->wMagic == MENU_MAGIC)117 #else118 106 #define IS_A_MENU(pmenu) ((pmenu) && (pmenu)->wMagic == MENU_MAGIC) 119 #endif120 107 121 108 #define ITEM_PREV -1 … … 343 330 POPUPMENU *MENU_GetMenu(HMENU hMenu) 344 331 { 332 #ifdef __WIN32OS2__ 333 if(ObjGetHandleType(hMenu) == USEROBJ_MENU) { 334 POPUPMENU *menu; 335 336 menu = (POPUPMENU *)ObjGetHandleData(hMenu, USEROBJ_MENU); 337 return menu; 338 } 339 return NULL; 340 #else 345 341 POPUPMENU *menu; 346 342 menu = (POPUPMENU*)hMenu; … … 351 347 } 352 348 return menu; 349 #endif 353 350 } 354 351 … … 363 360 364 361 if( hMenu ) { 362 #ifdef __WIN32OS2__ 363 POPUPMENU* menu = MENU_GetMenu(hMenu); 364 #else 365 365 POPUPMENU* menu = (POPUPMENU*)hMenu; 366 #endif 366 367 menu->wFlags |= MF_SYSMENU | MF_POPUP; 367 368 SetMenuDefaultItem(hMenu, SC_CLOSE, FALSE); … … 422 423 if (hMenu) 423 424 { 425 #ifdef __WIN32OS2__ 426 POPUPMENU *menu = MENU_GetMenu(hMenu); 427 #else 424 428 POPUPMENU *menu = (POPUPMENU*)hMenu; 429 #endif 425 430 menu->wFlags = MF_SYSMENU; 426 431 menu->hWnd = hWnd; … … 436 441 menu->items[0].fType = MF_SYSMENU | MF_POPUP; 437 442 menu->items[0].fState = 0; 443 #ifdef __WIN32OS2__ 444 menu = MENU_GetMenu(hPopupMenu); 445 #else 438 446 menu = (POPUPMENU*)hPopupMenu; 447 #endif 439 448 menu->wFlags |= MF_SYSMENU; 440 449 … … 562 571 HMENU hMenu ) 563 572 { 573 #ifdef __WIN32OS2__ 574 POPUPMENU *menu = MENU_GetMenu(hMenu); 575 #else 564 576 POPUPMENU *menu = (POPUPMENU*)hMenu; 577 #endif 565 578 UINT i = menu->FocusedItem + 1; 566 579 … … 590 603 HMENU hMenu ) 591 604 { 605 #ifdef __WIN32OS2__ 606 POPUPMENU const *menu = MENU_GetMenu(hMenu); 607 #else 592 608 POPUPMENU const *menu = (POPUPMENU*)hMenu; 609 #endif 593 610 UINT i; 594 611 … … 1719 1736 int pos; 1720 1737 if((pos=MENU_FindSubMenu(&topmenu, hmenu))!=NO_SELECTED_ITEM){ 1738 #ifdef __WIN32OS2__ 1739 POPUPMENU *ptm = MENU_GetMenu(topmenu); 1740 #else 1721 1741 POPUPMENU *ptm = (POPUPMENU*)topmenu; 1742 #endif 1722 1743 MENUITEM *ip = &ptm->items[pos]; 1723 1744 SendMessageA( hwndOwner, WM_MENUSELECT, MAKELONG(pos, … … 1867 1888 /* Find where to insert new item */ 1868 1889 if (flags & MF_BYPOSITION) { 1869 if (pos > menu->nItems) 1890 if (pos > menu->nItems) 1870 1891 pos = menu->nItems; 1871 1892 } else { 1872 if (!MENU_FindItem( &hMenu, &pos, flags )) 1893 if (!MENU_FindItem( &hMenu, &pos, flags )) 1873 1894 pos = menu->nItems; 1874 1895 else { … … 3217 3238 3218 3239 if(lpRect) { 3219 3240 dprintf(("USER32: TrackPopupMenu %x %x (%d,%d) %x %x (%d,%d)(%d,%d)", hMenu, wFlags, x, y, nReserved, hWnd, lpRect->left, lpRect->top, lpRect->right, lpRect->bottom)); 3220 3241 } 3221 3242 else dprintf(("USER32: TrackPopupMenu %x %x (%d,%d) %x %x lpRect=NULL", hMenu, wFlags, x, y, nReserved, hWnd)); … … 3502 3523 if (!str || !nMaxSiz) 3503 3524 { 3504 3505 3506 3507 3525 if (item && IS_STRING_ITEM(item->fType)) 3526 return strlen(item->text); 3527 else 3528 return 0; 3508 3529 } 3509 3530 … … 3512 3533 if (item) 3513 3534 { 3514 3515 3535 if (!IS_STRING_ITEM(item->fType)) return 0; 3536 lstrcpynA( str, item->text, nMaxSiz ); 3516 3537 } 3517 3538 … … 3537 3558 if (!str || !nMaxSiz) 3538 3559 { 3539 3540 3541 3542 3560 if (item && IS_STRING_ITEM(item->fType)) 3561 return strlen(item->text); 3562 else 3563 return 0; 3543 3564 } 3544 3565 … … 3547 3568 if (item) 3548 3569 { 3549 3550 3570 if (!IS_STRING_ITEM(item->fType)) return 0; 3571 lstrcpynAtoW( str, item->text, nMaxSiz ); 3551 3572 } 3552 3573 … … 3883 3904 dprintf(("USER32: CreateMenu")); 3884 3905 3906 #ifdef __WIN32OS2__ 3907 if (!(menu = (LPPOPUPMENU)HeapAlloc(GetProcessHeap(),0,sizeof(POPUPMENU)))) return 0; 3908 if(ObjAllocateHandle(&hMenu, (DWORD)menu, USEROBJ_MENU) == FALSE) return 0; 3909 #else 3885 3910 if (!(hMenu = (HMENU)HeapAlloc(GetProcessHeap(),0,sizeof(POPUPMENU)))) return 0; 3886 3911 menu = (LPPOPUPMENU)hMenu; 3912 #endif 3887 3913 3888 3914 ZeroMemory(menu, sizeof(POPUPMENU)); … … 3935 3961 HeapFree(GetProcessHeap(), 0, lppop->items ); 3936 3962 } 3963 #ifdef __WIN32OS2__ 3964 HeapFree(GetProcessHeap(),0,(LPVOID)lppop); 3965 ObjFreeHandle(hMenu); 3966 #else 3937 3967 HeapFree(GetProcessHeap(),0,(LPVOID)hMenu); 3968 #endif 3938 3969 MENU_ReleaseTopPopupWnd(); 3939 3970 }
Note:
See TracChangeset
for help on using the changeset viewer.