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
This commit is contained in:
parent
397a6cee6a
commit
c9aadc4f63
@ -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 ;
|
||||
|
||||
|
12
src/tests/apps/terminal_replicant/Jamfile
Normal file
12
src/tests/apps/terminal_replicant/Jamfile
Normal file
@ -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 ] ;
|
72
src/tests/apps/terminal_replicant/main.cpp
Normal file
72
src/tests/apps/terminal_replicant/main.cpp
Normal file
@ -0,0 +1,72 @@
|
||||
#include <Application.h>
|
||||
#include <Archivable.h>
|
||||
#include <Box.h>
|
||||
#include <Message.h>
|
||||
#include <Path.h>
|
||||
#include <Shelf.h>
|
||||
#include <Window.h>
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
#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<BView *>(instantiate_object(&message));
|
||||
|
||||
if (termView != NULL) {
|
||||
termView->SetResizingMode(B_FOLLOW_ALL);
|
||||
AddChild(termView);
|
||||
|
||||
termView->ResizeToPreferred();
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user