Fixed the problem mentioned in bug 484, some cleanups, implemented
BMenu::InvokeItem() more correctly. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@17519 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
@@ -1204,7 +1204,7 @@ BMenu::_track(int *action, bigtime_t trackTime, long start)
|
|||||||
// TODO: cleanup
|
// TODO: cleanup
|
||||||
BMenuItem *item = NULL;
|
BMenuItem *item = NULL;
|
||||||
bigtime_t openTime = system_time();
|
bigtime_t openTime = system_time();
|
||||||
bigtime_t closeTime = openTime;
|
bigtime_t closeTime = 0;
|
||||||
|
|
||||||
fState = MENU_STATE_TRACKING;
|
fState = MENU_STATE_TRACKING;
|
||||||
if (fSuper != NULL)
|
if (fSuper != NULL)
|
||||||
@@ -1675,10 +1675,25 @@ BMenu::State(BMenuItem **item) const
|
|||||||
void
|
void
|
||||||
BMenu::InvokeItem(BMenuItem *item, bool now)
|
BMenu::InvokeItem(BMenuItem *item, bool now)
|
||||||
{
|
{
|
||||||
if (item->Submenu())
|
if (!item->IsEnabled())
|
||||||
item->Submenu()->Show();
|
return;
|
||||||
else if (IsRadioMode())
|
|
||||||
item->SetMarked(true);
|
// Do the "selected" animation
|
||||||
|
if (!item->Submenu() && LockLooper()) {
|
||||||
|
snooze(50000);
|
||||||
|
item->Select(true);
|
||||||
|
Sync();
|
||||||
|
snooze(50000);
|
||||||
|
item->Select(false);
|
||||||
|
Sync();
|
||||||
|
snooze(50000);
|
||||||
|
item->Select(true);
|
||||||
|
Sync();
|
||||||
|
snooze(50000);
|
||||||
|
item->Select(false);
|
||||||
|
Sync();
|
||||||
|
UnlockLooper();
|
||||||
|
}
|
||||||
|
|
||||||
item->Invoke();
|
item->Invoke();
|
||||||
}
|
}
|
||||||
@@ -1740,6 +1755,12 @@ BMenuItem *
|
|||||||
BMenu::HitTestItems(BPoint where, BPoint slop) const
|
BMenu::HitTestItems(BPoint where, BPoint slop) const
|
||||||
{
|
{
|
||||||
// TODO: Take "slop" into account ?
|
// TODO: Take "slop" into account ?
|
||||||
|
|
||||||
|
// if the point doesn't lie within the menu's
|
||||||
|
// bounds, bail out immediately
|
||||||
|
if (!Bounds().Contains(where))
|
||||||
|
return NULL;
|
||||||
|
|
||||||
int32 itemCount = CountItems();
|
int32 itemCount = CountItems();
|
||||||
for (int32 i = 0; i < itemCount; i++) {
|
for (int32 i = 0; i < itemCount; i++) {
|
||||||
BMenuItem *item = ItemAt(i);
|
BMenuItem *item = ItemAt(i);
|
||||||
@@ -1779,7 +1800,6 @@ BMenu::ItemMarked(BMenuItem *item)
|
|||||||
InvalidateLayout();
|
InvalidateLayout();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if (IsLabelFromMarked() && Superitem())
|
if (IsLabelFromMarked() && Superitem())
|
||||||
Superitem()->SetLabel(item->Label());
|
Superitem()->SetLabel(item->Label());
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user