00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
#include "precomp.h"
00014
#pragma hdrstop
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029 void xxxSendMenuSelect(
00030
PWND pwndNotify,
00031
PWND pwndMenu,
00032
PMENU pMenu,
00033
int idx)
00034 {
00035
UINT cmd;
00036
UINT flags;
00037 MSG
msg;
00038
PMENUSTATE pMenuState;
00039
00040
CheckLock(pwndNotify);
00041
CheckLock(pwndMenu);
00042
00043
00044
00045
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
00063
00064
00065
00066
00067
00068
00069
00070
if (flags & MF_POPUP)
00071 cmd = idx;
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
00087
00088
if (pMenu ==
SMS_NOMENU) {
00089
00090
00091
00092
00093
00094 flags =
MF_MAINMENU;
00095 }
else {
00096 flags = 0;
00097 }
00098
00099 cmd = 0;
00100 pMenu = 0;
00101 idx = -1;
00102 }
00103
00104
00105
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 }