1 #include <Application.h>
2 #include <Archivable.h>
3 #include <Box.h>
4 #include <Dragger.h>
5 #include <Message.h>
6 #include <Path.h>
7 #include <ScrollView.h>
8 #include <Shelf.h>
9 #include <Window.h>
10
11 #include <stdio.h>
12
13 #include "TermConst.h"
14 // for the Terminal's signature
15
16 class App : public BApplication {
17 public:
18 App();
19 };
20
21
22 class Window : public BWindow {
23 public:
24 Window();
25 void AttachTermView();
26 private:
27 BShelf *fShelf;
28 };
29
30
main()31 int main()
32 {
33 App app;
34 app.Run();
35 return 0;
36 }
37
38
39 // App
App()40 App::App()
41 :BApplication("application/x-vnd-terminal-replicant")
42 {
43 Window *window = new Window();
44 window->Show();
45 }
46
47
48 // Window
Window()49 Window::Window()
50 :BWindow(BRect(100, 100, 400, 360), "RepliTerminal",
51 B_TITLED_WINDOW, B_ASYNCHRONOUS_CONTROLS|B_QUIT_ON_WINDOW_CLOSE)
52 {
53 AttachTermView();
54 }
55
56
57 void
AttachTermView()58 Window::AttachTermView()
59 {
60 // BMessage containing the class name and the app_signature
61 // for Terminal and TermView
62 BMessage message;
63 message.AddString("class", "TermView");
64 message.AddString("add_on", TERM_SIGNATURE);
65 message.AddBool("use_rect", true);
66
67 BRect viewFrame = Bounds();
68 viewFrame.right -= 15;
69 message.AddRect("_frame", viewFrame);
70
71 BView *termView = dynamic_cast<BView *>(instantiate_object(&message));
72 if (termView == NULL)
73 return;
74
75 termView->SetResizingMode(B_FOLLOW_ALL);
76
77 BScrollView *scrollView = new BScrollView("scrollview", termView,
78 B_FOLLOW_ALL, B_WILL_DRAW, false, true);
79
80 AddChild(scrollView);
81 }
82