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:
parent
cc2bf27596
commit
6e11b3f991
@ -234,7 +234,7 @@ private:
|
|||||||
// private methods called by BWindow
|
// private methods called by BWindow
|
||||||
int State(BMenuItem** _item = NULL) const;
|
int State(BMenuItem** _item = NULL) const;
|
||||||
void InvokeItem(BMenuItem* item, bool now = false);
|
void InvokeItem(BMenuItem* item, bool now = false);
|
||||||
void QuitTracking();
|
void QuitTracking(bool onlyThis = true);
|
||||||
|
|
||||||
static menu_info sMenuInfo;
|
static menu_info sMenuInfo;
|
||||||
static bool sAltAsCommandKey;
|
static bool sAltAsCommandKey;
|
||||||
|
@ -868,8 +868,10 @@ BMenu::KeyDown(const char *bytes, int32 numBytes)
|
|||||||
|
|
||||||
case B_ENTER:
|
case B_ENTER:
|
||||||
case B_SPACE:
|
case B_SPACE:
|
||||||
if (fSelected)
|
if (fSelected) {
|
||||||
InvokeItem(fSelected);
|
InvokeItem(fSelected);
|
||||||
|
QuitTracking(false);
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case B_ESCAPE:
|
case B_ESCAPE:
|
||||||
@ -1974,6 +1976,8 @@ BMenu::InvokeItem(BMenuItem *item, bool now)
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
// Do the "selected" animation
|
// 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()) {
|
if (!item->Submenu() && LockLooper()) {
|
||||||
snooze(50000);
|
snooze(50000);
|
||||||
item->Select(true);
|
item->Select(true);
|
||||||
@ -2379,15 +2383,19 @@ BMenu::_CustomTrackingWantsToQuit()
|
|||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
BMenu::QuitTracking()
|
BMenu::QuitTracking(bool onlyThis)
|
||||||
{
|
{
|
||||||
_SelectItem(NULL);
|
_SelectItem(NULL);
|
||||||
if (BMenuBar *menuBar = dynamic_cast<BMenuBar *>(this))
|
if (BMenuBar *menuBar = dynamic_cast<BMenuBar *>(this))
|
||||||
menuBar->_RestoreFocus();
|
menuBar->_RestoreFocus();
|
||||||
|
|
||||||
fChosenItem = NULL;
|
fChosenItem = NULL;
|
||||||
|
|
||||||
fState = MENU_STATE_CLOSED;
|
fState = MENU_STATE_CLOSED;
|
||||||
|
|
||||||
|
// Close the whole menu hierarchy
|
||||||
|
if (!onlyThis && _IsStickyMode())
|
||||||
|
_SetStickyMode(false);
|
||||||
|
|
||||||
_Hide();
|
_Hide();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user