GRAPHICS: MACGUI: add win95 mode for menu behaviour, currently in win95 mode, it will exit the menu only when you click something useful(trigger some event)

This commit is contained in:
ysj1173886760 2021-04-17 15:19:02 +08:00 committed by Eugene Sandulenko
parent e459e5acf8
commit 5d2a73fe01
2 changed files with 51 additions and 24 deletions

View File

@ -1169,35 +1169,60 @@ bool MacMenu::checkCallback(bool unicode) {
return true;
}
void MacMenu::closeMenu() {
setActive(false);
if (_wm->_mode & kWMModeAutohideMenu)
_isVisible = false;
if (_wm->_mode & kWMModalMenuMode) {
_wm->disableScreenCopy();
}
_activeItem = -1;
_activeSubItem = -1;
_menustack.clear();
_wm->setFullRefresh(true);
}
bool MacMenu::mouseRelease(int x, int y) {
if (_active) {
setActive(false);
if (_wm->_mode & kWMModeAutohideMenu)
_isVisible = false;
if (_wm->_mode & kWMModalMenuMode) {
_wm->disableScreenCopy();
}
if (_activeItem != -1 && _activeSubItem != -1 && _menustack.back()->items[_activeSubItem]->enabled) {
if (_menustack.back()->items[_activeSubItem]->unicode) {
if (checkCallback(true))
(*_unicodeccallback)(_menustack.back()->items[_activeSubItem]->action,
_menustack.back()->items[_activeSubItem]->unicodeText, _cdata);
} else {
if (checkCallback())
(*_ccallback)(_menustack.back()->items[_activeSubItem]->action,
_menustack.back()->items[_activeSubItem]->text, _cdata);
if (!(_wm->_mode & kWMModeWin95)) {
if (_active) {
if (_activeItem != -1 && _activeSubItem != -1 && _menustack.back()->items[_activeSubItem]->enabled) {
if (_menustack.back()->items[_activeSubItem]->unicode) {
if (checkCallback(true))
(*_unicodeccallback)(_menustack.back()->items[_activeSubItem]->action,
_menustack.back()->items[_activeSubItem]->unicodeText, _cdata);
} else {
if (checkCallback())
(*_ccallback)(_menustack.back()->items[_activeSubItem]->action,
_menustack.back()->items[_activeSubItem]->text, _cdata);
}
}
closeMenu();
return true;
}
} else {
if (_active) {
_activeItem = -1;
_activeSubItem = -1;
_menustack.clear();
if (_activeItem != -1 && _activeSubItem != -1 && _menustack.back()->items[_activeSubItem]->enabled) {
if (_menustack.back()->items[_activeSubItem]->unicode) {
if (checkCallback(true)) {
(*_unicodeccallback)(_menustack.back()->items[_activeSubItem]->action,
_menustack.back()->items[_activeSubItem]->unicodeText, _cdata);
closeMenu();
}
} else {
if (checkCallback()) {
(*_ccallback)(_menustack.back()->items[_activeSubItem]->action,
_menustack.back()->items[_activeSubItem]->text, _cdata);
closeMenu();
}
}
}
_wm->setFullRefresh(true);
return true;
return true;
}
}
return false;

View File

@ -93,6 +93,8 @@ public:
void printMenu(int level = 0, MacMenuSubMenu *submenu = nullptr);
void closeMenu();
Common::Rect _bbox;
private: