Main Page | Class Hierarchy | Class List | File List | Class Members | File Members

mnsel.c File Reference

#include "precomp.h"

Go to the source code of this file.

Functions

void xxxSendMenuSelect (PWND pwndNotify, PWND pwndMenu, PMENU pMenu, int idx)


Function Documentation

void xxxSendMenuSelect PWND  pwndNotify,
PWND  pwndMenu,
PMENU  pMenu,
int  idx
 

Definition at line 29 of file mnsel.c.

References _CallMsgFilter(), CheckLock, tagMENU::cItems, DWORD, tagMENUSTATE::fIsSysMenu, tagITEM::fState, tagITEM::fType, FWINABLE, GetpMenuState(), HW, MF_MAINMENU, MFMWFP_NOITEM, tagMENUSTATE::mnFocus, MOUSEHOLD, msg, NULL, PtoH, tagMENU::rgItems, SMS_NOMENU, tagITEM::spSubMenu, UINT, tagITEM::wID, xxxSendNotifyMessage(), and xxxWindowEvent().

Referenced by xxxMNCancel(), xxxMNCloseHierarchy(), xxxMNDoubleClick(), xxxMNInvertItem(), and xxxMNSelectItem().

00034 { 00035 UINT cmd; // Menu ID if applicable. 00036 UINT flags; // MF_ values if any 00037 MSG msg; 00038 PMENUSTATE pMenuState; 00039 00040 CheckLock(pwndNotify); 00041 CheckLock(pwndMenu); 00042 00043 00044 /* 00045 * We must be hacking or passing valid things. 00046 */ 00047 UserAssert((pMenu != SMS_NOMENU) || (idx == MFMWFP_NOITEM)); 00048 00049 00050 if ((idx >= 0) && (pMenu->cItems > (UINT)idx)) { 00051 PITEM pItem = &(pMenu->rgItems[idx]); 00052 00053 flags = (pItem->fType & MFT_OLDAPI_MASK) | 00054 (pItem->fState & MFS_OLDAPI_MASK); 00055 00056 if (pItem->spSubMenu != NULL) 00057 flags |= MF_POPUP; 00058 00059 flags &= (~(MF_SYSMENU | MF_MOUSESELECT)); 00060 00061 /* 00062 * WARNING! 00063 * Under Windows the menu handle was always returned but additionally 00064 * if the menu was a pop-up the pop-up menu handle was returned 00065 * instead of the ID. In NT we don't have enough space for 2 handles 00066 * and flags so if it is a pop-up we return the pop-up index 00067 * and the main Menu handle. 00068 */ 00069 00070 if (flags & MF_POPUP) 00071 cmd = idx; // index of popup-menu 00072 else 00073 cmd = pItem->wID; 00074 00075 pMenuState = GetpMenuState(pwndNotify); 00076 if (pMenuState != NULL) { 00077 if (pMenuState->mnFocus == MOUSEHOLD) 00078 flags |= MF_MOUSESELECT; 00079 00080 if (pMenuState->fIsSysMenu) 00081 flags |= MF_SYSMENU; 00082 00083 } 00084 } else { 00085 /* 00086 * idx assumed to be MFMWFP_NOITEM 00087 */ 00088 if (pMenu == SMS_NOMENU) { 00089 00090 /* 00091 * Hack so we can send MenuSelect messages with MFMWFP_MAINMENU 00092 * (loword(lparam)=-1) when the menu pops back up for the CBT people. 00093 */ 00094 flags = MF_MAINMENU; 00095 } else { 00096 flags = 0; 00097 } 00098 00099 cmd = 0; // so MAKELONG(cmd, flags) == MFMWFP_MAINMENU 00100 pMenu = 0; 00101 idx = -1; // so that idx+1 == 0, meaning nothing for zzzWindowEvent() 00102 } 00103 00104 /* 00105 * Call msgfilter so help libraries can hook WM_MENUSELECT messages. 00106 */ 00107 msg.hwnd = HW(pwndNotify); 00108 msg.message = WM_MENUSELECT; 00109 msg.wParam = (DWORD)MAKELONG(cmd, flags); 00110 msg.lParam = (LPARAM)PtoH(pMenu); 00111 if (!_CallMsgFilter((LPMSG)&msg, MSGF_MENU)) { 00112 xxxSendNotifyMessage(pwndNotify, WM_MENUSELECT, msg.wParam, msg.lParam); 00113 } 00114 00115 if (FWINABLE() && pwndMenu) { 00116 xxxWindowEvent(EVENT_OBJECT_FOCUS, pwndMenu, 00117 ((pwndMenu != pwndNotify) ? OBJID_CLIENT : ((flags & MF_SYSMENU) ? OBJID_SYSMENU : OBJID_MENU)), 00118 idx+1, 0); 00119 } 00120 }


Generated on Sat May 15 19:44:47 2004 for test by doxygen 1.3.7