Draws the explorer-style context menu to the screen
| 255 | |
| 256 | // Draws the explorer-style context menu to the screen |
| 257 | void ContextMenu::invokeMenu(HMENU menu, POINT pt, uint pos_flags) |
| 258 | { |
| 259 | |
| 260 | uint idCommand; |
| 261 | |
| 262 | // Sanity Check |
| 263 | if (!menu) return; |
| 264 | |
| 265 | // Subclass window to handle menu related messages in ContextMenu |
| 266 | if (menuType > 1) |
| 267 | { |
| 268 | if (menuType == 2) |
| 269 | { |
| 270 | contextMenu->QueryInterface(IID_IContextMenu2, (LPVOID *) &GLOBAL(g_IContext2)); |
| 271 | }else{ |
| 272 | contextMenu->QueryInterface(IID_IContextMenu3, (LPVOID *) &GLOBAL(g_IContext3)); |
| 273 | } |
| 274 | } |
| 275 | |
| 276 | // Invoke the menu |
| 277 | GLOBAL(OldWndProc) = (WNDPROC) SetWindowLong(winOS->GetWindowsHandle(), GWL_WNDPROC,(DWORD) HookWndProc); |
| 278 | _currentHmenu = menu; |
| 279 | _prevHmenu = NULL; |
| 280 | _currentHmenuRegion = QPolygon(); |
| 281 | _unionMenuRectOnNextEnterIdle = false; |
| 282 | idCommand = tryTrackPopupMenu(menu, TPM_RETURNCMD | pos_flags | TPM_VERPOSANIMATION, pt.x, pt.y, NULL, winOS->GetWindowsHandle(), NULL); |
| 283 | _unionMenuRectOnNextEnterIdle = false; |
| 284 | _prevHmenu = NULL; |
| 285 | _currentHmenu = NULL; |
| 286 | SetWindowLong(winOS->GetWindowsHandle(), GWL_WNDPROC,(DWORD) GLOBAL(OldWndProc)); |
| 287 | |
| 288 | // See if there was a command chosen |
| 289 | if (idCommand >= MIN_ID && idCommand <= MAX_ID) |
| 290 | { |
| 291 | invokeCommand(contextMenu, idCommand - MIN_ID); |
| 292 | } |
| 293 | |
| 294 | // destroy the marking menu since we have made a selection |
| 295 | if (winOS->IsWindowsVersionGreaterThanOrEqualTo(Windows7)) |
| 296 | markingMenu->destroy(); |
| 297 | |
| 298 | SAFE_RELEASE(GLOBAL(g_IContext2)); |
| 299 | SAFE_RELEASE(GLOBAL(g_IContext3)); |
| 300 | |
| 301 | // Release the context Menu when were done |
| 302 | SAFE_RELEASE(contextMenu); |
| 303 | } |
| 304 | |
| 305 | void ContextMenu::invokeCommand(LPCONTEXTMENU pContextMenu, UINT idCommand) |
| 306 | { |
nothing calls this directly
no test coverage detected