vfs: check userland buffers before reading them.
[haiku.git] / src / tests / libs / alm / NestedLayout.cpp
blob18ad835a2bd2cc174ca031d957cc585935bf063c
1 /*
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 * Copyright 2012, Haiku, Inc.
6 * Distributed under the terms of the MIT License.
7 */
9 #include <Application.h>
10 #include <Button.h>
11 #include <LayoutBuilder.h>
12 #include <List.h>
13 #include <Window.h>
15 // include this for ALM
16 #include "ALMLayout.h"
19 class NestedLayoutWindow : public BWindow {
20 public:
21 NestedLayoutWindow(BRect frame)
23 BWindow(frame, "ALM Nested Layout", B_TITLED_WINDOW,
24 B_QUIT_ON_WINDOW_CLOSE | B_AUTO_UPDATE_SIZE_LIMITS)
26 button1 = new BButton("There should be space above this button!");
28 fLayout = new BALMLayout();
29 BLayoutBuilder::Group<>(this, B_VERTICAL, 0)
30 .SetInsets(0)
31 .AddStrut(30)
32 .Add(fLayout);
34 // add an area containing the button
35 // use the borders of the layout as the borders for the area
36 fLayout->AddView(button1, fLayout->Left(), fLayout->Top(),
37 fLayout->Right(), fLayout->Bottom());
38 button1->SetExplicitMinSize(BSize(0, 50));
39 button1->SetExplicitMaxSize(BSize(500, 500));
40 button1->SetExplicitAlignment(BAlignment(B_ALIGN_USE_FULL_WIDTH,
41 B_ALIGN_USE_FULL_HEIGHT));
44 private:
45 BALMLayout* fLayout;
46 BButton* button1;
50 class NestedLayout : public BApplication {
51 public:
52 NestedLayout()
54 BApplication("application/x-vnd.haiku.NestedLayout")
56 BRect frameRect;
57 frameRect.Set(100, 100, 300, 300);
58 NestedLayoutWindow* window = new NestedLayoutWindow(frameRect);
59 window->Show();
64 int
65 main()
67 NestedLayout app;
68 app.Run();
69 return 0;