#include <Application.h>
#include <Button.h>
#include <TextView.h>
#include <List.h>
#include <Window.h>
#include "ALMLayout.h"
#include "ALMLayoutBuilder.h"
class PinwheelWindow : public BWindow {
public:
PinwheelWindow(BRect frame)
:
BWindow(frame, "ALM Pinwheel", B_TITLED_WINDOW, B_QUIT_ON_WINDOW_CLOSE)
{
button1 = new BButton("1");
button2 = new BButton("2");
button3 = new BButton("3");
button4 = new BButton("4");
textView1 = new BTextView("textView1");
textView1->SetText("5");
button1->SetExplicitMaxSize(BSize(B_SIZE_UNLIMITED, B_SIZE_UNLIMITED));
button2->SetExplicitMaxSize(BSize(B_SIZE_UNLIMITED, B_SIZE_UNLIMITED));
button3->SetExplicitMaxSize(BSize(B_SIZE_UNLIMITED, B_SIZE_UNLIMITED));
button4->SetExplicitMaxSize(BSize(B_SIZE_UNLIMITED, B_SIZE_UNLIMITED));
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]);
BSize min = layout->MinSize();
BSize max = layout->MaxSize();
SetSizeLimits(min.Width(), max.Width(), min.Height(), max.Height());
}
private:
BButton* button1;
BButton* button2;
BButton* button3;
BButton* button4;
BTextView* textView1;
};
class Pinwheel : public BApplication {
public:
Pinwheel()
:
BApplication("application/x-vnd.haiku.Pinwheel")
{
BRect frameRect;
frameRect.Set(100, 100, 300, 300);
PinwheelWindow* window = new PinwheelWindow(frameRect);
window->Show();
}
};
int
main()
{
Pinwheel app;
app.Run();
return 0;
}