Exemplo n.º 1
0
void
TeamDescriptionView::SetItem(TeamListItem* item)
{
	fItem = item;

	if (item == NULL) {
		int32 styleStart = 0;
		int32 styleEnd = 0;
		BString text;

		text.SetToFormat(fInfoString, fSeconds);
		fInfoTextView->SetText(text);
		if (fRebootRunner != NULL && fSeconds < 4) {
			styleStart = text.FindLast('\n');
			styleEnd = text.Length();
		}

		if (styleStart != styleEnd && fInfoTextView != NULL) {
			BFont font;
			fInfoTextView->GetFont(&font);
			font.SetFace(B_BOLD_FACE);
			fInfoTextView->SetStylable(true);
			fInfoTextView->SetFontAndColor(styleStart, styleEnd, &font);
		}
	} else {
		fTeamName->SetText(item->Path()->Path());

		if (item->IsSystemServer()) {
			if (fSysComponent->IsHidden(fSysComponent))
				fSysComponent->Show();
		} else {
			if (!fSysComponent->IsHidden(fSysComponent))
				fSysComponent->Hide();
		}

		if (item->IsRefusingToQuit()) {
			if (fQuitOverdue->IsHidden(fQuitOverdue))
				fQuitOverdue->Show();
		} else {
			if (!fQuitOverdue->IsHidden(fQuitOverdue))
				fQuitOverdue->Hide();
		}

		fIconView->SetIcon(item->Path()->Path());
	}

	if (fLayout == NULL)
		return;

	if (item == NULL)
		fLayout->SetVisibleItem((int32)0);
	else
		fLayout->SetVisibleItem((int32)1);

	Invalidate();
}
Exemplo n.º 2
0
void
TeamDescriptionView::SetItem(TeamListItem* item)
{
	fItem = item;
	int32 styleStart = 0;
	int32 styleEnd = 0;
	BTextView* view = NULL;

	if (item == NULL) {
		BString text;
		text.SetToFormat(fInfoString, fSeconds);
		fInfoTextView->SetText(text);
		if (fRebootRunner != NULL && fSeconds < 4) {
			styleStart = text.FindLast('\n');
			styleEnd = text.Length();
		}
		view = fInfoTextView;
	} else {
		BString text = item->Path()->Path();
		if (item->IsSystemServer())
			text << "\n" << fSysComponentString;
		if (item->IsRefusingToQuit()) {
			text << "\n\n" << fQuitOverdueString;
			styleStart = text.FindLast('\n');
			styleEnd = text.Length();
		}
		view = fIconTextView;
		fIconTextView->SetText(text);
		fIconView->SetIcon(item->Path()->Path());
	}

	if (styleStart != styleEnd && view != NULL) {
		BFont font;
		view->GetFont(&font);
		font.SetFace(B_BOLD_FACE);
		view->SetStylable(true);
		view->SetFontAndColor(styleStart, styleEnd, &font);
	}

	if (fLayout == NULL)
		return;

	if (item == NULL)
		fLayout->SetVisibleItem((int32)0);
	else
		fLayout->SetVisibleItem((int32)1);

	Invalidate();
}