some more work on menus... fixed bug #953 and some more stuff
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@19827 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
@@ -1321,9 +1321,11 @@ BMenu::_track(int *action, bigtime_t trackTime, long start)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (fSuper != NULL) {
|
if (fSuper != NULL) {
|
||||||
|
// Give supermenu the chance to continue tracking
|
||||||
*action = fState;
|
*action = fState;
|
||||||
if (locked)
|
if (locked)
|
||||||
UnlockLooper();
|
UnlockLooper();
|
||||||
|
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1770,7 +1772,13 @@ BMenu::DrawItems(BRect updateRect)
|
|||||||
int
|
int
|
||||||
BMenu::State(BMenuItem **item) const
|
BMenu::State(BMenuItem **item) const
|
||||||
{
|
{
|
||||||
return 0;
|
if (fState == MENU_STATE_TRACKING || fState == MENU_STATE_CLOSED)
|
||||||
|
return fState;
|
||||||
|
|
||||||
|
if (fSelected != NULL && fSelected->Submenu() != NULL)
|
||||||
|
return fSelected->Submenu()->State(item);
|
||||||
|
|
||||||
|
return fState;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -474,17 +474,24 @@ BMenuBar::Track(int32 *action, int32 startIndex, bool showMenu)
|
|||||||
menu->SetStickyMode(true);
|
menu->SetStickyMode(true);
|
||||||
int localAction;
|
int localAction;
|
||||||
fChosenItem = menu->_track(&localAction, system_time());
|
fChosenItem = menu->_track(&localAction, system_time());
|
||||||
|
if (menu->State(NULL) == MENU_STATE_TRACKING && menu->IsStickyMode())
|
||||||
|
menu->SetStickyMode(false);
|
||||||
|
|
||||||
// check if the user started holding down a mouse button in a submenu
|
// check if the user started holding down a mouse button in a submenu
|
||||||
if (wasSticky && !IsStickyMode())
|
if (wasSticky && !IsStickyMode())
|
||||||
buttons = 1;
|
buttons = 1;
|
||||||
// buttons must have been pressed in the meantime
|
// buttons must have been pressed in the meantime
|
||||||
|
|
||||||
if (localAction == MENU_STATE_CLOSED)
|
if (localAction == MENU_STATE_CLOSED) {
|
||||||
fState = MENU_STATE_CLOSED;
|
if (fExtraRect != NULL && fExtraRect->Contains(where)) {
|
||||||
|
SetStickyMode(true);
|
||||||
|
fExtraRect = NULL;
|
||||||
|
} else
|
||||||
|
fState = MENU_STATE_CLOSED;
|
||||||
|
}
|
||||||
|
|
||||||
} else if (menuItem == NULL && fSelected != NULL
|
} else if (menuItem == NULL && fSelected != NULL
|
||||||
&& !IsStickyMode() && fState != MENU_STATE_TRACKING_SUBMENU) {
|
&& !IsStickyMode() /*&& Bounds().Contains(where)*/ && fState != MENU_STATE_TRACKING_SUBMENU) {
|
||||||
_SelectItem(NULL);
|
_SelectItem(NULL);
|
||||||
fState = MENU_STATE_TRACKING;
|
fState = MENU_STATE_TRACKING;
|
||||||
}
|
}
|
||||||
@@ -510,6 +517,7 @@ BMenuBar::Track(int32 *action, int32 startIndex, bool showMenu)
|
|||||||
if (window->Lock()) {
|
if (window->Lock()) {
|
||||||
if (fSelected != NULL)
|
if (fSelected != NULL)
|
||||||
_SelectItem(NULL);
|
_SelectItem(NULL);
|
||||||
|
|
||||||
if (fChosenItem != NULL)
|
if (fChosenItem != NULL)
|
||||||
fChosenItem->Invoke();
|
fChosenItem->Invoke();
|
||||||
RestoreFocus();
|
RestoreFocus();
|
||||||
|
|||||||
@@ -282,8 +282,7 @@ BMenuField::MouseDown(BPoint where)
|
|||||||
|
|
||||||
fMenuBar->StartMenuBar(-1, false, true, &bounds);
|
fMenuBar->StartMenuBar(-1, false, true, &bounds);
|
||||||
|
|
||||||
fMenuTaskID = spawn_thread((thread_func)MenuTask, "_m_task_",
|
fMenuTaskID = spawn_thread((thread_func)MenuTask, "_m_task_", B_NORMAL_PRIORITY, this);
|
||||||
B_NORMAL_PRIORITY, this);
|
|
||||||
if (fMenuTaskID)
|
if (fMenuTaskID)
|
||||||
resume_thread(fMenuTaskID);
|
resume_thread(fMenuTaskID);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user