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 BOOL xxxSetMenu(
00028
PWND pwnd,
00029
PMENU pMenu,
00030 BOOL fRedraw)
00031 {
00032
CheckLock(pwnd);
00033
CheckLock(pMenu);
00034
00035
if (!
TestwndChild(pwnd)) {
00036
00037
LockWndMenu(pwnd, &pwnd->
spmenu, pMenu);
00038
00039
00040
00041
00042
00043
00044
00045
00046
if (!
TestWF(pwnd,
WFMINIMIZED) && fRedraw)
00047
xxxRedrawFrame(pwnd);
00048
00049
return TRUE;
00050 }
00051
00052 RIPERR0(ERROR_CHILD_WINDOW_MENU, RIP_VERBOSE,
"");
00053
return FALSE;
00054 }
00055
00056
00057
00058
00059
00060
00061
00062
00063
00064
00065 BOOL xxxSetSystemMenu(
00066
PWND pwnd,
00067
PMENU pMenu)
00068 {
00069
CheckLock(pwnd);
00070
CheckLock(pMenu);
00071
00072
if (
TestWF(pwnd,
WFSYSMENU)) {
00073
PMENU pmenuT = pwnd->
spmenuSys;
00074
if (
LockWndMenu(pwnd, &pwnd->
spmenuSys, pMenu))
00075
_DestroyMenu(pmenuT);
00076
00077
MNPositionSysMenu(pwnd, pMenu);
00078
00079
return TRUE;
00080 }
00081
00082 RIPERR0(ERROR_NO_SYSTEM_MENU, RIP_VERBOSE,
"");
00083
return FALSE;
00084 }
00085
00086
00087
00088
00089
00090
00091
00092
00093
00094
00095 BOOL xxxSetDialogSystemMenu(
00096
PWND pwnd)
00097 {
00098
PMENU pMenu;
00099
00100
CheckLock(pwnd);
00101
00102 pMenu = pwnd->
head.rpdesk->spmenuDialogSys;
00103
if (pMenu ==
NULL) {
00104 pMenu =
xxxLoadSysDesktopMenu (&pwnd->
head.rpdesk->spmenuDialogSys,
ID_DIALOGSYSMENU);
00105 }
00106
00107
LockWndMenu(pwnd, &pwnd->
spmenuSys, pMenu);
00108
00109
return (pMenu !=
NULL);
00110 }
00111
00112
00113
00114
00115
00116
00117
00118
00119
00120
00121
00122
00123
00124 void xxxEndMenu(
00125
PMENUSTATE pMenuState)
00126 {
00127
BOOL fMenuStateOwner;
00128
PPOPUPMENU ppopup;
00129
PTHREADINFO ptiCurrent;
00130
00131
if ((ppopup = pMenuState->
pGlobalPopupMenu) ==
NULL) {
00132
00133
00134
00135
00136
00137
00138 UserAssert(!pMenuState->
fInsideMenuLoop && !pMenuState->
fMenuStarted);
00139
return;
00140 }
00141
00142
00143
00144 pMenuState->
fInsideMenuLoop =
FALSE;
00145 pMenuState->
fMenuStarted =
FALSE;
00146
00147
00148
00149
00150
00151 ppopup->
fDestroyed =
TRUE;
00152
00153
00154
00155
00156
00157 ptiCurrent =
PtiCurrent();
00158 fMenuStateOwner = (ptiCurrent == pMenuState->
ptiMenuStateOwner);
00159
00160
00161
00162
00163
if (ptiCurrent->pq->spwndCapture == pMenuState->
pGlobalPopupMenu->
spwndNotify) {
00164
xxxMNReleaseCapture();
00165 }
00166
00167
00168
00169
00170
if (!fMenuStateOwner) {
00171 RIPMSG1(RIP_WARNING,
"xxxEndMenu: Thread %#p doesn't own the menu loop", ptiCurrent);
00172
return;
00173 }
00174
00175
00176
00177
00178
00179
if (pMenuState->
fInEndMenu) {
00180 RIPMSG1(RIP_WARNING,
"xxxEndMenu: already in EndMenu. pMenuState:%#p", pMenuState);
00181
return;
00182 }
00183 pMenuState->
fInEndMenu =
TRUE;
00184
00185
if (pMenuState->
pGlobalPopupMenu->
spwndNotify !=
NULL) {
00186
if (!pMenuState->
pGlobalPopupMenu->
fInCancel) {
00187
xxxMNDismiss(pMenuState);
00188 }
00189 }
else {
00190
BOOL fTrackedPopup = ppopup->
fIsTrackPopup;
00191
00192
00193
00194
00195
00196
xxxMNCloseHierarchy(ppopup, pMenuState);
00197
00198
if (fTrackedPopup) {
00199
xxxDestroyWindow(ppopup->
spwndPopupMenu);
00200 }
00201
00202 }
00203
00204 }