Imported ExpandoMenuBar 1.16 and TeamMenu.cpp 1.5 from the OpenTracker repository:

* fixes for the Deskbar running without any other apps.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@16009 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Axel Dörfler 2006-01-20 11:55:24 +00:00
parent 5226491c72
commit 915af8b17a
2 changed files with 20 additions and 9 deletions

View File

@ -92,10 +92,9 @@ TExpandoMenuBar::TExpandoMenuBar(TBarView *bar, BRect frame, const char *name,
int
TExpandoMenuBar::CompareByName( const void *first, const void *second)
TExpandoMenuBar::CompareByName(const void *first, const void *second)
{
return strcasecmp(
(*(static_cast<BarTeamInfo * const*>(first )))->name,
return strcasecmp((*(static_cast<BarTeamInfo * const*>(first)))->name,
(*(static_cast<BarTeamInfo * const*>(second)))->name);
}
@ -158,6 +157,12 @@ TExpandoMenuBar::AttachedToWindow()
BMenuBar::AttachedToWindow();
if (CountItems() == 0) {
// If we're empty, BMenuBar::AttachedToWindow() resizes us to some
// weird value - we just override it again
ResizeTo(width, 0);
}
if (fVertical) {
sDoMonitor = true;
sMonThread = spawn_thread(monitor_team_windows,
@ -667,8 +672,9 @@ TExpandoMenuBar::DrawBackground(BRect)
}
// something to help determine if we are showing too many apps
// need to add in scrolling functionality
/** Something to help determine if we are showing too many apps
* need to add in scrolling functionality.
*/
void
TExpandoMenuBar::CheckForSizeOverrun()

View File

@ -45,7 +45,7 @@ All rights reserved.
TTeamMenu::TTeamMenu()
: BMenu("Team Menu")
: BMenu("Team Menu")
{
SetItemMargins(0.0f, 0.0f, 0.0f, 0.0f);
SetFont(be_plain_font);
@ -53,10 +53,9 @@ TTeamMenu::TTeamMenu()
int
TTeamMenu::CompareByName( const void *first, const void *second)
TTeamMenu::CompareByName(const void *first, const void *second)
{
return strcasecmp(
(*(static_cast<BarTeamInfo * const*>(first )))->name,
return strcasecmp((*(static_cast<BarTeamInfo * const*>(first)))->name,
(*(static_cast<BarTeamInfo * const*>(second)))->name);
}
@ -115,6 +114,12 @@ TTeamMenu::AttachedToWindow()
delete barInfo;
}
if (CountItems() == 0) {
BMenuItem *item = new BMenuItem("no application running", NULL);
item->SetEnabled(false);
AddItem(item);
}
if (dragging && barview->LockLooper()) {
SetTrackingHook(barview->MenuTrackingHook, barview->GetTrackingHookData());
barview->DragStart();