- Replace the obsolete AddArea functions by AddView functions.
- Add an additional layout approach for the Pinwheel which leads to the same result. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@38794 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
parent
21f083af82
commit
9576365d8f
@ -29,25 +29,23 @@ public:
|
||||
YTab* y2 = layout->AddYTab();
|
||||
YTab* y3 = layout->AddYTab();
|
||||
|
||||
Area* a1 = layout->AddArea(
|
||||
layout->Left(), layout->Top(),
|
||||
layout->Right(), y1,
|
||||
button1);
|
||||
Area* a1 = layout->AddView(button1, layout->Left(), layout->Top(),
|
||||
layout->Right(), y1);
|
||||
a1->SetTopInset(10);
|
||||
a1->SetLeftInset(10);
|
||||
a1->SetRightInset(10);
|
||||
|
||||
layout->AddArea(layout->Left(), y1, layout->Right(), y2, button2);
|
||||
layout->AddView(button2, layout->Left(), y1, layout->Right(), y2);
|
||||
button2->SetExplicitAlignment(BAlignment(B_ALIGN_LEFT, B_ALIGN_TOP));
|
||||
|
||||
Area* a3 = layout->AddArea(layout->Left(), y2, layout->Right(), y3,
|
||||
button3);
|
||||
Area* a3 = layout->AddView(button3, layout->Left(), y2, layout->Right(),
|
||||
y3);
|
||||
button3->SetExplicitAlignment(BAlignment(B_ALIGN_HORIZONTAL_CENTER,
|
||||
B_ALIGN_VERTICAL_CENTER));
|
||||
a3->SetHeightAs(a1);
|
||||
|
||||
layout->AddArea(layout->Left(), y3, layout->Right(), layout->Bottom(),
|
||||
button4);
|
||||
layout->AddView(button4, layout->Left(), y3, layout->Right(),
|
||||
layout->Bottom());
|
||||
button4->SetExplicitAlignment(BAlignment(B_ALIGN_RIGHT,
|
||||
B_ALIGN_BOTTOM));
|
||||
}
|
||||
|
@ -29,8 +29,8 @@ public:
|
||||
|
||||
// add an area containing the button
|
||||
// use the borders of the layout as the borders for the area
|
||||
fLayout->AddArea(fLayout->Left(), fLayout->Top(), fLayout->Right(),
|
||||
fLayout->Bottom(), button1);
|
||||
fLayout->AddView(button1, fLayout->Left(), fLayout->Top(),
|
||||
fLayout->Right(), fLayout->Bottom());
|
||||
button1->SetExplicitMinSize(BSize(0, 50));
|
||||
button1->SetExplicitMaxSize(BSize(500, 500));
|
||||
button1->SetExplicitAlignment(BAlignment(B_ALIGN_USE_FULL_WIDTH,
|
||||
|
@ -49,16 +49,33 @@ public:
|
||||
YTab* y1 = layout->AddYTab();
|
||||
YTab* y2 = layout->AddYTab();
|
||||
|
||||
Area* a1 = layout->AddArea(layout->Left(), layout->Top(), x2, y1,
|
||||
button1);
|
||||
layout->AddArea(x2, layout->Top(), layout->Right(), y2, button2);
|
||||
Area* a3 = layout->AddArea(x1, y2, layout->Right(), layout->Bottom(),
|
||||
button3);
|
||||
layout->AddArea(layout->Left(), y1, x1, layout->Bottom(), button4);
|
||||
layout->AddArea(x1, y1, x2, y2, textView1);
|
||||
Area* a1 = layout->AddView(button1, layout->Left(), layout->Top(), x2,
|
||||
y1);
|
||||
layout->AddView(button2, x2, layout->Top(), layout->Right(), y2);
|
||||
Area* a3 = layout->AddView(button3, x1, y2, layout->Right(),
|
||||
layout->Bottom());
|
||||
layout->AddView(button4, layout->Left(), y1, x1, layout->Bottom());
|
||||
layout->AddView(textView1, x1, y1, x2, y2);
|
||||
|
||||
a1->SetWidthAs(a3);
|
||||
a1->SetHeightAs(a3);
|
||||
|
||||
// alternative setup
|
||||
/*
|
||||
layout->AddView(button1);
|
||||
Area* a1 = layout->AreaOf(button1);
|
||||
Area* a2 = layout->AddViewToRight(button2, a1, layout->Right(), NULL,
|
||||
layout->AddYTab());
|
||||
Area* a3 = layout->AddViewToBottom(button3, a2, layout->Bottom(),
|
||||
layout->AddXTab(), NULL);
|
||||
Area* a4 = layout->AddViewToLeft(button4, a3, layout->Left(),
|
||||
a1->Bottom());
|
||||
|
||||
layout->AddView(textView1, a4->Right(), a1->Bottom(), a2->Left(),
|
||||
a3->Top());
|
||||
a1->SetWidthAs(a3);
|
||||
a1->SetHeightAs(a3);
|
||||
*/
|
||||
}
|
||||
|
||||
private:
|
||||
|
@ -30,16 +30,16 @@ public:
|
||||
r2->InsertAfter(r1);
|
||||
|
||||
BButton* b1 = new BButton("A1");
|
||||
layout->AddArea(r1, c1, b1);
|
||||
layout->AddView(b1, r1, c1);
|
||||
b1->SetExplicitAlignment(BAlignment(B_ALIGN_LEFT, B_ALIGN_TOP));
|
||||
|
||||
BButton* b2 = new BButton("A2");
|
||||
layout->AddArea(r2, c1, b2);
|
||||
layout->AddView(b2, r2, c1);
|
||||
b2->SetExplicitAlignment(BAlignment(
|
||||
B_ALIGN_HORIZONTAL_CENTER, B_ALIGN_VERTICAL_CENTER));
|
||||
|
||||
BButton* b3 = new BButton("A3");
|
||||
layout->AddArea(r3, c1, b3);
|
||||
layout->AddView(b3, r3, c1);
|
||||
b3->SetExplicitAlignment(BAlignment(B_ALIGN_RIGHT, B_ALIGN_BOTTOM));
|
||||
|
||||
r2->HasSameHeightAs(r1);
|
||||
|
@ -34,10 +34,10 @@ public:
|
||||
// create an extra tab
|
||||
XTab* x1 = layout->AddXTab();
|
||||
|
||||
layout->AddArea(layout->Left(), layout->Top(), x1, layout->Bottom(),
|
||||
button1);
|
||||
layout->AddArea(x1, layout->Top(), layout->Right(), layout->Bottom(),
|
||||
textView1);
|
||||
layout->AddView(button1, layout->Left(), layout->Top(), x1,
|
||||
layout->Bottom());
|
||||
layout->AddView(textView1, x1, layout->Top(), layout->Right(),
|
||||
layout->Bottom());
|
||||
|
||||
// add a constraint: 2*x1 == right
|
||||
// i.e. x1 is in the middle of the layout
|
||||
|
Loading…
x
Reference in New Issue
Block a user