Changeset 3153 for trunk/src/user32/menu.cpp
- Timestamp:
- Mar 18, 2000, 5:13:41 PM (25 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/user32/menu.cpp
r2852 r3153 1 /* $Id: menu.cpp,v 1.1 8 2000-02-21 17:25:28cbratschi Exp $*/1 /* $Id: menu.cpp,v 1.19 2000-03-18 16:13:34 cbratschi Exp $*/ 2 2 /* 3 3 * Menu functions … … 9 9 * Copyright 1999 Christoph Bratschi 10 10 * 11 * Corel version: 20000 21212 * WINE version: 2000013011 * Corel version: 20000317 12 * (WINE version: 20000130) 13 13 * 14 14 * Status: ??? … … 614 614 615 615 if (((*hmenu)==0xffff) || (!(menu = MENU_GetMenu(*hmenu)))) return NULL; 616 if (!menu) return NULL; 616 617 if (wFlags & MF_BYPOSITION) 617 618 { … … 1630 1631 SetWindowPos( menu->hWnd, HWND_TOP, 0, 0, 0, 0, 1631 1632 SWP_SHOWWINDOW | SWP_NOSIZE | SWP_NOMOVE | SWP_NOACTIVATE ); 1633 EnableWindow(menu->hWnd,TRUE); 1632 1634 UpdateWindow( menu->hWnd ); 1633 1635 return TRUE; … … 2370 2372 MENUITEM *item; 2371 2373 2372 2374 MENU_SwitchTracking( pmt, hPtMenu, id ); 2373 2375 2374 2376 … … 2376 2378 Test to see if we are trying to popup a submenu or not. 2377 2379 If we aren't, don't change the current menu pointer 2378 2380 and return. 2379 2381 */ 2380 2382 if (!(menu = (POPUPMENU *)MENU_GetMenu( hPtMenu ))) 2381 2383 { 2382 2384 pmt->hCurrentMenu = hPtMenu; 2383 2385 return TRUE; 2384 2386 } 2385 2387 … … 2388 2390 { 2389 2391 pmt->hCurrentMenu = hPtMenu; 2390 2392 return TRUE; 2391 2393 } 2392 2394 … … 2396 2398 { 2397 2399 pmt->hCurrentMenu = hPtMenu; 2398 2400 return TRUE; 2399 2401 } 2400 2402 2401 2402 /* 2403 If we made it this far, we want to pop up a submenu. Before we pop it up, 2404 we want a slight delay. This is implemented by remembering the ID of the menu 2405 where the mouse is currently positioned, and setting up a timer. When the 2406 timer fires (handled in MENU_TrackMenu() ), if the mouse is over the same 2407 submenu item, we popup it up. Otherwise, we do nothing. 2403 /* Check to see if we are trying to popup a toplevel menu or a 2404 submenu. Only the submenu has a delay. 2408 2405 */ 2409 KillTimer (pmt->hOwnerWnd, SUBMENU_POPUP_TIMERID); /* Just in case another timer was set up and not fired yet... */ 2410 if ( (SetTimer (pmt->hOwnerWnd, SUBMENU_POPUP_TIMERID, POPUP_MENU_DELAY, NULL)) != SUBMENU_POPUP_TIMERID) 2406 if (uSubPWndLevel) 2411 2407 { 2412 /* 2413 For some reason the timer wasn't set up properly... Revert to old 2414 functionality. 2415 */ 2416 2417 pmt->hCurrentMenu = MENU_ShowSubPopup(pmt->hOwnerWnd, hPtMenu, FALSE, wFlags,&pmt->pt); 2408 /* 2409 If we made it here, we want to pop up a submenu. Before we pop it up, 2410 we want a slight delay. This is implemented by remembering the ID of the menu 2411 where the mouse is currently positioned, and setting up a timer. When the 2412 timer fires (handled in MENU_TrackMenu() ), if the mouse is over the same 2413 submenu item, we popup it up. Otherwise, we do nothing. 2414 */ 2415 KillTimer (pmt->hOwnerWnd, SUBMENU_POPUP_TIMERID); /* Just in case another timer was set up and not fired yet... */ 2416 if ( (SetTimer (pmt->hOwnerWnd, SUBMENU_POPUP_TIMERID, POPUP_MENU_DELAY, NULL)) != SUBMENU_POPUP_TIMERID) 2417 { 2418 /* 2419 For some reason the timer wasn't set up properly... Revert to old 2420 functionality. 2421 */ 2422 pmt->hCurrentMenu = MENU_ShowSubPopup(pmt->hOwnerWnd,hPtMenu,FALSE,wFlags,&pmt->pt); 2423 return TRUE; 2424 } 2425 } else 2426 { 2427 /* We are trying to popup a top level menu... so no delay */ 2428 2429 pmt->hCurrentMenu = MENU_ShowSubPopup(pmt->hOwnerWnd, hPtMenu, FALSE, wFlags,&pmt->pt); 2418 2430 return TRUE; 2419 }2431 } 2420 2432 2421 2433 mouseOverMenuID = id; … … 2695 2707 MTRACKER mt; 2696 2708 BOOL enterIdleSent = FALSE; 2709 BOOL bSysMenu; 2697 2710 2698 2711 mt.trackFlags = 0; … … 2709 2722 fEndMenu = FALSE; 2710 2723 if (!(menu = MENU_GetMenu(hmenu))) return FALSE; 2724 2725 bSysMenu = IS_SYSTEM_MENU(menu); 2711 2726 2712 2727 if (wFlags & TPM_BUTTONDOWN) … … 2754 2769 case WM_RBUTTONDOWN: 2755 2770 if (!(wFlags & TPM_RIGHTBUTTON)) break; 2756 /* fall through */2771 goto buttondown; 2757 2772 case WM_LBUTTONDBLCLK: 2773 if (bSysMenu && (hmenu == mt.hTopMenu)) 2774 { 2775 fEndMenu = TRUE; 2776 break; 2777 } 2778 /* fall through */ 2758 2779 case WM_LBUTTONDOWN: 2759 2780 /* If the message belongs to the menu, removes it from the queue */ 2760 2781 /* Else, end menu tracking */ 2782 2783 buttondown: 2784 /* Forcing mouse popup NOW - Ensure timer doesn't popup menu also */ 2785 mouseOverMenuID = -1; 2761 2786 fRemove = MENU_ButtonDown( &mt, hmenu, wFlags ); 2762 2787 fEndMenu = !fRemove; … … 2770 2795 if (hmenu) 2771 2796 { 2797 /* Forcing mouse popup NOW - Ensure timer doesn't popup menu also */ 2798 mouseOverMenuID = -1; 2772 2799 executedMenuId = MENU_ButtonUp( &mt, hmenu, wFlags); 2773 2800 … … 2791 2818 } /* switch(msg.message) - mouse */ 2792 2819 } 2793 2794 2795 2820 else if (msg.message == WM_TIMER) 2821 { 2822 UINT id = -1; 2796 2823 POPUPMENU *ptmenu = NULL; 2797 2824 2798 2825 if (isTimerSet) 2799 2826 { 2800 2827 /* 2801 2802 2803 2804 2805 2806 2828 If we get here, an attempt was made to pop up a submenu. 2829 (See MENU_MouseMove() ) 2830 */ 2831 2832 /* Get the ID of the menu item the mouse is over now. */ 2833 if( hmenu ) 2807 2834 { 2808 2835 ptmenu = (POPUPMENU *)MENU_GetMenu( hmenu ); … … 2811 2838 else 2812 2839 MENU_FindItemByCoords( ptmenu, mt.pt, &id ); 2840 2841 /* If it is over the same item that set up the timer originally .... */ 2842 if (mouseOverMenuID != -1 && mouseOverMenuID == id) 2843 { 2844 /* .... Pop up the menu */ 2845 mt.hCurrentMenu = MENU_ShowSubPopup(mt.hOwnerWnd, hmenu, FALSE, wFlags,&mt.pt); 2846 } 2813 2847 } 2814 2815 /* If it is over the same item that set up the timer 2816 originally .... */ 2817 if (mouseOverMenuID == id) 2818 { 2819 /* .... Pop up the menu */ 2820 mt.hCurrentMenu = MENU_ShowSubPopup(mt.hOwnerWnd, hmenu, FALSE, wFlags,&mt.pt); 2821 } 2822 2823 /* Reset the timer so it doesn't fire again. (So we are ready for the next 2824 attempt to popup a submenu... ) */ 2825 KillTimer (mt.hOwnerWnd, 100); 2826 isTimerSet = FALSE; 2827 } 2828 } 2848 2849 /* Reset the timer so it doesn't fire again. (So we are ready for the next 2850 attempt to popup a submenu... ) */ 2851 KillTimer(mt.hOwnerWnd,SUBMENU_POPUP_TIMERID); 2852 isTimerSet = FALSE; 2853 } 2854 } 2829 2855 else if ((msg.message >= WM_KEYFIRST) && (msg.message <= WM_KEYLAST)) 2830 2856 { … … 2866 2892 break; 2867 2893 2868 2869 2870 2871 2872 2873 2874 2875 else 2876 2877 2878 2879 2880 2881 2882 2883 2894 case VK_F1: 2895 { 2896 HELPINFO hi; 2897 hi.cbSize = sizeof(HELPINFO); 2898 hi.iContextType = HELPINFO_MENUITEM; 2899 if (menu->FocusedItem == NO_SELECTED_ITEM) 2900 hi.iCtrlId = 0; 2901 else 2902 hi.iCtrlId = menu->items[menu->FocusedItem].wID; 2903 hi.hItemHandle = hmenu; 2904 hi.dwContextId = menu->dwContextHelpID; 2905 hi.MousePos = msg.pt; 2906 //TRACE_(winhelp)("Sending HELPINFO_MENUITEM to 0x%08x\n", hwnd); 2907 SendMessageA(hwnd, WM_HELP, 0, (LPARAM)&hi); 2908 break; 2909 } 2884 2910 2885 2911 default: … … 2929 2955 } /* switch(msg.message) - kbd */ 2930 2956 } 2957 else if (msg.message == WM_SYSCOMMAND) 2958 { 2959 /* The user clicked on the system menu/button */ 2960 fEndMenu = TRUE; 2961 break; 2962 } 2931 2963 else 2932 2964 {
Note:
See TracChangeset
for help on using the changeset viewer.