vfs: check userland buffers before reading them.
[haiku.git] / src / tests / libs / alm / OperatorLayout.cpp
blobb55635770853a17bacb3d89aa96022eca2e131c0
1 /*
2 * Copyright 2010, Clemens Zeidler <haiku@clemens-zeidler.de>
3 * Distributed under the terms of the MIT License.
4 */
7 #include <Application.h>
8 #include <Button.h>
9 #include <ControlLook.h>
10 #include <SpaceLayoutItem.h>
11 #include <Window.h>
13 #include "ALMLayout.h"
14 #include "ALMGroup.h"
17 class OperatorWindow : public BWindow {
18 public:
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);
38 SetLayout(layout);
39 layout->SetInsets(spacing);
41 (ALMGroup(button1) | (ALMGroup(button2)
42 / (ALMGroup(button3) | ALMGroup(BSpaceLayoutItem::CreateGlue())
43 | ALMGroup(button4))
44 / ALMGroup(button5))).BuildLayout(layout);
46 // test size limits
47 BSize min = layout->MinSize();
48 BSize max = layout->MaxSize();
49 SetSizeLimits(min.Width(), max.Width(), min.Height(), max.Height());
55 int
56 main()
58 BApplication app("application/x-vnd.haiku.ALMOperator");
60 OperatorWindow* window = new OperatorWindow(BRect(100, 100, 300, 300));
61 window->Show();
63 app.Run();
64 return 0;