bool SpyFrame::handleContextMenu(dwt::ScreenCoordinate pt) { if(searches->countSelected() == 1) { if(pt.x() == -1 && pt.y() == -1) { pt = searches->getContextMenuPos(); } MenuPtr contextMenu = addChild(WinUtil::Seeds::menu); contextMenu->appendItem<Menu::SimpleDispatcher>(IDC_SEARCH, T_("&Search"), std::tr1::bind(&SpyFrame::handleSearch, this, searches->getText(searches->getSelected(), COLUMN_STRING)), dwt::BitmapPtr(new dwt::Bitmap(IDB_SEARCH))); contextMenu->trackPopupMenu(pt, TPM_LEFTALIGN | TPM_RIGHTBUTTON); return true; } return false; }
bool UsersFrame::handleContextMenu(dwt::ScreenCoordinate pt) { if (users->hasSelected()) { if(pt.x() == -1 && pt.y() == -1) { pt = users->getContextMenuPos(); } MenuPtr menu = addChild(WinUtil::Seeds::menu); appendUserItems(getParent(), menu); menu->appendSeparatorItem(); menu->appendItem(IDC_EDIT, T_("&Description"), std::tr1::bind(&UsersFrame::handleDescription, this)); menu->appendItem(IDC_REMOVE, T_("&Remove"), std::tr1::bind(&UsersFrame::handleRemove, this)); menu->trackPopupMenu(pt, TPM_LEFTALIGN | TPM_RIGHTBUTTON); return true; } return false; }
bool HwndSourceHookMenuPopup::HandleMouseMove(suic::MessageParameter& mp) { bool handled = false; MenuPtr hotMenu = HitTestPopup(); if (IsMouseCapture()) { handled = true; if (!hotMenu) { if (_focusMenu) { suic::MouseEventArg ef(NULL, mp.point); _focusMenu->OnMouseLeave(ef); } _focusMenu = hotMenu; } else { suic::MouseEventArg e(hotMenu.get(), suic::SystemHelper::GetCursorPoint(hotMenu.get())); if (_focusMenu && _focusMenu != hotMenu) { suic::MouseEventArg ef(hotMenu.get(), mp.point); _focusMenu->OnMouseLeave(ef); } hotMenu->OnMouseMove(e); _focusMenu = hotMenu; } } else if (!hotMenu) { handled = true; suic::HwndHelper::HandleDefWndMessage(mp); } return handled; }
bool AutoSearchFrame::handleContextMenu(dwt::ScreenCoordinate pt) { if(pt.x() == -1 && pt.y() == -1) { pt = items->getContextMenuPos(); } MenuPtr contextMenu = addChild(WinUtil::Seeds::menu); contextMenu->appendItem(IDC_ADD, T_("&New..."), std::tr1::bind(&AutoSearchFrame::handleAdd, this)); contextMenu->appendItem(IDC_EDIT, T_("&Properties"), std::tr1::bind(&AutoSearchFrame::handleProperties, this)); contextMenu->appendItem(IDC_REMOVE, T_("&Remove"), std::tr1::bind(&AutoSearchFrame::handleRemove, this)); bool status = items->hasSelected(); contextMenu->setItemEnabled(IDC_EDIT, false, status); contextMenu->setItemEnabled(IDC_REMOVE, false, status); contextMenu->trackPopupMenu(pt, TPM_LEFTALIGN | TPM_RIGHTBUTTON); return true; }
void HwndSourceHookMenuPopup::HandleMouseUp() { _popup->ReleaseCaptureMouse(); MenuPtr focusMenu = HitTestPopup(); if (focusMenu) { bool bIsMain = (focusMenu == _mainMenu); suic::ElementPtr hot = suic::SystemHelper::GetMouseOverElement(focusMenu.get()); MenuItemPtr menuPtr = MenuItemPtr::cast(hot); if (menuPtr) { if (menuPtr->IsEnabled()) { if (!bIsMain && !menuPtr->IsSubmenu()) { InternalCloseTrackMenuPopup(); } menuPtr->OnClick(focusMenu.get(), bIsMain); if (menuPtr->MenuItemClick) { menuPtr->MenuItemClick(focusMenu.get(), menuPtr.get()); } else if (focusMenu->MenuItemClick) { focusMenu->MenuItemClick(focusMenu.get(), menuPtr.get()); } } } } else { InternalCloseTrackMenuPopup(); } }