From f3ac8bc08985fe1ca60569001f7e914eaa3e62e3 Mon Sep 17 00:00:00 2001 From: John Scipione Date: Sun, 3 Mar 2013 23:36:08 -0500 Subject: [PATCH] Show the full window title in Deskbar in a tooltip ... if it gets truncated in vertical expando mode. --- src/apps/deskbar/ExpandoMenuBar.cpp | 36 +++++++++++++++++++++-------- src/apps/deskbar/ExpandoMenuBar.h | 2 +- 2 files changed, 27 insertions(+), 11 deletions(-) diff --git a/src/apps/deskbar/ExpandoMenuBar.cpp b/src/apps/deskbar/ExpandoMenuBar.cpp index 21fbcffb02..6c23498f6e 100644 --- a/src/apps/deskbar/ExpandoMenuBar.cpp +++ b/src/apps/deskbar/ExpandoMenuBar.cpp @@ -412,22 +412,38 @@ TExpandoMenuBar::MouseMoved(BPoint where, uint32 code, const BMessage* message) case B_ENTERED_VIEW: case B_INSIDE_VIEW: { - TTeamMenuItem* item = TeamItemAtPoint(where); - if (item == fLastMousedOverItem) { - // already set the tooltip for this item, break out - break; - } - - if (item == NULL) { + BMenuItem* menuItem; + TTeamMenuItem* item = TeamItemAtPoint(where, &menuItem); + TWindowMenuItem* windowMenuItem + = dynamic_cast(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 = item; + fLastMousedOverItem = menuItem; SetToolTip((const char*)NULL); break; } @@ -435,8 +451,8 @@ TExpandoMenuBar::MouseMoved(BPoint where, uint32 code, const BMessage* message) // new item, set the tooltip to the item name SetToolTip(item->Name()); - // save the current item for the next MouseMoved() call - fLastMousedOverItem = item; + // save the current menuitem for the next MouseMoved() call + fLastMousedOverItem = menuItem; break; } diff --git a/src/apps/deskbar/ExpandoMenuBar.h b/src/apps/deskbar/ExpandoMenuBar.h index 79f628cda8..b50a085d08 100644 --- a/src/apps/deskbar/ExpandoMenuBar.h +++ b/src/apps/deskbar/ExpandoMenuBar.h @@ -107,7 +107,7 @@ class TExpandoMenuBar : public BMenuBar { TTeamMenuItem* fPreviousDragTargetItem; - TTeamMenuItem* fLastMousedOverItem; + BMenuItem* fLastMousedOverItem; BMenuItem* fLastClickItem; static bool sDoMonitor;