Set the TeamMenuItems to a more reasonable width in mini mode

This commit is contained in:
John Scipione 2013-04-14 13:28:08 -04:00
parent 0af37cd3bc
commit d6d8b95a6d

View File

@ -46,6 +46,7 @@ All rights reserved.
#include "BarMenuBar.h"
#include "BarView.h"
#include "DeskbarUtils.h"
#include "StatusView.h"
#include "TeamMenuItem.h"
@ -70,6 +71,7 @@ void
TTeamMenu::AttachedToWindow()
{
RemoveItems(0, CountItems(), true);
// remove all items
BMessenger self(this);
BList teamList;
@ -77,29 +79,32 @@ TTeamMenu::AttachedToWindow()
TBarView* barview = (dynamic_cast<TBarApp*>(be_app))->BarView();
bool dragging = barview && barview->Dragging();
int32 iconSize = static_cast<TBarApp*>(be_app)->IconSize();
desk_settings* settings = ((TBarApp*)be_app)->Settings();
float width = sMinimumWindowWidth - iconSize - 4;
if (settings->sortRunningApps)
teamList.SortItems(CompareByName);
int32 count = teamList.CountItems();
for (int32 i = 0; i < count; i++) {
// add items back
BarTeamInfo* barInfo = (BarTeamInfo*)teamList.ItemAt(i);
if (((barInfo->flags & B_BACKGROUND_APP) == 0)
&& (strcasecmp(barInfo->sig, kDeskbarSignature) != 0)) {
TTeamMenuItem* item = new TTeamMenuItem(barInfo->teams,
barInfo->icon, barInfo->name, barInfo->sig, -1, -1,
!settings->hideLabels, true);
barInfo->icon, barInfo->name, barInfo->sig,
width, -1, !settings->hideLabels, true);
if ((settings->trackerAlwaysFirst)
&& (strcmp(barInfo->sig, kTrackerSignature) == 0))
if (settings->trackerAlwaysFirst
&& strcmp(barInfo->sig, kTrackerSignature) == 0) {
AddItem(item, 0);
else
} else
AddItem(item);
if (dragging && item) {
if (dragging && item != NULL) {
bool canhandle = (dynamic_cast<TBarApp*>(be_app))->BarView()->
AppCanHandleTypes(item->Signature());
if (item->IsEnabled() != canhandle)