Ignore:
Timestamp:
Mar 18, 2000, 5:13:41 PM (25 years ago)
Author:
cbratschi
Message:

merged with Corel 20000317, small icon

File:
1 edited

Legend:

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

    r2852 r3153  
    1 /* $Id: menu.cpp,v 1.18 2000-02-21 17:25:28 cbratschi Exp $*/
     1/* $Id: menu.cpp,v 1.19 2000-03-18 16:13:34 cbratschi Exp $*/
    22/*
    33 * Menu functions
     
    99 * Copyright 1999 Christoph Bratschi
    1010 *
    11  * Corel version: 20000212
    12  * WINE version: 20000130
     11 * Corel version: 20000317
     12 * (WINE version: 20000130)
    1313 *
    1414 * Status:  ???
     
    614614
    615615    if (((*hmenu)==0xffff) || (!(menu = MENU_GetMenu(*hmenu)))) return NULL;
     616    if (!menu) return NULL;
    616617    if (wFlags & MF_BYPOSITION)
    617618    {
     
    16301631        SetWindowPos( menu->hWnd, HWND_TOP, 0, 0, 0, 0,
    16311632                        SWP_SHOWWINDOW | SWP_NOSIZE | SWP_NOMOVE | SWP_NOACTIVATE );
     1633        EnableWindow(menu->hWnd,TRUE);
    16321634        UpdateWindow( menu->hWnd );
    16331635        return TRUE;
     
    23702372       MENUITEM *item;
    23712373
    2372             MENU_SwitchTracking( pmt, hPtMenu, id );
     2374            MENU_SwitchTracking( pmt, hPtMenu, id );
    23732375
    23742376
     
    23762378          Test to see if we are trying to popup a submenu or not.
    23772379          If we aren't, don't change the current menu pointer
    2378           and return.
     2380          and return.
    23792381       */
    23802382       if (!(menu = (POPUPMENU *)MENU_GetMenu( hPtMenu )))
    23812383       {
    23822384          pmt->hCurrentMenu = hPtMenu;
    2383           return TRUE;
     2385          return TRUE;
    23842386       }
    23852387
     
    23882390       {
    23892391          pmt->hCurrentMenu = hPtMenu;
    2390           return TRUE;
     2392          return TRUE;
    23912393       }
    23922394
     
    23962398       {
    23972399          pmt->hCurrentMenu =  hPtMenu;
    2398           return TRUE;
     2400          return TRUE;
    23992401       }
    24002402
    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.
    24082405       */
    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)
    24112407       {
    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);
    24182430          return TRUE;
    2419     }
     2431       }
    24202432
    24212433       mouseOverMenuID = id;
     
    26952707    MTRACKER mt;
    26962708    BOOL enterIdleSent = FALSE;
     2709    BOOL bSysMenu;
    26972710
    26982711    mt.trackFlags = 0;
     
    27092722    fEndMenu = FALSE;
    27102723    if (!(menu = MENU_GetMenu(hmenu))) return FALSE;
     2724
     2725    bSysMenu = IS_SYSTEM_MENU(menu);
    27112726
    27122727    if (wFlags & TPM_BUTTONDOWN)
     
    27542769                case WM_RBUTTONDOWN:
    27552770                    if (!(wFlags & TPM_RIGHTBUTTON)) break;
    2756                     /* fall through */
     2771                    goto buttondown;
    27572772                case WM_LBUTTONDBLCLK:
     2773                    if (bSysMenu && (hmenu == mt.hTopMenu))
     2774                    {
     2775                        fEndMenu = TRUE;
     2776                        break;
     2777                    }
     2778                    /* fall through */
    27582779                case WM_LBUTTONDOWN:
    27592780                    /* If the message belongs to the menu, removes it from the queue */
    27602781                    /* Else, end menu tracking */
     2782
     2783                 buttondown:
     2784                    /* Forcing mouse popup NOW - Ensure timer doesn't popup menu also */
     2785                    mouseOverMenuID = -1;
    27612786                    fRemove = MENU_ButtonDown( &mt, hmenu, wFlags );
    27622787                    fEndMenu = !fRemove;
     
    27702795                    if (hmenu)
    27712796                    {
     2797                        /* Forcing mouse popup NOW - Ensure timer doesn't popup menu also */
     2798                        mouseOverMenuID = -1;
    27722799                        executedMenuId = MENU_ButtonUp( &mt, hmenu, wFlags);
    27732800
     
    27912818            } /* switch(msg.message) - mouse */
    27922819        }
    2793         else if (msg.message == WM_TIMER)
    2794         {
    2795            UINT id = -1;
     2820        else if (msg.message == WM_TIMER)
     2821        {
     2822           UINT id = -1;
    27962823           POPUPMENU *ptmenu = NULL;
    27972824
    27982825           if (isTimerSet)
    2799            {
     2826           {
    28002827              /*
    2801                 If we get here, an attempt was made to pop up a submenu.
    2802                 (See MENU_MouseMove() )
    2803               */
    2804 
    2805               /* Get the ID of the menu item the mouse is over now. */
    2806               if( hmenu )
     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 )
    28072834              {
    28082835                 ptmenu = (POPUPMENU *)MENU_GetMenu( hmenu );
     
    28112838                 else
    28122839                   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                  }
    28132847              }
    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        }
    28292855        else if ((msg.message >= WM_KEYFIRST) && (msg.message <= WM_KEYLAST))
    28302856        {
     
    28662892                    break;
    28672893
    2868                 case VK_F1:
    2869                     {
    2870                         HELPINFO hi;
    2871                         hi.cbSize = sizeof(HELPINFO);
    2872                         hi.iContextType = HELPINFO_MENUITEM;
    2873                         if (menu->FocusedItem == NO_SELECTED_ITEM)
    2874                             hi.iCtrlId = 0;
    2875                         else   
    2876                             hi.iCtrlId = menu->items[menu->FocusedItem].wID;
    2877                         hi.hItemHandle = hmenu;
    2878                         hi.dwContextId = menu->dwContextHelpID;
    2879                         hi.MousePos = msg.pt;
    2880                         //TRACE_(winhelp)("Sending HELPINFO_MENUITEM to 0x%08x\n", hwnd);
    2881                         SendMessageA(hwnd, WM_HELP, 0, (LPARAM)&hi);
    2882                         break;
    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                    }
    28842910
    28852911                default:
     
    29292955            }  /* switch(msg.message) - kbd */
    29302956        }
     2957        else if (msg.message == WM_SYSCOMMAND)
     2958        {
     2959                /* The user clicked on the system menu/button */
     2960        fEndMenu = TRUE;
     2961        break;
     2962        }
    29312963        else
    29322964        {
Note: See TracChangeset for help on using the changeset viewer.