xref: /haiku/src/apps/terminal/TermApp.h (revision dace9ead09063eafb01c1ffb0f42f085cd5dd665)
1d3dc729fSAxel Dörfler /*
2*dace9eadSlazybullfrog  * Copyright 2001-2018, Haiku.
3*dace9eadSlazybullfrog  * Copyright (c) 2003-2004 Kian Duffy <myob@users.sourceforge.net>
4d3dc729fSAxel Dörfler  * Parts Copyright (C) 1998,99 Kazuho Okui and Takashi Murai.
5d3dc729fSAxel Dörfler  *
65b41331fSSiarzhuk Zharski  * Distributed under the terms of the MIT License.
7d3dc729fSAxel Dörfler  *
85b41331fSSiarzhuk Zharski  * Authors:
9*dace9eadSlazybullfrog  *		Jeremiah Bailey, <jjbailey@gmail.com>
10*dace9eadSlazybullfrog  *		Kian Duffy, <myob@users.sourceforge.net>
11*dace9eadSlazybullfrog  *		Siarzhuk Zharski, <zharik@gmx.li>
12d3dc729fSAxel Dörfler  */
13*dace9eadSlazybullfrog 
14*dace9eadSlazybullfrog 
157f108511SAxel Dörfler #ifndef TERM_APP_H
167f108511SAxel Dörfler #define TERM_APP_H
17d3dc729fSAxel Dörfler 
18d3dc729fSAxel Dörfler 
197f108511SAxel Dörfler #include <Application.h>
208989d8a5SStephan Aßmus #include <Catalog.h>
21d18fc399SAdrien Destugues #include <File.h>
22d3dc729fSAxel Dörfler #include <String.h>
23d3dc729fSAxel Dörfler 
24fe256869SSiarzhuk Zharski #include "Colors.h"
2591eec68cSIngo Weinhold 
26bb4632f1SStefano Ceccherini class Arguments;
27d3dc729fSAxel Dörfler class BRect;
28702e4be8SStefano Ceccherini class BWindow;
2991eec68cSIngo Weinhold 
3091eec68cSIngo Weinhold 
317f108511SAxel Dörfler class TermApp : public BApplication {
32d3dc729fSAxel Dörfler public:
3376649c03SAxel Dörfler 								TermApp();
347f108511SAxel Dörfler 	virtual						~TermApp();
35d3dc729fSAxel Dörfler 
DefaultPalette()36fe256869SSiarzhuk Zharski 	static const rgb_color*		DefaultPalette()
37fe256869SSiarzhuk Zharski 									{ return fDefaultPalette; }
387f108511SAxel Dörfler protected:
39490f7858SIngo Weinhold 	virtual	void				ReadyToRun();
40490f7858SIngo Weinhold 	virtual bool				QuitRequested();
41490f7858SIngo Weinhold 	virtual	void				Quit();
42490f7858SIngo Weinhold 	virtual	void				MessageReceived(BMessage* message);
43490f7858SIngo Weinhold 	virtual	void				RefsReceived(BMessage* message);
44490f7858SIngo Weinhold 	virtual	void				ArgvReceived(int32 argc, char** argv);
45d3dc729fSAxel Dörfler 
46d3dc729fSAxel Dörfler private:
47105093fdSIngo Weinhold 			status_t			_MakeTermWindow();
48d3dc729fSAxel Dörfler 
49dbc03773SIngo Weinhold 	static	void				_SigChildHandler(int signal, void* data);
50eb718e31SIngo Weinhold 	static	status_t			_ChildCleanupThreadEntry(void* data);
51eb718e31SIngo Weinhold 			status_t			_ChildCleanupThread();
52dbc03773SIngo Weinhold 
537f108511SAxel Dörfler 			void				_Usage(char *name);
54fe256869SSiarzhuk Zharski 			void				_InitDefaultPalette();
5591eec68cSIngo Weinhold private:
56eb718e31SIngo Weinhold 			thread_id			fChildCleanupThread;
57eb718e31SIngo Weinhold 			bool				fTerminating;
58265fea4aSFrançois Revol 			bool				fStartFullscreen;
590d5dea62SAxel Dörfler 			BString				fWindowTitle;
60*dace9eadSlazybullfrog 			BString				fWorkingDirectory;
6185f69514SStefano Ceccherini 
62702e4be8SStefano Ceccherini 			BWindow*			fTermWindow;
63bb4632f1SStefano Ceccherini 			Arguments*			fArgs;
64fe256869SSiarzhuk Zharski 	static	rgb_color			fDefaultPalette[kTermColorCount];
65d3dc729fSAxel Dörfler };
66d3dc729fSAxel Dörfler 
6791eec68cSIngo Weinhold 
687f108511SAxel Dörfler #endif	// TERM_APP_H
69