Close the whole menu hierarchy when invoking an item via keyboard. Added

a TODO comment.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@23389 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Stefano Ceccherini 2008-01-11 12:08:21 +00:00
parent cc2bf27596
commit 6e11b3f991
2 changed files with 12 additions and 4 deletions

View File

@ -234,7 +234,7 @@ private:
// private methods called by BWindow
int State(BMenuItem** _item = NULL) const;
void InvokeItem(BMenuItem* item, bool now = false);
void QuitTracking();
void QuitTracking(bool onlyThis = true);
static menu_info sMenuInfo;
static bool sAltAsCommandKey;

View File

@ -868,8 +868,10 @@ BMenu::KeyDown(const char *bytes, int32 numBytes)
case B_ENTER:
case B_SPACE:
if (fSelected)
if (fSelected) {
InvokeItem(fSelected);
QuitTracking(false);
}
break;
case B_ESCAPE:
@ -1974,6 +1976,8 @@ BMenu::InvokeItem(BMenuItem *item, bool now)
return;
// Do the "selected" animation
// TODO: Doesn't work. This is supposed to highlight
// and dehighlight the item, works on beos but not on haiku.
if (!item->Submenu() && LockLooper()) {
snooze(50000);
item->Select(true);
@ -2379,15 +2383,19 @@ BMenu::_CustomTrackingWantsToQuit()
void
BMenu::QuitTracking()
BMenu::QuitTracking(bool onlyThis)
{
_SelectItem(NULL);
if (BMenuBar *menuBar = dynamic_cast<BMenuBar *>(this))
menuBar->_RestoreFocus();
fChosenItem = NULL;
fState = MENU_STATE_CLOSED;
// Close the whole menu hierarchy
if (!onlyThis && _IsStickyMode())
_SetStickyMode(false);
_Hide();
}