xref: /haiku/src/tests/apps/miniterminal/MiniApp.cpp (revision ee897a16b0aa6487c0fcf3ea6b67f6d2365edd8f)
1 /*
2  * Part of the MiniTerminal.
3  *
4  * Copyright 2005 Michael Lotz. All rights reserved.
5  * Distributed under the Haiku License.
6  */
7 
8 #include <stdio.h>
9 #include "MiniApp.h"
10 #include "MiniWin.h"
11 #include "MiniView.h"
12 
13 MiniApp::MiniApp(BRect bounds)
14 	:	BApplication("application/x-vnd.Haiku.MiniTerminal")
15 {
16 	fWindow = new MiniWin(bounds);
17 	fWindow->Show();
18 }
19 
20 
21 void
22 MiniApp::ReadyToRun()
23 {
24 	fWindow->View()->Start();
25 }
26 
27 
28 MiniApp::~MiniApp()
29 {
30 }
31 
32 
33 int
34 main(int argc, const char *argv[])
35 {
36 	BRect bounds(50, 50, 630, 435);
37 
38 	if (argc >= 3) {
39 		BPoint offset;
40 		sscanf(argv[1], "%f", &offset.x);
41 		sscanf(argv[2], "%f", &offset.y);
42 		bounds.OffsetTo(offset);
43 	}
44 
45 	if (argc >= 5) {
46 		BPoint size;
47 		sscanf(argv[3], "%f", &size.x);
48 		sscanf(argv[4], "%f", &size.y);
49 		bounds.right = bounds.left + size.x;
50 		bounds.bottom = bounds.top + size.y;
51 	}
52 
53 	MiniApp *app = new MiniApp(bounds);
54 	app->Run();
55 	delete app;
56 	return 0;
57 }
58