Example #1
0
	FriendWindow(BRect frame) 
		:
		BWindow(frame, "ALM Friend Test", B_TITLED_WINDOW,
			B_QUIT_ON_WINDOW_CLOSE | B_AUTO_UPDATE_SIZE_LIMITS),
		fLayout2(NULL),
		fBoom(NULL),
		fLeft(NULL),
		fTop(NULL),
		fRight(NULL),
		fBottom(NULL)
	{
		BButton* button1 = _MakeButton("friends!");
		BButton* button2 = _MakeButton("friends!");
		BButton* button3 = _MakeButton("friends!");

		BButton* button4 = _MakeButton("friends!");
		BButton* button5 = _MakeButton("friends!");
		BButton* button6 = _MakeButton("friends!");

		BALMLayout* layout1 = new BALMLayout(10, 10);
		BView* almView1 = _MakeALMView(layout1);

		BReference<XTab> xTabs[2];
		layout1->AddXTabs(xTabs, 2);

		BALM::BALMLayoutBuilder(layout1)
			.Add(button1, layout1->Left(), layout1->Top(),
				xTabs[0], layout1->Bottom())
			.StartingAt(button1)
				.AddToRight(button2, xTabs[1])
				.AddToRight(button3, layout1->Right());

		fLayout2 = new BALMLayout(10, 10, layout1);
		BView* almView2 = _MakeALMView(fLayout2);

		BALM::BALMLayoutBuilder(fLayout2)
			.Add(button4, fLayout2->Left(), fLayout2->Top(), xTabs[0])
			.StartingAt(button4)
				.AddBelow(button5, NULL, xTabs[1], fLayout2->Right())
				.AddBelow(button6, fLayout2->Bottom(), xTabs[0]);

		fLeft = fLayout2->Left();
		fBottom = fLayout2->BottomOf(button5);
		fTop = fLayout2->BottomOf(button4);
		fRight = xTabs[1];

		layout1->AreaFor(button2)->SetContentAspectRatio(1.0f);
		fLayout2->Solver()->AddConstraint(-1.0f, layout1->Left(), 1.0f, xTabs[0],
			LinearProgramming::kLE, 90.0f);

		BButton* archiveButton = new BButton("clone", new BMessage('arcv'));
		archiveButton->SetExplicitMaxSize(BSize(B_SIZE_UNLIMITED,
				B_SIZE_UNSET));
		BLayoutBuilder::Group<>(this, B_VERTICAL)
			.Add(almView1->GetLayout())
			.Add(almView2->GetLayout())
			.Add(archiveButton);
	}
Example #2
0
	BButton* _MakeButton(const char* label)
	{
		BButton* button = new BButton(label, new BMessage('BOOM'));
		button->SetExplicitMinSize(BSize(10, 50));
		button->SetExplicitMaxSize(BSize(500, 500));
		button->SetExplicitAlignment(BAlignment(B_ALIGN_USE_FULL_WIDTH,
			B_ALIGN_USE_FULL_HEIGHT));
		return button;
	}
BButton*
ScreenWindow::_CreateColumnRowButton(bool columns, bool plus)
{
	BMessage* message = new BMessage(kMsgWorkspaceLayoutChanged);
	message->AddInt32("delta_x", columns ? (plus ? 1 : -1) : 0);
	message->AddInt32("delta_y", !columns ? (plus ? 1 : -1) : 0);

	BButton* button = new BButton(plus ? "+" : "-", message);
	button->SetFontSize(be_plain_font->Size() * 0.9);

	BSize size = button->MinSize();
	size.width = button->StringWidth("+") + 16;
	button->SetExplicitMinSize(size);
	button->SetExplicitMaxSize(size);

	fWorkspacesButtons[(columns ? 0 : 2) + (plus ? 1 : 0)] = button;
	return button;
}