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.
9 #include <Application.h>
14 #include "ALMLayout.h"
20 class TableDemoWindow
: public BWindow
{
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();
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
));
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
{
58 : BApplication("application/x-vnd.haiku.table-demo")
61 frameRect
.Set(100, 100, 400, 400);
62 TableDemoWindow
* window
= new TableDemoWindow(frameRect
);