Exemplo n.º 1
0
void
TExpandoMenuBar::SizeWindow()
{
	if (fVertical)
		fBarView->SizeWindow(BScreen(Window()).Frame());
	else 
		CheckItemSizes(1);
}
Exemplo n.º 2
0
void
TExpandoMenuBar::AddTeam(BList* team, BBitmap* icon, char* name,
	char* signature)
{
	float itemWidth = fVertical ? fBarView->Bounds().Width()
		: sMinimumWindowWidth;
	float itemHeight = -1.0f;

	desk_settings* settings = ((TBarApp*)be_app)->Settings();
	TTeamMenuItem* item = new TTeamMenuItem(team, icon, name, signature,
		itemWidth, itemHeight, fDrawLabel, fVertical);

	if (settings->trackerAlwaysFirst && !strcmp(signature, kTrackerSignature)) {
		AddItem(item, fFirstApp);
	} else if (settings->sortRunningApps) {
		TTeamMenuItem* teamItem
			= dynamic_cast<TTeamMenuItem*>(ItemAt(fFirstApp));
		int32 firstApp = fFirstApp;

		// if Tracker should always be the first item, we need to skip it
		// when sorting in the current item
		if (settings->trackerAlwaysFirst && teamItem != NULL
			&& !strcmp(teamItem->Signature(), kTrackerSignature)) {
			firstApp++;
		}

		int32 count = CountItems(), i;
		for (i = firstApp; i < count; i++) {
			teamItem = dynamic_cast<TTeamMenuItem*>(ItemAt(i));
			if (teamItem != NULL && strcasecmp(teamItem->Name(), name) > 0) {
				AddItem(item, i);
				break;
			}
		}
		// was the item added to the list yet?
		if (i == count)
			AddItem(item);
	} else
		AddItem(item);

	if (fVertical) {
		if (item && fShowTeamExpander && fExpandNewTeams)
			item->ToggleExpandState(false);

		fBarView->SizeWindow(BScreen(Window()).Frame());
	} else
		CheckItemSizes(1);

	Window()->UpdateIfNeeded();
}
Exemplo n.º 3
0
void
TExpandoMenuBar::SizeWindow(int32 delta)
{
	// instead of resizing the window here and there in the
	// code the resize method will be centered in one place
	// thus, the same behavior (good or bad) will be used
	// wherever window sizing is done
	if (fVertical) {
		BRect screenFrame = (BScreen(Window())).Frame();
		fBarView->SizeWindow(screenFrame);
		fBarView->PositionWindow(screenFrame);
		fBarView->CheckForScrolling();
	} else
		CheckItemSizes(delta);
}
Exemplo n.º 4
0
void
TExpandoMenuBar::RemoveTeam(team_id team, bool partial)
{
	int32 count = CountItems();
	for (int32 i = fFirstApp; i < count; i++) {
		if (TTeamMenuItem *item = dynamic_cast<TTeamMenuItem *>(ItemAt(i))) {
			if (item->Teams()->HasItem((void *)team)) {
				item->Teams()->RemoveItem(team);

				if (partial)
					return;

#ifdef DOUBLECLICKBRINGSTOFRONT
				if (fLastClickItem == i)
					fLastClickItem = -1;
#endif

				RemoveItem(i);

				if (fVertical) {
					//	instead of resizing the window here and there in the code
					//	the resize method will be centered in one place
					//	thus, the same behavior (good or bad) will be used whereever
					//	window sizing is done
					fBarView->SizeWindow(BScreen(Window()).Frame());
				} else
					CheckItemSizes(-1);

				Window()->UpdateIfNeeded();

				delete item;
				return;
			}
		}
	}
}