[haiku-commits] haiku: hrev46196 - src/apps/deskbar

  • From: jscipione@xxxxxxxxx
  • To: haiku-commits@xxxxxxxxxxxxx
  • Date: Wed, 9 Oct 2013 02:52:46 +0200 (CEST)

hrev46196 adds 1 changeset to branch 'master'
old head: 4875d5a09172e873caa55fe60039e0db80e64fde
new head: 54c746641ae240867f0730d9d1f810666f079706
overview: http://cgit.haiku-os.org/haiku/log/?qt=range&q=54c7466+%5E4875d5a

----------------------------------------------------------------------------

54c7466: Deskbar: Re-add tooltip code for truncated items
  
  I accidentally removed it last commit, sorry about that.

                                     [ John Scipione <jscipione@xxxxxxxxx> ]

----------------------------------------------------------------------------

Revision:    hrev46196
Commit:      54c746641ae240867f0730d9d1f810666f079706
URL:         http://cgit.haiku-os.org/haiku/commit/?id=54c7466
Author:      John Scipione <jscipione@xxxxxxxxx>
Date:        Wed Oct  9 00:51:32 2013 UTC

----------------------------------------------------------------------------

1 file changed, 49 insertions(+)
src/apps/deskbar/ExpandoMenuBar.cpp | 49 +++++++++++++++++++++++++++++++++

----------------------------------------------------------------------------

diff --git a/src/apps/deskbar/ExpandoMenuBar.cpp 
b/src/apps/deskbar/ExpandoMenuBar.cpp
index 7129fc0..2cb1994 100644
--- a/src/apps/deskbar/ExpandoMenuBar.cpp
+++ b/src/apps/deskbar/ExpandoMenuBar.cpp
@@ -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;
        }


Other related posts:

  • » [haiku-commits] haiku: hrev46196 - src/apps/deskbar - jscipione