Ticket #9223: HelloHaiku.cpp

File HelloHaiku.cpp, 775 bytes (added by TriEdgeAI, 8 years ago)
Line 
1#include <Application.h>
2#include <StringView.h>
3#include <Window.h>
4
5
6class HelloWindow : public BWindow {
7public:
8 HelloWindow()
9 :
10 BWindow(BRect(100, 100, 500, 500), "Hello, Haiku!", B_TITLED_WINDOW, 0)
11 {
12 fHelloString = new BStringView(BRect(100, 100, 200, 200),
13 "fHelloString", "Hello, Haiku!");
14
15 AddChild(fHelloString);
16 }
17
18
19 bool
20 QuitRequested()
21 {
22 be_app->PostMessage(B_QUIT_REQUESTED);
23 return true;
24 }
25
26private:
27 BStringView* fHelloString;
28
29};
30
31
32class HelloHaiku : public BApplication {
33public:
34 HelloHaiku()
35 :
36 BApplication("application/HelloHaiku")
37 {
38 fWindow = new HelloWindow();
39 fWindow->Show();
40 }
41
42private:
43 HelloWindow* fWindow;
44
45};
46
47
48int
49main()
50{
51 HelloHaiku* app = new HelloHaiku();
52 app->Run();
53 delete app;
54 return 0;
55}