1 | #include <Application.h>
|
---|
2 | #include <GroupView.h>
|
---|
3 | #include <GroupLayoutBuilder.h>
|
---|
4 | #include <StringView.h>
|
---|
5 | #include <Window.h>
|
---|
6 |
|
---|
7 | #include <stdio.h>
|
---|
8 |
|
---|
9 | class App : public BApplication {
|
---|
10 | public:
|
---|
11 | App(void);
|
---|
12 | };
|
---|
13 |
|
---|
14 | class TestView : public BGroupView {
|
---|
15 | public:
|
---|
16 | virtual void MouseDown(BPoint point) {
|
---|
17 | printf("MouseDown\n");
|
---|
18 | }
|
---|
19 | virtual void MouseUp(BPoint point) {
|
---|
20 | printf("MouseUp\n");
|
---|
21 | }
|
---|
22 |
|
---|
23 | virtual void MouseMoved(BPoint point, uint32 ,
|
---|
24 | const BMessage* message) {
|
---|
25 | printf("MouseMoved\n");
|
---|
26 | }
|
---|
27 | };
|
---|
28 |
|
---|
29 | App::App(void)
|
---|
30 | :
|
---|
31 | BApplication("application/x-vnd.dw-TestApp")
|
---|
32 | {
|
---|
33 | BWindow* mainwin = new BWindow(BRect(300,300,300,300),
|
---|
34 | "caput", B_TITLED_WINDOW, 0);
|
---|
35 |
|
---|
36 | TestView* view = new TestView();
|
---|
37 | mainwin->SetLayout(view->GroupLayout());
|
---|
38 |
|
---|
39 | BGroupLayoutBuilder(view)
|
---|
40 | .AddGroup(B_HORIZONTAL, 0.5f)
|
---|
41 | .Add(new BStringView("", "looks like a test"))
|
---|
42 | .End()
|
---|
43 | .Add(new BStringView("", "shagadelic"))
|
---|
44 | .AddGroup(B_HORIZONTAL, 0)
|
---|
45 | .Add(new BStringView("", "testam"))
|
---|
46 | .End()
|
---|
47 | .End();
|
---|
48 |
|
---|
49 | mainwin->Show();
|
---|
50 | }
|
---|
51 |
|
---|
52 |
|
---|
53 | int
|
---|
54 | main(void)
|
---|
55 | {
|
---|
56 | App *app = new App();
|
---|
57 | app->Run();
|
---|
58 | delete app;
|
---|
59 | return 0;
|
---|
60 | }
|
---|