137344020SClemens Zeidler /*
237344020SClemens Zeidler * Copyright 2010, Clemens Zeidler <haiku@clemens-zeidler.de>
337344020SClemens Zeidler * Distributed under the terms of the MIT License.
437344020SClemens Zeidler */
537344020SClemens Zeidler
637344020SClemens Zeidler
737344020SClemens Zeidler #include <Application.h>
837344020SClemens Zeidler #include <Button.h>
937344020SClemens Zeidler #include <ControlLook.h>
1037344020SClemens Zeidler #include <SpaceLayoutItem.h>
1137344020SClemens Zeidler #include <Window.h>
1237344020SClemens Zeidler
1337344020SClemens Zeidler #include "ALMLayout.h"
14*0da6f2e9SAlex Wilson #include "ALMGroup.h"
1537344020SClemens Zeidler
1637344020SClemens Zeidler
1737344020SClemens Zeidler class OperatorWindow : public BWindow {
1837344020SClemens Zeidler public:
OperatorWindow(BRect frame)1937344020SClemens Zeidler OperatorWindow(BRect frame)
2037344020SClemens Zeidler :
2137344020SClemens Zeidler BWindow(frame, "ALM Operator", B_TITLED_WINDOW, B_QUIT_ON_WINDOW_CLOSE)
2237344020SClemens Zeidler {
2337344020SClemens Zeidler BButton* button1 = new BButton("1");
2437344020SClemens Zeidler BButton* button2 = new BButton("2");
2537344020SClemens Zeidler BButton* button3 = new BButton("3");
2637344020SClemens Zeidler BButton* button4 = new BButton("4");
2737344020SClemens Zeidler BButton* button5 = new BButton("5");
2837344020SClemens Zeidler
2937344020SClemens Zeidler button1->SetExplicitMaxSize(BSize(B_SIZE_UNLIMITED, B_SIZE_UNLIMITED));
3037344020SClemens Zeidler button2->SetExplicitMaxSize(BSize(B_SIZE_UNLIMITED, B_SIZE_UNLIMITED));
3137344020SClemens Zeidler button3->SetExplicitMaxSize(BSize(B_SIZE_UNLIMITED, B_SIZE_UNLIMITED));
3237344020SClemens Zeidler button4->SetExplicitMaxSize(BSize(B_SIZE_UNLIMITED, B_SIZE_UNLIMITED));
3337344020SClemens Zeidler button5->SetExplicitMaxSize(BSize(B_SIZE_UNLIMITED, B_SIZE_UNLIMITED));
3437344020SClemens Zeidler
3537344020SClemens Zeidler // create a new BALMLayout and use it for this window
3637344020SClemens Zeidler float spacing = be_control_look->DefaultItemSpacing();
3737344020SClemens Zeidler BALMLayout* layout = new BALMLayout(spacing);
3837344020SClemens Zeidler SetLayout(layout);
399b0221fdSAlex Wilson layout->SetInsets(spacing);
4037344020SClemens Zeidler
41*0da6f2e9SAlex Wilson (ALMGroup(button1) | (ALMGroup(button2)
42*0da6f2e9SAlex Wilson / (ALMGroup(button3) | ALMGroup(BSpaceLayoutItem::CreateGlue())
43*0da6f2e9SAlex Wilson | ALMGroup(button4))
44*0da6f2e9SAlex Wilson / ALMGroup(button5))).BuildLayout(layout);
4537344020SClemens Zeidler
4637344020SClemens Zeidler // test size limits
4737344020SClemens Zeidler BSize min = layout->MinSize();
4837344020SClemens Zeidler BSize max = layout->MaxSize();
4937344020SClemens Zeidler SetSizeLimits(min.Width(), max.Width(), min.Height(), max.Height());
5037344020SClemens Zeidler }
5137344020SClemens Zeidler
5237344020SClemens Zeidler };
5337344020SClemens Zeidler
5437344020SClemens Zeidler
5537344020SClemens Zeidler int
main()5637344020SClemens Zeidler main()
5737344020SClemens Zeidler {
5837344020SClemens Zeidler BApplication app("application/x-vnd.haiku.ALMOperator");
5937344020SClemens Zeidler
6037344020SClemens Zeidler OperatorWindow* window = new OperatorWindow(BRect(100, 100, 300, 300));
6137344020SClemens Zeidler window->Show();
6237344020SClemens Zeidler
6337344020SClemens Zeidler app.Run();
6437344020SClemens Zeidler return 0;
6537344020SClemens Zeidler }
6637344020SClemens Zeidler
67