libroot_debug: Merge guarded heap into libroot_debug.
[haiku.git] / src / tests / apps / terminal_replicant / main.cpp
blobf7a0017d5eb12e2e5f7561a6c81362ec47629411
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>
11 #include <stdio.h>
13 #include "TermConst.h"
14 // for the Terminal's signature
16 class App : public BApplication {
17 public:
18 App();
22 class Window : public BWindow {
23 public:
24 Window();
25 void AttachTermView();
26 private:
27 BShelf *fShelf;
31 int main()
33 App app;
34 app.Run();
35 return 0;
39 // App
40 App::App()
41 :BApplication("application/x-vnd-terminal-replicant")
43 Window *window = new Window();
44 window->Show();
48 // Window
49 Window::Window()
50 :BWindow(BRect(100, 100, 400, 360), "RepliTerminal",
51 B_TITLED_WINDOW, B_ASYNCHRONOUS_CONTROLS|B_QUIT_ON_WINDOW_CLOSE)
53 AttachTermView();
57 void
58 Window::AttachTermView()
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);
67 BRect viewFrame = Bounds();
68 viewFrame.right -= 15;
69 message.AddRect("_frame", viewFrame);
71 BView *termView = dynamic_cast<BView *>(instantiate_object(&message));
72 if (termView == NULL)
73 return;
75 termView->SetResizingMode(B_FOLLOW_ALL);
77 BScrollView *scrollView = new BScrollView("scrollview", termView,
78 B_FOLLOW_ALL, B_WILL_DRAW, false, true);
80 AddChild(scrollView);