2 * Copyright 2010, Clemens Zeidler <haiku@clemens-zeidler.de>
3 * Distributed under the terms of the MIT License.
7 #include <Application.h>
9 #include <ControlLook.h>
10 #include <SpaceLayoutItem.h>
13 #include "ALMLayout.h"
17 class OperatorWindow
: public BWindow
{
19 OperatorWindow(BRect frame
)
21 BWindow(frame
, "ALM Operator", B_TITLED_WINDOW
, B_QUIT_ON_WINDOW_CLOSE
)
23 BButton
* button1
= new BButton("1");
24 BButton
* button2
= new BButton("2");
25 BButton
* button3
= new BButton("3");
26 BButton
* button4
= new BButton("4");
27 BButton
* button5
= new BButton("5");
29 button1
->SetExplicitMaxSize(BSize(B_SIZE_UNLIMITED
, B_SIZE_UNLIMITED
));
30 button2
->SetExplicitMaxSize(BSize(B_SIZE_UNLIMITED
, B_SIZE_UNLIMITED
));
31 button3
->SetExplicitMaxSize(BSize(B_SIZE_UNLIMITED
, B_SIZE_UNLIMITED
));
32 button4
->SetExplicitMaxSize(BSize(B_SIZE_UNLIMITED
, B_SIZE_UNLIMITED
));
33 button5
->SetExplicitMaxSize(BSize(B_SIZE_UNLIMITED
, B_SIZE_UNLIMITED
));
35 // create a new BALMLayout and use it for this window
36 float spacing
= be_control_look
->DefaultItemSpacing();
37 BALMLayout
* layout
= new BALMLayout(spacing
);
39 layout
->SetInsets(spacing
);
41 (ALMGroup(button1
) | (ALMGroup(button2
)
42 / (ALMGroup(button3
) | ALMGroup(BSpaceLayoutItem::CreateGlue())
44 / ALMGroup(button5
))).BuildLayout(layout
);
47 BSize min
= layout
->MinSize();
48 BSize max
= layout
->MaxSize();
49 SetSizeLimits(min
.Width(), max
.Width(), min
.Height(), max
.Height());
58 BApplication
app("application/x-vnd.haiku.ALMOperator");
60 OperatorWindow
* window
= new OperatorWindow(BRect(100, 100, 300, 300));