2 * Copyright 2007-2008, Christof Lutteroth, lutteroth@cs.auckland.ac.nz
3 * Copyright 2007-2008, James Kim, jkim202@ec.auckland.ac.nz
4 * Copyright 2010, Clemens Zeidler <haiku@clemens-zeidler.de>
5 * Distributed under the terms of the MIT License.
8 #include <Application.h>
14 // include this for ALM
15 #include "ALMLayout.h"
16 #include "ALMLayoutBuilder.h"
19 class PinwheelWindow
: public BWindow
{
21 PinwheelWindow(BRect frame
)
23 BWindow(frame
, "ALM Pinwheel", B_TITLED_WINDOW
, B_QUIT_ON_WINDOW_CLOSE
)
25 button1
= new BButton("1");
26 button2
= new BButton("2");
27 button3
= new BButton("3");
28 button4
= new BButton("4");
29 textView1
= new BTextView("textView1");
30 textView1
->SetText("5");
32 button1
->SetExplicitMaxSize(BSize(B_SIZE_UNLIMITED
, B_SIZE_UNLIMITED
));
33 button2
->SetExplicitMaxSize(BSize(B_SIZE_UNLIMITED
, B_SIZE_UNLIMITED
));
34 button3
->SetExplicitMaxSize(BSize(B_SIZE_UNLIMITED
, B_SIZE_UNLIMITED
));
35 button4
->SetExplicitMaxSize(BSize(B_SIZE_UNLIMITED
, B_SIZE_UNLIMITED
));
37 // create a new BALMLayout and use it for this window
38 BALMLayout
* layout
= new BALMLayout(10, 10);
40 BReference
<XTab
> xTabs
[2];
41 BReference
<YTab
> yTabs
[2];
42 layout
->AddXTabs(xTabs
, 2);
43 layout
->AddYTabs(yTabs
, 2);
45 BALM::BALMLayoutBuilder(this, layout
)
47 .Add(textView1
, xTabs
[0], yTabs
[0], xTabs
[1], yTabs
[1])
48 .StartingAt(textView1
)
49 .AddAbove(button1
, layout
->Top(), layout
->Left())
50 .AddToRight(button2
, layout
->Right(), NULL
, yTabs
[1])
51 .AddBelow(button3
, layout
->Bottom(), xTabs
[0])
52 .AddToLeft(button4
, layout
->Left(), yTabs
[0]);
58 layout->SetInsets(5.);
61 BReference<XTab> x1 = layout->AddXTab();
62 BReference<XTab> x2 = layout->AddXTab();
63 BReference<YTab> y1 = layout->AddYTab();
64 BReference<YTab> y2 = layout->AddYTab();
66 layout->AddView(button1, layout->Left(), layout->Top(), x2,
68 layout->AddView(button2, x2, layout->Top(), layout->Right(), y2);
69 layout->AddView(button3, x1, y2, layout->Right(),
71 layout->AddView(button4, layout->Left(), y1, x1, layout->Bottom());
72 layout->AddView(textView1, x1, y1, x2, y2);
76 BSize min
= layout
->MinSize();
77 BSize max
= layout
->MaxSize();
78 SetSizeLimits(min
.Width(), max
.Width(), min
.Height(), max
.Height());
90 class Pinwheel
: public BApplication
{
94 BApplication("application/x-vnd.haiku.Pinwheel")
97 frameRect
.Set(100, 100, 300, 300);
98 PinwheelWindow
* window
= new PinwheelWindow(frameRect
);