vfs: check userland buffers before reading them.
[haiku.git] / src / tests / libs / alm / TableDemo.cpp
blobffecbbc76d526622d7a6e18a256152882058ce1b
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 * Distributed under the terms of the MIT License.
6 */
9 #include <Application.h>
10 #include <File.h>
11 #include <Button.h>
12 #include <Window.h>
14 #include "ALMLayout.h"
16 #include "Row.h"
17 #include "Column.h"
20 class TableDemoWindow : public BWindow {
21 public:
22 TableDemoWindow(BRect frame)
23 : BWindow(frame, "ALM Table Demo", B_TITLED_WINDOW, B_QUIT_ON_WINDOW_CLOSE)
25 // create a new BALMLayout and use it for this window
26 BALMLayout* layout = new BALMLayout();
27 SetLayout(layout);
29 Column* c1 = layout->AddColumn(layout->Left(), layout->Right());
30 Row* r1 = layout->AddRow(layout->Top(), NULL);
31 Row* r2 = layout->AddRow(r1->Bottom(), NULL);
32 Row* r3 = layout->AddRow(r2->Bottom(), layout->Bottom());
34 BButton* b1 = new BButton("A1");
35 layout->AddView(b1, r1, c1);
36 b1->SetExplicitAlignment(BAlignment(B_ALIGN_LEFT, B_ALIGN_TOP));
38 BButton* b2 = new BButton("A2");
39 layout->AddView(b2, r2, c1);
40 b2->SetExplicitAlignment(BAlignment(
41 B_ALIGN_HORIZONTAL_CENTER, B_ALIGN_VERTICAL_CENTER));
43 BButton* b3 = new BButton("A3");
44 layout->AddView(b3, r3, c1);
45 b3->SetExplicitAlignment(BAlignment(B_ALIGN_RIGHT, B_ALIGN_BOTTOM));
47 // test size limits
48 BSize min = layout->MinSize();
49 BSize max = layout->MaxSize();
50 SetSizeLimits(min.Width(), max.Width(), min.Height(), max.Height());
55 class TableDemo : public BApplication {
56 public:
57 TableDemo()
58 : BApplication("application/x-vnd.haiku.table-demo")
60 BRect frameRect;
61 frameRect.Set(100, 100, 400, 400);
62 TableDemoWindow* window = new TableDemoWindow(frameRect);
63 window->Show();
68 int
69 main()
71 TableDemo app;
72 app.Run();
73 return 0;