Add BALMLayoutBuilder implementations to ALM tests.
This commit is contained in:
parent
50cc24b3f9
commit
2bf5ded1ed
@ -12,6 +12,7 @@
|
||||
|
||||
// include this for ALM
|
||||
#include "ALMLayout.h"
|
||||
#include "ALMLayoutBuilder.h"
|
||||
|
||||
|
||||
class ComplexButtonsWindow : public BWindow {
|
||||
@ -55,6 +56,17 @@ public:
|
||||
button5->SetExplicitMaxSize(BSize(500, 500));
|
||||
button5->SetExplicitPreferredSize(BSize(30 + kOffset, B_SIZE_UNSET));
|
||||
|
||||
BALMLayout* fLayout = new BALMLayout(10, 10);
|
||||
BALM::BALMLayoutBuilder(this, fLayout)
|
||||
.Add(button1, fLayout->Left(), fLayout->Top())
|
||||
.StartingAt(button1)
|
||||
.AddToRight(button2)
|
||||
.AddToRight(button3, fLayout->Right())
|
||||
.AddBelow(button4, fLayout->Bottom(), fLayout->Left(),
|
||||
fLayout->AddXTab())
|
||||
.AddToRight(button5, fLayout->Right());
|
||||
|
||||
/*
|
||||
// create a new BALMLayout and use it for this window
|
||||
fLayout = new BALMLayout();
|
||||
SetLayout(fLayout);
|
||||
@ -66,6 +78,7 @@ public:
|
||||
fLayout->AddView(button4, fLayout->Left(), fLayout->BottomOf(button1),
|
||||
NULL, fLayout->Bottom());
|
||||
fLayout->AddViewToRight(button5, fLayout->Right());
|
||||
*/
|
||||
|
||||
// test size limits
|
||||
BSize min = fLayout->MinSize();
|
||||
|
@ -13,6 +13,7 @@
|
||||
|
||||
// include this for ALM
|
||||
#include "ALMLayout.h"
|
||||
#include "ALMLayoutBuilder.h"
|
||||
|
||||
|
||||
class PinwheelWindow : public BWindow {
|
||||
@ -34,7 +35,24 @@ public:
|
||||
button4->SetExplicitMaxSize(BSize(B_SIZE_UNLIMITED, B_SIZE_UNLIMITED));
|
||||
|
||||
// create a new BALMLayout and use it for this window
|
||||
BALMLayout* layout = new BALMLayout(10.);
|
||||
BALMLayout* layout = new BALMLayout(10, 10);
|
||||
|
||||
BReference<XTab> xTabs[2];
|
||||
BReference<YTab> yTabs[2];
|
||||
layout->AddXTabs(xTabs, 2);
|
||||
layout->AddYTabs(yTabs, 2);
|
||||
|
||||
BALM::BALMLayoutBuilder(this, layout)
|
||||
.SetInsets(5)
|
||||
.Add(textView1, xTabs[0], yTabs[0], xTabs[1], yTabs[1])
|
||||
.StartingAt(textView1)
|
||||
.AddAbove(button1, layout->Top(), layout->Left())
|
||||
.AddToRight(button2, layout->Right(), NULL, yTabs[1])
|
||||
.AddBelow(button3, layout->Bottom(), xTabs[0])
|
||||
.AddToLeft(button4, layout->Left(), yTabs[0]);
|
||||
|
||||
// alternative setup
|
||||
/*
|
||||
SetLayout(layout);
|
||||
|
||||
layout->SetInsets(5.);
|
||||
@ -52,6 +70,7 @@ public:
|
||||
layout->Bottom());
|
||||
layout->AddView(button4, layout->Left(), y1, x1, layout->Bottom());
|
||||
layout->AddView(textView1, x1, y1, x2, y2);
|
||||
*/
|
||||
|
||||
// alternative setup
|
||||
/*
|
||||
|
@ -12,6 +12,7 @@
|
||||
|
||||
// include this for ALM
|
||||
#include "ALMLayout.h"
|
||||
#include "ALMLayoutBuilder.h"
|
||||
|
||||
|
||||
class ThreeButtonsWindow : public BWindow {
|
||||
@ -37,6 +38,14 @@ public:
|
||||
B_ALIGN_USE_FULL_HEIGHT));
|
||||
button3->SetExplicitMaxSize(BSize(500, 500));
|
||||
|
||||
fLayout = new BALMLayout(0, 0);
|
||||
BALM::BALMLayoutBuilder(this, fLayout)
|
||||
.Add(button1, fLayout->Left(), fLayout->Top(), fLayout->Right())
|
||||
.StartingAt(button1)
|
||||
.AddBelow(button2)
|
||||
.AddBelow(button3, fLayout->Bottom());
|
||||
|
||||
/*
|
||||
// create a new BALMLayout and use it for this window
|
||||
fLayout = new BALMLayout();
|
||||
SetLayout(fLayout);
|
||||
@ -45,6 +54,7 @@ public:
|
||||
fLayout->Right(), NULL);
|
||||
fLayout->AddViewToBottom(button2);
|
||||
fLayout->AddViewToBottom(button3, fLayout->Bottom());
|
||||
*/
|
||||
|
||||
// test size limits
|
||||
BSize min = fLayout->MinSize();
|
||||
|
@ -18,6 +18,7 @@
|
||||
#include <Window.h>
|
||||
|
||||
#include "ALMLayout.h"
|
||||
#include "ALMLayoutBuilder.h"
|
||||
|
||||
|
||||
using namespace LinearProgramming;
|
||||
@ -53,6 +54,31 @@ public:
|
||||
menu->AddItem(new BPopUpMenu("Menu 2"));
|
||||
BStringView* stringView2 = new BStringView("string 2", "string 2");
|
||||
|
||||
BALM::BALMLayout* layout = new BALMLayout(10, 10);
|
||||
BALM::BALMLayoutBuilder(this, layout)
|
||||
.SetInsets(10)
|
||||
.Add(button1, layout->Left(), layout->Top())
|
||||
.StartingAt(button1)
|
||||
.AddToRight(radioButton)
|
||||
.AddToRight(BSpaceLayoutItem::CreateGlue())
|
||||
.AddToRight(button3)
|
||||
.StartingAt(radioButton)
|
||||
.AddBelow(textView1, NULL, NULL, layout->RightOf(button3))
|
||||
.AddBelow(button4)
|
||||
.AddToRight(button5, layout->Right())
|
||||
.AddBelow(button6)
|
||||
.AddBelow(menu1, layout->AddYTab(), layout->Left(),
|
||||
layout->AddXTab())
|
||||
.AddToRight(stringView1)
|
||||
.AddToRight(BSpaceLayoutItem::CreateGlue(), layout->Right())
|
||||
.AddBelow(statusBar, NULL, layout->Left(), layout->Right())
|
||||
.StartingAt(statusBar)
|
||||
.AddBelow(menu2, layout->Bottom(), layout->Left(),
|
||||
layout->RightOf(menu1))
|
||||
.AddToRight(stringView2)
|
||||
.AddToRight(BSpaceLayoutItem::CreateGlue(), layout->Right());
|
||||
|
||||
/*
|
||||
// create a new BALMLayout and use it for this window
|
||||
BALMLayout* layout = new BALMLayout(10);
|
||||
SetLayout(layout);
|
||||
@ -79,6 +105,7 @@ public:
|
||||
layout->RightOf(menu1), layout->Bottom());
|
||||
layout->AddViewToRight(stringView2);
|
||||
layout->AddItemToRight(BSpaceLayoutItem::CreateGlue(), layout->Right());
|
||||
*/
|
||||
|
||||
layout->Solver()->AddConstraint(2, layout->TopOf(menu1), -1,
|
||||
layout->Bottom(), OperatorType(kEQ), 0);
|
||||
|
Loading…
x
Reference in New Issue
Block a user