From c9aadc4f63a0f67a85a99443bc100f9077fbf946 Mon Sep 17 00:00:00 2001 From: Stefano Ceccherini Date: Thu, 7 Feb 2008 13:29:41 +0000 Subject: [PATCH] Added a pretty useless test app to show that embedding a TermView in another apps works correctly (minus the blinking cursor, we'll see why it doesn't) git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@23908 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- src/tests/apps/Jamfile | 1 + src/tests/apps/terminal_replicant/Jamfile | 12 ++++ src/tests/apps/terminal_replicant/main.cpp | 72 ++++++++++++++++++++++ 3 files changed, 85 insertions(+) create mode 100644 src/tests/apps/terminal_replicant/Jamfile create mode 100644 src/tests/apps/terminal_replicant/main.cpp diff --git a/src/tests/apps/Jamfile b/src/tests/apps/Jamfile index f99274294e..65d8f0d62b 100644 --- a/src/tests/apps/Jamfile +++ b/src/tests/apps/Jamfile @@ -4,4 +4,5 @@ SubInclude HAIKU_TOP src tests apps fake_app_server ; SubInclude HAIKU_TOP src tests apps installer ; SubInclude HAIKU_TOP src tests apps miniterminal ; SubInclude HAIKU_TOP src tests apps partitioner ; +SubInclude HAIKU_TOP src tests apps terminal_replicant ; diff --git a/src/tests/apps/terminal_replicant/Jamfile b/src/tests/apps/terminal_replicant/Jamfile new file mode 100644 index 0000000000..9dcf3fa206 --- /dev/null +++ b/src/tests/apps/terminal_replicant/Jamfile @@ -0,0 +1,12 @@ +SubDir HAIKU_TOP src tests apps terminal_replicant ; + +SetSubDirSupportedPlatformsBeOSCompatible ; + +SubDirHdrs [ FDirName $(HAIKU_TOP) src apps terminal ] ; + +Application RepliTerminal : + main.cpp + : be + ; + +SEARCH on [ FGristFiles TermView.h ] = [ FDirName $(HAIKU_TOP) src apps terminal ] ; diff --git a/src/tests/apps/terminal_replicant/main.cpp b/src/tests/apps/terminal_replicant/main.cpp new file mode 100644 index 0000000000..8ff9342f3d --- /dev/null +++ b/src/tests/apps/terminal_replicant/main.cpp @@ -0,0 +1,72 @@ +#include +#include +#include +#include +#include +#include +#include + +#include + +#include "TermConst.h" +#include "TermView.h" + +class App : public BApplication { +public: + App(); +}; + + +class Window : public BWindow { +public: + Window(); + void AttachTermView(); +private: + BShelf *fShelf; +}; + + +int main() +{ + App app; + app.Run(); + return 0; +} + + +// App +App::App() + :BApplication("application/x-vnd-terminal-replicant") +{ + Window *window = new Window(); + window->Show(); +} + + +// Window +Window::Window() + :BWindow(BRect(20, 20, 300, 300), "RepliTerminal", + B_DOCUMENT_WINDOW, B_ASYNCHRONOUS_CONTROLS|B_QUIT_ON_WINDOW_CLOSE) +{ + AttachTermView(); +} + + +void +Window::AttachTermView() +{ + // BMessage containing the class name and the app_signature + // for Terminal and TermView + BMessage message; + message.AddString("class", "TermView"); + message.AddString("add_on", TERM_SIGNATURE); + + BView *termView = dynamic_cast(instantiate_object(&message)); + + if (termView != NULL) { + termView->SetResizingMode(B_FOLLOW_ALL); + AddChild(termView); + + termView->ResizeToPreferred(); + } +}