Ejemplo n.º 1
0
void
PrefletView::Select(int32 index)
{
	BCardLayout* layout
		= dynamic_cast<BCardLayout*>(fPagesView->GetLayout());
	if (layout)
		layout->SetVisibleItem(index);
}
Ejemplo n.º 2
0
BView*
PrefletView::PageAt(int32 index)
{
	BCardLayout* layout
		= dynamic_cast<BCardLayout*>(fPagesView->GetLayout());
	if (layout)
		return layout->ItemAt(index)->View();
	return NULL;
}
Ejemplo n.º 3
0
int32
PrefletView::CountPages() const
{
	BCardLayout* layout
		= dynamic_cast<BCardLayout*>(fPagesView->GetLayout());
	if (layout)
		return layout->CountItems();
	return 0;
}
Ejemplo n.º 4
0
BView*
PrefletView::CurrentPage()
{
	BCardLayout* layout
		= dynamic_cast<BCardLayout*>(fPagesView->GetLayout());
	if (layout)
		return layout->VisibleItem()->View();
	return NULL;
}
Ejemplo n.º 5
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();
}
Ejemplo n.º 6
0
CamStatusView::CamStatusView(Controller* controller)
	:
	BView("CamStatusView", B_WILL_DRAW|B_PULSE_NEEDED),
	fController(controller),
	fStringView(NULL),
	fBitmapView(NULL),
	fEncodingStringView(NULL),
	fStatusBar(NULL),
	fNumFrames(0),
	fRecording(false),
	fPaused(false),
	fRecordingBitmap(NULL),
	fPauseBitmap(NULL)
{
	BCardLayout* cardLayout = new BCardLayout();
	SetLayout(cardLayout);
	BRect bitmapRect(0, 0, kBitmapSize, kBitmapSize);
	fRecordingBitmap = new BBitmap(bitmapRect, B_RGBA32);
	fPauseBitmap = new BBitmap(bitmapRect, B_RGBA32);
	
	BView* statusView = BLayoutBuilder::Group<>()
		.SetInsets(0)
		.Add(fEncodingStringView = new BStringView("stringview", kEncodingString))
		.Add(fStatusBar = new BStatusBar("", ""))
		.View();

	fStatusBar->SetExplicitMinSize(BSize(100, 20));

	BView* layoutView = BLayoutBuilder::Group<>()
		.SetInsets(0)
		.Add(fBitmapView = new SquareBitmapView("bitmap view"))
		.Add(fStringView = new BStringView("cam string view", ""))
		.View();

	cardLayout->AddView(layoutView);
	cardLayout->AddView(statusView);
	
	fBitmapView->SetBitmap(NULL);
	
	BFont font;
	GetFont(&font);
	float scaledSize = kBitmapSize * (capped_size(font.Size()) / 12);
	fBitmapView->SetExplicitMinSize(BSize(scaledSize, scaledSize));
	fBitmapView->SetExplicitMaxSize(BSize(scaledSize, scaledSize));
	fBitmapView->SetExplicitAlignment(BAlignment(B_ALIGN_LEFT, B_ALIGN_TOP));
	
	fStringView->SetExplicitAlignment(BAlignment(B_ALIGN_LEFT, B_ALIGN_MIDDLE));
	
	cardLayout->SetVisibleItem(int32(0));
}
Ejemplo n.º 7
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();
}
Ejemplo n.º 8
0
PrefletView::PrefletView(SettingsHost* host)
	:
	BView("pages", B_WILL_DRAW)
{
	// Page selector
	fRule = new BIconRule("icon_rule");
	fRule->SetSelectionMessage(new BMessage(kPageSelected));
	(void)fRule->AddIcon(_T("General"), NULL);
	(void)fRule->AddIcon(_T("Display"), NULL);
	//(void)fRule->AddIcon(_T("Notifications"), NULL);

	// View for card layout
	fPagesView = new BView("pages", B_WILL_DRAW);

	// Pages
	GeneralView* general = new GeneralView(host);
	DisplayView* display = new DisplayView(host);
	NotificationsView* apps = new NotificationsView();

	// Calculate inset
	float inset = ceilf(be_plain_font->Size() * 0.7f);

	// Build the layout
	SetLayout(new BGroupLayout(B_VERTICAL));

	// Card layout for pages
	BCardLayout* layout = new BCardLayout();
	fPagesView->SetLayout(layout);
	layout->AddView(general);
	layout->AddView(display);
	layout->AddView(apps);

	// Add childs
	AddChild(BGroupLayoutBuilder(B_VERTICAL, inset)
		.Add(fRule)
		.Add(fPagesView)
	);

	// Select the first view
	Select(0);
}
Ejemplo n.º 9
0
void
BTabView::Select(int32 index)
{
	if (index < 0 || index >= CountTabs())
		index = Selection();

	BTab *tab = TabAt(Selection());

	if (tab)
		tab->Deselect();

	tab = TabAt(index);
	if (tab && ContainerView()) {
		if (index == 0)
			fTabOffset = 0.0f;
		tab->Select(ContainerView());
		fSelection = index;

		// make the view visible through the layout if there is one
		BCardLayout* layout
			= dynamic_cast<BCardLayout*>(fContainerView->GetLayout());
		if (layout)
			layout->SetVisibleItem(index);
	}

	Invalidate();

	if (index != 0 && !Bounds().Contains(TabFrame(index))){
		if (!Bounds().Contains(TabFrame(index).LeftTop()))
			fTabOffset += TabFrame(index).left - Bounds().left - 20.0f;
		else
			fTabOffset += TabFrame(index).right - Bounds().right + 20.0f;

		Invalidate();
	}

	SetFocusTab(index, true);
}