Beispiel #1
0
	TableDemoWindow(BRect frame) 
		: BWindow(frame, "ALM Table Demo", B_TITLED_WINDOW, B_QUIT_ON_WINDOW_CLOSE) 
	{	
		// create a new BALMLayout and use  it for this window
		BALMLayout* layout = new BALMLayout();
		SetLayout(layout);
		
		Column* c1 = layout->AddColumn(layout->Left(), layout->Right());
		Row* r1 = layout->AddRow(layout->Top(), NULL);
		Row* r3 = layout->AddRow(NULL, layout->Bottom());
		r1->SetNext(r3);
		Row* r2 = layout->AddRow();
		r2->InsertAfter(r1);
		
		BButton* b1 = new BButton("A1");
		Area* a1 = layout->AddArea(r1, c1, b1);
		a1->SetHorizontalAlignment(B_ALIGN_LEFT);
		a1->SetVerticalAlignment(B_ALIGN_TOP);
		
		BButton* b2 = new BButton("A2");
		Area* a2 = layout->AddArea(r2, c1, b2);
		a2->SetHorizontalAlignment(B_ALIGN_HORIZONTAL_CENTER);
		a2->SetVerticalAlignment(B_ALIGN_VERTICAL_CENTER);
				
		BButton* b3 = new BButton("A3");
		Area* a3 = layout->AddArea(r3, c1, b3);
		a3->SetHorizontalAlignment(B_ALIGN_RIGHT);
		a3->SetVerticalAlignment(B_ALIGN_BOTTOM);
		
		r2->HasSameHeightAs(r1);
		r3->HasSameHeightAs(r1);
	}
void
DataTranslationsWindow::_SetupViews()
{
	fConfigView = NULL;
	// This is NULL until a translator is
	// selected from the listview

	// Window box
	BView* mainView = new BView(Bounds(), "", B_FOLLOW_ALL, B_WILL_DRAW | B_FRAME_EVENTS);
	mainView->SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR));
	AddChild(mainView);

	// Add the translators list view
	fTranslatorListView = new TranslatorListView(BRect(0, 0, 1, 1), "TransList",
		B_SINGLE_SELECTION_LIST);
	fTranslatorListView->SetSelectionMessage(new BMessage(kMsgSelectedTranslator));

	BScrollView *scrollView = new BScrollView("scroll_trans", fTranslatorListView,
    		B_FOLLOW_LEFT | B_FOLLOW_TOP_BOTTOM, B_WILL_DRAW | B_FRAME_EVENTS,
    		false, true, B_FANCY_BORDER);

	// Box around the config and info panels
	fRightBox = new BBox("Right_Side");

	// Add the translator icon view
	fIconView = new IconView(BRect(0, 0, 31, 31), "Icon",
		B_FOLLOW_LEFT | B_FOLLOW_BOTTOM, B_WILL_DRAW | B_FRAME_EVENTS);

	// Add the translator info button
	BButton *button = new BButton("STD", "Info" B_UTF8_ELLIPSIS,
		new BMessage(kMsgTranslatorInfo), B_WILL_DRAW | B_FRAME_EVENTS | B_NAVIGABLE);

	// Add the translator name view
	fTranslatorNameView = new BStringView("TranName", "None");

	// Populate the translators list view
	_PopulateListView();

	// Build the layout
	BALMLayout *layout = new BALMLayout();
	mainView->SetLayout(layout);

	XTab *x1 = layout->AddXTab();
	XTab *x2 = layout->AddXTab();
	XTab *x3 = layout->AddXTab();
	YTab *y1 = layout->AddYTab();

	Area *leftArea = layout->AddArea(layout->Left(), layout->Top(),
		x1, layout->Bottom(), scrollView);
	leftArea->SetLeftInset(10);
	leftArea->SetTopInset(10);
	leftArea->SetBottomInset(10);

	Area *rightArea = layout->AddArea(x1, layout->Top(), layout->Right(), y1, fRightBox);
	rightArea->SetLeftInset(10);
	rightArea->SetTopInset(10);
	rightArea->SetRightInset(10);
	rightArea->SetBottomInset(10);

	Area *iconArea = layout->AddArea(x1, y1, x2, layout->Bottom(), fIconView);
	iconArea->SetLeftInset(10);
	iconArea->SetBottomInset(10);

	Area *infoButtonArea = layout->AddArea(x3, y1, layout->Right(), layout->Bottom(), button);
	infoButtonArea->SetRightInset(10);
	infoButtonArea->SetBottomInset(10);

	layout->AddConstraint(3.0, x1, -1.0, layout->Right(), OperatorType(EQ), 0.0);

	fTranslatorListView->MakeFocus();
	fTranslatorListView->Select(0);
}