xref: /haiku/src/apps/terminal/TermApp.h (revision dbc03773ef3b00c0daf4f4cdd8871f0a4072d094)
1d3dc729fSAxel Dörfler /*
27f108511SAxel Dörfler  * Copyright 2001-2007, Haiku.
3d3dc729fSAxel Dörfler  * Copyright (c) 2003-4 Kian Duffy <myob@users.sourceforge.net>
4d3dc729fSAxel Dörfler  * Parts Copyright (C) 1998,99 Kazuho Okui and Takashi Murai.
5d3dc729fSAxel Dörfler  *
6d3dc729fSAxel Dörfler  * Permission is hereby granted, free of charge, to any person obtaining
7d3dc729fSAxel Dörfler  * a copy of this software and associated documentation files or portions
8d3dc729fSAxel Dörfler  * thereof (the "Software"), to deal in the Software without restriction,
9d3dc729fSAxel Dörfler  * including without limitation the rights to use, copy, modify, merge,
10d3dc729fSAxel Dörfler  * publish, distribute, sublicense, and/or sell copies of the Software,
11d3dc729fSAxel Dörfler  * and to permit persons to whom the Software is furnished to do so, subject
12d3dc729fSAxel Dörfler  * to the following conditions:
13d3dc729fSAxel Dörfler  *
14d3dc729fSAxel Dörfler  *  * Redistributions of source code must retain the above copyright notice,
15d3dc729fSAxel Dörfler  *    this list of conditions and the following disclaimer.
16d3dc729fSAxel Dörfler  *
17d3dc729fSAxel Dörfler  *  * Redistributions in binary form must reproduce the above copyright notice
18d3dc729fSAxel Dörfler  *    in the  binary, as well as this list of conditions and the following
19d3dc729fSAxel Dörfler  *    disclaimer in the documentation and/or other materials provided with
20d3dc729fSAxel Dörfler  *    the distribution.
21d3dc729fSAxel Dörfler  *
22d3dc729fSAxel Dörfler  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
23d3dc729fSAxel Dörfler  * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
24d3dc729fSAxel Dörfler  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
25d3dc729fSAxel Dörfler  * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
26d3dc729fSAxel Dörfler  * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
27d3dc729fSAxel Dörfler  * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
28d3dc729fSAxel Dörfler  * THE SOFTWARE.
29d3dc729fSAxel Dörfler  *
30d3dc729fSAxel Dörfler  */
317f108511SAxel Dörfler #ifndef TERM_APP_H
327f108511SAxel Dörfler #define TERM_APP_H
33d3dc729fSAxel Dörfler 
34d3dc729fSAxel Dörfler 
357f108511SAxel Dörfler #include <Application.h>
36d3dc729fSAxel Dörfler #include <String.h>
37d3dc729fSAxel Dörfler 
38bb4632f1SStefano Ceccherini class Arguments;
39d3dc729fSAxel Dörfler class BRect;
40702e4be8SStefano Ceccherini class BWindow;
417f108511SAxel Dörfler class TermApp : public BApplication {
42d3dc729fSAxel Dörfler 	public:
4376649c03SAxel Dörfler 		TermApp();
447f108511SAxel Dörfler 		virtual ~TermApp();
45d3dc729fSAxel Dörfler 
467f108511SAxel Dörfler 	protected:
4776649c03SAxel Dörfler 		void ReadyToRun();
4876649c03SAxel Dörfler 		void Quit();
4976649c03SAxel Dörfler 		void AboutRequested();
507f108511SAxel Dörfler 		void MessageReceived(BMessage* message);
51d3dc729fSAxel Dörfler 		void RefsReceived(BMessage* message);
52d3dc729fSAxel Dörfler 		void ArgvReceived(int32 argc, char** argv);
53d3dc729fSAxel Dörfler 
54d3dc729fSAxel Dörfler 	private:
557f108511SAxel Dörfler 		status_t _MakeTermWindow(BRect& frame);
567f108511SAxel Dörfler 		void _SwitchTerm();
577f108511SAxel Dörfler 		void _ActivateTermWindow(team_id id);
587f108511SAxel Dörfler 		bool _IsMinimized(team_id id);
59d1c710a7SAxel Dörfler 		void _SanitizeIDs(BMessage* data, uint8* windows, ssize_t length);
60d1c710a7SAxel Dörfler 		bool _UpdateIDs(bool set, uint8* windows, ssize_t maxLength,
61d1c710a7SAxel Dörfler 			ssize_t* _length);
627f108511SAxel Dörfler 		void _UpdateRegistration(bool set);
637f108511SAxel Dörfler 		void _UnregisterTerminal();
647f108511SAxel Dörfler 		void _RegisterTerminal();
65d3dc729fSAxel Dörfler 
66*dbc03773SIngo Weinhold 		void _HandleChildCleanup();
67*dbc03773SIngo Weinhold 		static void _SigChildHandler(int signal, void* data);
68*dbc03773SIngo Weinhold 		static status_t _ChildCleanupThread(void* data);
69*dbc03773SIngo Weinhold 
707f108511SAxel Dörfler 		void _Usage(char *name);
717f108511SAxel Dörfler 
72265fea4aSFrançois Revol 		bool		fStartFullscreen;
730d5dea62SAxel Dörfler 		BString		fWindowTitle;
747f108511SAxel Dörfler 		int32		fWindowNumber;
7585f69514SStefano Ceccherini 
76702e4be8SStefano Ceccherini 		BWindow*	fTermWindow;
77d3dc729fSAxel Dörfler 		BRect		fTermFrame;
78bb4632f1SStefano Ceccherini 		Arguments	*fArgs;
79d3dc729fSAxel Dörfler };
80d3dc729fSAxel Dörfler 
817f108511SAxel Dörfler #endif	// TERM_APP_H
82