From ed75ca72012fb47fc551edcbb4274b4daadc042f Mon Sep 17 00:00:00 2001 From: John Scipione Date: Fri, 26 Oct 2012 02:58:45 -0400 Subject: [PATCH] Set the scroll arrow limit based on the min menu item widths ... rather than the current menu item widths. This means that Deskbar will shrink the menu items until they are at their minimum size before it activates the scroll arrows. Previous to this change the scroll arrows were being turned on prematurely. Also lower the minimum menu item width to the icon width + 50pixels which is arbitrary but looks good to my eye. --- src/apps/deskbar/ExpandoMenuBar.cpp | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/src/apps/deskbar/ExpandoMenuBar.cpp b/src/apps/deskbar/ExpandoMenuBar.cpp index a4561ee7de..1e493fad2f 100644 --- a/src/apps/deskbar/ExpandoMenuBar.cpp +++ b/src/apps/deskbar/ExpandoMenuBar.cpp @@ -63,7 +63,7 @@ All rights reserved. #include "WindowMenuItem.h" -const float kDefaultDeskbarMenuWidth = 50.0f; +const float kMinMenuItemWidth = 50.0f; const float kSepItemWidth = 5.0f; const float kIconPadding = 8.0f; @@ -85,7 +85,7 @@ TExpandoMenuBar::TExpandoMenuBar(TBarView* bar, BRect frame, const char* name, fDrawLabel(drawLabel), fShowTeamExpander(static_cast(be_app)->Settings()->superExpando), fExpandNewTeams(static_cast(be_app)->Settings()->expandNewTeams), - fDeskbarMenuWidth(kDefaultDeskbarMenuWidth), + fDeskbarMenuWidth(kMinMenuItemWidth), fBarView(bar), fPreviousDragTargetItem(NULL), fLastClickItem(NULL) @@ -682,7 +682,7 @@ TExpandoMenuBar::CheckItemSizes(int32 delta) - fDeskbarMenuWidth - kSepItemWidth; int32 iconSize = static_cast(be_app)->IconSize(); float iconOnlyWidth = kIconPadding + iconSize + kIconPadding; - float minItemWidth = fDrawLabel ? iconOnlyWidth + fDeskbarMenuWidth + float minItemWidth = fDrawLabel ? iconOnlyWidth + kMinMenuItemWidth : iconOnlyWidth; float maxItemWidth = sMinimumWindowWidth + iconSize - kMinimumIconSize; float menuWidth = maxItemWidth * CountItems() + fDeskbarMenuWidth @@ -800,9 +800,14 @@ TExpandoMenuBar::CheckForSizeOverrun() if (count < 0) return false; - float menuWidth = ItemAt(count)->Frame().right + fDeskbarMenuWidth - + kSepItemWidth + 1; - float maxWidth = fBarView->DragRegion()->Frame().left - 1; + int32 iconSize = static_cast(be_app)->IconSize(); + float iconOnlyWidth = kIconPadding + iconSize + kIconPadding; + float minItemWidth = fDrawLabel ? iconOnlyWidth + kMinMenuItemWidth + : iconOnlyWidth; + float menuWidth = minItemWidth * CountItems() + fDeskbarMenuWidth + + kSepItemWidth; + float maxWidth = fBarView->DragRegion()->Frame().left + - fDeskbarMenuWidth - kSepItemWidth; return menuWidth > maxWidth; }