xref: /haiku/src/tests/libs/alm/HelloWorld.cpp (revision 3be9edf8da228afd9fec0390f408c964766122aa)
1 #include <Application.h>
2 #include <Button.h>
3 #include <List.h>
4 #include <Window.h>
5 
6 // include this for ALM
7 #include "XTab.h"
8 #include "YTab.h"
9 #include "Area.h"
10 #include "BALMLayout.h"
11 
12 
13 class HelloWorldWindow : public BWindow {
14 public:
15 	HelloWorldWindow(BRect frame)
16 		: BWindow(frame, "ALM Hello World",
17 			B_TITLED_WINDOW, B_QUIT_ON_WINDOW_CLOSE)
18 	{
19 		button1 = new BButton("Hello World!");
20 
21 		// create a new BALMLayout and use  it for this window
22 		fLayout = new BALMLayout();
23 		SetLayout(fLayout);
24 
25 		// add an area containing the button
26 		// use the borders of the layout as the borders for the area
27 		Area* a = fLayout->AddArea(
28 			fLayout->Left(), fLayout->Top(),
29 			fLayout->Right(), fLayout->Bottom(),
30 			button1);
31 	}
32 
33 private:
34 	BALMLayout* fLayout;
35 	BButton* button1;
36 };
37 
38 
39 class HelloWorld : public BApplication {
40 public:
41 	HelloWorld()
42 		: BApplication("application/x-vnd.haiku.HelloWorld")
43 	{
44 		BRect frameRect;
45 		frameRect.Set(100, 100, 300, 300);
46 		HelloWorldWindow* window = new HelloWorldWindow(frameRect);
47 		window->Show();
48 	}
49 };
50 
51 
52 int
53 main()
54 {
55 	HelloWorld app;
56 	app.Run();
57 	return 0;
58 }
59