Changeset 2444 for trunk/src/user32/new/menu.cpp
- Timestamp:
- Jan 15, 2000, 3:18:18 PM (26 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/user32/new/menu.cpp
r2433 r2444 1 /* $Id: menu.cpp,v 1. 9 2000-01-13 20:11:36 sandervlExp $*/1 /* $Id: menu.cpp,v 1.10 2000-01-15 14:18:16 cbratschi Exp $*/ 2 2 /* 3 3 * Menu functions … … 1029 1029 //debug_print_menuitem("MENU_DrawMenuItem: ", lpitem, ""); 1030 1030 1031 if (lpitem->fType & MF_SYSMENU) 1032 { 1033 if( !IsIconic(hwnd) ) 1034 { 1035 Win32BaseWindow *win32wnd = Win32BaseWindow::GetWindowFromHandle(hwnd); 1036 1037 if (win32wnd) win32wnd->DrawSysButton(hdc,lpitem->fState & (MF_HILITE | MF_MOUSESELECT)); 1038 } 1039 1040 return; 1041 } 1031 if (lpitem->fType & MF_SYSMENU) return; 1042 1032 1043 1033 if (lpitem->fType & MF_OWNERDRAW) … … 1074 1064 1075 1065 if ((lpitem->fState & MF_HILITE) && !(IS_BITMAP_ITEM(lpitem->fType))) 1076 if (menuBar)1077 DrawEdge(hdc, &rect, BDR_SUNKENOUTER, BF_RECT);1078 else1079 1066 FillRect( hdc, &rect, GetSysColorBrush(COLOR_HIGHLIGHT) ); 1080 1067 else { … … 1385 1372 } 1386 1373 1387 FillRect(hDC, lprect, GetSysColorBrush(COLOR_MENU) ); 1388 1389 SelectObject( hDC, GetSysColorPen(COLOR_3DFACE)); 1390 MoveToEx( hDC, lprect->left, lprect->bottom,NULL); 1391 LineTo( hDC, lprect->right, lprect->bottom ); 1374 HDC memDC; 1375 HBITMAP memBmp,oldBmp; 1376 RECT r; 1377 HFONT oldMemFont; 1378 1379 memDC = CreateCompatibleDC(hDC); 1380 r = *lprect; 1381 r.right -= r.left; 1382 r.bottom -= r.top; 1383 r.left = r.top = 0; 1384 memBmp = CreateCompatibleBitmap(hDC,r.right,r.bottom+1); 1385 oldBmp = SelectObject(memDC,memBmp); 1386 oldMemFont = SelectObject(memDC,hMenuFont); 1387 1388 FillRect(memDC,&r,GetSysColorBrush(COLOR_MENU)); 1389 1390 SelectObject(memDC,GetSysColorPen(COLOR_3DFACE)); 1391 MoveToEx(memDC,r.left,r.bottom,NULL); 1392 LineTo(memDC,r.right,r.bottom); 1392 1393 1393 1394 if (lppop->nItems == 0) 1394 1395 { 1395 1396 goto END;1397 }1398 1399 for (i = 0; i < lppop->nItems; i++)1400 {1396 retvalue = GetSystemMetrics(SM_CYMENU); 1397 } else 1398 { 1399 for (i = 0; i < lppop->nItems; i++) 1400 { 1401 OffsetRect(&lppop->items[i].rect,-lprect->left,-lprect->top); 1401 1402 MENU_DrawMenuItem( hwnd,getMenu(hwnd), GetWindow(hwnd,GW_OWNER), 1402 hDC, &lppop->items[i], lppop->Height, TRUE, ODA_DRAWENTIRE ); 1403 } 1404 retvalue = lppop->Height; 1403 memDC, &lppop->items[i], lppop->Height, TRUE, ODA_DRAWENTIRE ); 1404 OffsetRect(&lppop->items[i].rect,lprect->left,lprect->top); 1405 } 1406 retvalue = lppop->Height; 1407 } 1408 1409 BitBlt(hDC,lprect->left,lprect->top,lprect->right-lprect->left,lprect->bottom-lprect->top+1,memDC,0,0,SRCCOPY); 1410 SelectObject(memDC,oldBmp); 1411 if (oldMemFont) SelectObject(memDC,oldMemFont); 1412 DeleteObject(memBmp); 1413 DeleteDC(memDC); 1405 1414 1406 1415 END: … … 2103 2112 * Walks menu chain trying to find a menu pt maps to. 2104 2113 */ 2105 static HMENU MENU_PtMenu( HMENU hMenu, POINT pt)2114 static HMENU MENU_PtMenu(HMENU hMenu,POINT pt,BOOL inMenuBar) 2106 2115 { 2107 2116 POPUPMENU *menu = (POPUPMENU*)hMenu; … … 2112 2121 (menu->items[ht].fType & MF_POPUP) && 2113 2122 (menu->items[ht].fState & MF_MOUSESELECT)) 2114 ? (UINT) MENU_PtMenu(menu->items[ht].hSubMenu, pt) : 0;2123 ? (UINT) MENU_PtMenu(menu->items[ht].hSubMenu,pt,inMenuBar) : 0; 2115 2124 2116 2125 if( !ht ) /* check the current window (avoiding WM_HITTEST) */ … … 2126 2135 else 2127 2136 { 2128 ht = ( ht == HTSYSMENU) ? (UINT)(getSysMenu(menu->hWnd))2129 : ( ht == HTMENU) ? (UINT)(getMenu(menu->hWnd)) : 0;2137 ht = ((ht == HTSYSMENU) && !inMenuBar) ? (UINT)(getSysMenu(menu->hWnd)) 2138 : ((ht == HTMENU) && inMenuBar) ? (UINT)(getMenu(menu->hWnd)) : 0; 2130 2139 } 2131 2140 } … … 2402 2411 if( hNewWnd != pmt->hOwnerWnd ) 2403 2412 { 2404 ReleaseCapture(); 2413 ReleaseCapture(); 2405 2414 pmt->hOwnerWnd = hNewWnd; 2406 2415 SetCapture(pmt->hOwnerWnd); //SvL: Don't know if this is good enough 2407 2416 //EVENT_Capture( pmt->hOwnerWnd, HTMENU ); //CB: todo 2408 2417 } … … 2568 2577 * Menu tracking code. 2569 2578 */ 2570 static INT MENU_TrackMenu( HMENU hmenu, UINT wFlags, INT x, INT y, 2571 HWND hwnd, const RECT *lprect ) 2579 static INT MENU_TrackMenu(HMENU hmenu,UINT wFlags,INT x,INT y,HWND hwnd,BOOL inMenuBar,const RECT *lprect) 2572 2580 { 2573 2581 MSG msg; … … 2606 2614 * clear that menu loop is not over yet. */ 2607 2615 // if (!GetMessageA(&msg,msg.hwnd,0,0)) break; 2608 2616 //SvL: Getting messages for only the menu delays background paints (i.e. VPBuddy logo) 2609 2617 if (!GetMessageA(&msg,0,0,0)) break; 2610 2618 TranslateMessage( &msg ); … … 2619 2627 /* Find a menu for this mouse event */ 2620 2628 POINT pt = msg.pt; 2621 hmenu = MENU_PtMenu( mt.hTopMenu, pt ); 2629 2630 hmenu = MENU_PtMenu(mt.hTopMenu,pt,inMenuBar); 2622 2631 2623 2632 switch(msg.message) … … 2828 2837 void MENU_TrackMouseMenuBar( HWND hWnd, INT ht, POINT pt ) 2829 2838 { 2830 HMENU hMenu = (ht == HTSYSMENU) ? getSysMenu(hWnd):getMenu(hWnd);2839 HMENU hMenu = (ht == 0) ? getMenu(hWnd):getSysMenu(hWnd); 2831 2840 UINT wFlags = TPM_ENTERIDLEEX | TPM_BUTTONDOWN | TPM_LEFTALIGN | TPM_LEFTBUTTON; 2832 2841 … … 2836 2845 { 2837 2846 MENU_InitTracking( hWnd, hMenu, FALSE, wFlags ); 2838 MENU_TrackMenu( hMenu, wFlags, pt.x, pt.y, hWnd, NULL );2847 MENU_TrackMenu( hMenu, wFlags, pt.x, pt.y, hWnd,ht == 0, NULL ); 2839 2848 MENU_ExitTracking(hWnd); 2840 2849 } … … 2895 2904 PostMessageA( hWnd, WM_KEYDOWN, VK_DOWN, 0L ); 2896 2905 2897 MENU_TrackMenu( hTrackMenu, wFlags, 0, 0, hWnd, NULL );2906 MENU_TrackMenu( hTrackMenu, wFlags, 0, 0, hWnd,TRUE, NULL ); 2898 2907 } 2899 2908 … … 2924 2933 2925 2934 if (MENU_ShowPopup( hWnd, hMenu, 0, x, y, 0, 0 )) 2926 ret = MENU_TrackMenu( hMenu, wFlags | TPM_POPUPMENU, 0, 0, hWnd, lpRect );2935 ret = MENU_TrackMenu( hMenu, wFlags | TPM_POPUPMENU, 0, 0, hWnd,FALSE, lpRect ); 2927 2936 MENU_ExitTracking(hWnd); 2928 2937 … … 3311 3320 3312 3321 if (IS_STRING_ITEM(flags) && str) 3313 3322 dprintf(("USER32: InsertMenuA %x %d %x %d %s", hMenu, pos, flags, id, str)); 3314 3323 // TRACE("hMenu %04x, pos %d, flags %08x, " 3315 3324 // "id %04x, str '%s'\n", 3316 3325 // hMenu, pos, flags, id, str ); 3317 3326 else // TRACE("hMenu %04x, pos %d, flags %08x, " 3318 3327 dprintf(("USER32: InsertMenuA %x %d %x %d %x", hMenu, pos, flags, id, str)); 3319 3328 // "id %04x, str %08lx (not a string)\n", 3320 3329 // hMenu, pos, flags, id, (DWORD)str ); … … 3445 3454 if (IS_STRING_ITEM(flags)) 3446 3455 { 3447 3456 dprintf(("USER32: ModifyMenuA, %x %d %x %d %s", hMenu, pos, flags, id, str)); 3448 3457 //TRACE("%04x %d %04x %04x '%s'\n", 3449 3458 // hMenu, pos, flags, id, str ? str : "#NULL#" ); … … 3452 3461 else 3453 3462 { 3454 3463 dprintf(("USER32: ModifyMenuA, %x %d %x %d %x", hMenu, pos, flags, id, str)); 3455 3464 //TRACE("%04x %d %04x %04x %08lx\n", 3456 3465 // hMenu, pos, flags, id, (DWORD)str );
Note:
See TracChangeset
for help on using the changeset viewer.