Deskbar: Re-add tooltip code for truncated items

I accidentally removed it last commit, sorry about that.
This commit is contained in:
John Scipione 2013-10-08 20:51:32 -04:00
parent 4875d5a091
commit 54c746641a

View File

@ -348,6 +348,55 @@ TExpandoMenuBar::MouseMoved(BPoint where, uint32 code, const BMessage* message)
// force a cleanup
_FinishedDrag();
switch (code) {
case B_INSIDE_VIEW:
{
BMenuItem* menuItem;
TTeamMenuItem* item = TeamItemAtPoint(where, &menuItem);
TWindowMenuItem* windowMenuItem
= dynamic_cast<TWindowMenuItem*>(menuItem);
if (item == NULL || menuItem == NULL) {
// item is NULL, remove the tooltip and break out
fLastMousedOverItem = NULL;
SetToolTip((const char*)NULL);
break;
}
if (menuItem == fLastMousedOverItem) {
// already set the tooltip for this item, break out
break;
}
if (windowMenuItem != NULL && fBarView->Vertical()
&& fBarView->ExpandoState() && item->IsExpanded()) {
// expando mode window menu item
fLastMousedOverItem = menuItem;
if (strcmp(windowMenuItem->Label(),
windowMenuItem->FullTitle()) != 0) {
// label is truncated, set tooltip
SetToolTip(windowMenuItem->FullTitle());
} else
SetToolTip((const char*)NULL);
break;
}
if (item->HasLabel()) {
// item has a visible label, remove the tooltip and break out
fLastMousedOverItem = menuItem;
SetToolTip((const char*)NULL);
break;
}
SetToolTip(item->Name());
// new item, set the tooltip to the item name
fLastMousedOverItem = menuItem;
// save the current menuitem for the next MouseMoved() call
break;
}
}
BMenuBar::MouseMoved(where, code, message);
return;
}