Exemplo n.º 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* r2 = layout->AddRow(r1->Bottom(), NULL);
        Row* r3 = layout->AddRow(r2->Bottom(), layout->Bottom());

        BButton* b1 = new BButton("A1");
        layout->AddView(b1, r1, c1);
        b1->SetExplicitAlignment(BAlignment(B_ALIGN_LEFT, B_ALIGN_TOP));

        BButton* b2 = new BButton("A2");
        layout->AddView(b2, r2, c1);
        b2->SetExplicitAlignment(BAlignment(
                                     B_ALIGN_HORIZONTAL_CENTER, B_ALIGN_VERTICAL_CENTER));

        BButton* b3 = new BButton("A3");
        layout->AddView(b3, r3, c1);
        b3->SetExplicitAlignment(BAlignment(B_ALIGN_RIGHT, B_ALIGN_BOTTOM));

        // test size limits
        BSize min = layout->MinSize();
        BSize max = layout->MaxSize();
        SetSizeLimits(min.Width(), max.Width(), min.Height(), max.Height());
    }
Exemplo n.º 2
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);
	}