Merge pull request #1365 from Olathuss/closeMenu

Close Menu Implemented
This commit is contained in:
Brian Roberts 2025-01-26 11:52:53 -06:00 committed by GitHub
commit 4a0bb46b49
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 14 additions and 0 deletions

View file

@ -506,6 +506,16 @@ void GuiMenuBar::onAction()
mouseDownMenu->popupMenu->showPopup(root, pos.x, pos.y);
}
void GuiMenuBar::closeMenu()
{
if(mouseDownMenu)
mouseDownMenu->popupMenu->hidePopup();
mouseOverMenu = NULL;
mouseDownMenu = NULL;
mMouseInMenu = false;
}
// Process a tick
void GuiMenuBar::processTick()
{

View file

@ -247,6 +247,10 @@ void GuiPopupMenuTextListCtrl::onMouseUp(const GuiEvent &event)
{
if (item->mEnabled)
{
if(mMenuBar)
{
mMenuBar->closeMenu();
}
Con::executef(mPopup, "onSelectItem", Con::getIntArg(getSelectedCell().y), item->mText.isNotEmpty() ? item->mText : String(""));
}
}