xref: /haiku/src/apps/terminal/TermApp.h (revision 1e60bdeab63fa7a57bc9a55b032052e95a18bd2c)
1 /*
2  * Copyright 2001-2018, Haiku.
3  * Copyright (c) 2003-2004 Kian Duffy <myob@users.sourceforge.net>
4  * Parts Copyright (C) 1998,99 Kazuho Okui and Takashi Murai.
5  *
6  * Distributed under the terms of the MIT License.
7  *
8  * Authors:
9  *		Jeremiah Bailey, <jjbailey@gmail.com>
10  *		Kian Duffy, <myob@users.sourceforge.net>
11  *		Siarzhuk Zharski, <zharik@gmx.li>
12  */
13 
14 
15 #ifndef TERM_APP_H
16 #define TERM_APP_H
17 
18 
19 #include <Application.h>
20 #include <Catalog.h>
21 #include <File.h>
22 #include <String.h>
23 
24 #include "Colors.h"
25 
26 class Arguments;
27 class BRect;
28 class BWindow;
29 
30 
31 class TermApp : public BApplication {
32 public:
33 								TermApp();
34 	virtual						~TermApp();
35 
36 	static const rgb_color*		DefaultPalette()
37 									{ return fDefaultPalette; }
38 protected:
39 	virtual	void				ReadyToRun();
40 	virtual bool				QuitRequested();
41 	virtual	void				Quit();
42 	virtual	void				MessageReceived(BMessage* message);
43 	virtual	void				RefsReceived(BMessage* message);
44 	virtual	void				ArgvReceived(int32 argc, char** argv);
45 
46 private:
47 			status_t			_MakeTermWindow();
48 
49 	static	void				_SigChildHandler(int signal, void* data);
50 	static	status_t			_ChildCleanupThreadEntry(void* data);
51 			status_t			_ChildCleanupThread();
52 
53 			void				_Usage(char *name);
54 			void				_InitDefaultPalette();
55 private:
56 			thread_id			fChildCleanupThread;
57 			bool				fTerminating;
58 			bool				fStartFullscreen;
59 			BString				fWindowTitle;
60 			BString				fWorkingDirectory;
61 
62 			BWindow*			fTermWindow;
63 			Arguments*			fArgs;
64 	static	rgb_color			fDefaultPalette[kTermColorCount];
65 };
66 
67 
68 #endif	// TERM_APP_H
69