vfs: check userland buffers before reading them.
[haiku.git] / src / tests / libs / alm / Areas.cpp
bloba16807e7fb61656c84687616aa0154f55083a1ce
1 #include <Application.h>
2 #include <Button.h>
3 #include <List.h>
4 #include <Window.h>
6 #include "ALMLayout.h"
9 class AreasWindow : public BWindow {
10 public:
11 AreasWindow(BRect frame)
13 BWindow(frame, "ALM Areas", B_TITLED_WINDOW, B_QUIT_ON_WINDOW_CLOSE)
15 button1 = new BButton("1");
16 button2 = new BButton("2");
17 button3 = new BButton("3");
18 button4 = new BButton("4");
20 button1->SetExplicitMinSize(BSize(0, 0));
21 button1->SetExplicitMaxSize(BSize(B_SIZE_UNLIMITED, B_SIZE_UNLIMITED));
23 // create a new BALMLayout and use it for this window
24 BALMLayout* layout = new BALMLayout(6);
25 SetLayout(layout);
27 // create extra tabs
28 BReference<YTab> y1 = layout->AddYTab();
29 BReference<YTab> y2 = layout->AddYTab();
30 BReference<YTab> y3 = layout->AddYTab();
32 Area* a1 = layout->AddView(button1, layout->Left(), layout->Top(),
33 layout->Right(), y1);
34 a1->SetTopInset(10);
35 a1->SetLeftInset(10);
36 a1->SetRightInset(10);
38 layout->AddView(button2, layout->Left(), y1, layout->Right(), y2);
39 button2->SetExplicitAlignment(BAlignment(B_ALIGN_LEFT, B_ALIGN_TOP));
41 Area* a3 = layout->AddView(button3, layout->Left(), y2, layout->Right(),
42 y3);
43 button3->SetExplicitAlignment(BAlignment(B_ALIGN_HORIZONTAL_CENTER,
44 B_ALIGN_VERTICAL_CENTER));
45 a3->SetHeightAs(a1);
47 layout->AddView(button4, layout->Left(), y3, layout->Right(),
48 layout->Bottom());
49 button4->SetExplicitAlignment(BAlignment(B_ALIGN_RIGHT,
50 B_ALIGN_BOTTOM));
52 // test size limits
53 BSize min = layout->MinSize();
54 BSize max = layout->MaxSize();
55 SetSizeLimits(min.Width(), max.Width(), min.Height(), max.Height());
58 private:
59 BButton* button1;
60 BButton* button2;
61 BButton* button3;
62 BButton* button4;
66 class Areas : public BApplication {
67 public:
68 Areas()
70 BApplication("application/x-vnd.haiku.Areas")
72 BRect frameRect;
73 frameRect.Set(100, 100, 300, 300);
74 AreasWindow* window = new AreasWindow(frameRect);
75 window->Show();
80 int
81 main()
83 Areas app;
84 app.Run();
85 return 0;