xref: /haiku/src/apps/terminal/TermApp.h (revision 1345706a9ff6ad0dc041339a02d4259998b0765d)
1 /*
2  * Copyright 2001-2008, Haiku.
3  * Copyright (c) 2003-4 Kian Duffy <myob@users.sourceforge.net>
4  * Parts Copyright (C) 1998,99 Kazuho Okui and Takashi Murai.
5  *
6  * Permission is hereby granted, free of charge, to any person obtaining
7  * a copy of this software and associated documentation files or portions
8  * thereof (the "Software"), to deal in the Software without restriction,
9  * including without limitation the rights to use, copy, modify, merge,
10  * publish, distribute, sublicense, and/or sell copies of the Software,
11  * and to permit persons to whom the Software is furnished to do so, subject
12  * to the following conditions:
13  *
14  *  * Redistributions of source code must retain the above copyright notice,
15  *    this list of conditions and the following disclaimer.
16  *
17  *  * Redistributions in binary form must reproduce the above copyright notice
18  *    in the  binary, as well as this list of conditions and the following
19  *    disclaimer in the documentation and/or other materials provided with
20  *    the distribution.
21  *
22  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
23  * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
24  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
25  * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
26  * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
27  * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
28  * THE SOFTWARE.
29  *
30  */
31 #ifndef TERM_APP_H
32 #define TERM_APP_H
33 
34 
35 #include <Application.h>
36 #include <Catalog.h>
37 #include <String.h>
38 
39 class Arguments;
40 class BRect;
41 class BWindow;
42 class TermApp : public BApplication {
43 	public:
44 		TermApp();
45 		virtual ~TermApp();
46 
47 	protected:
48 		void ReadyToRun();
49 		void Quit();
50 		void AboutRequested();
51 		void MessageReceived(BMessage* message);
52 		void RefsReceived(BMessage* message);
53 		void ArgvReceived(int32 argc, char** argv);
54 
55 	private:
56 		status_t _MakeTermWindow(BRect& frame);
57 		void _SwitchTerm();
58 		void _ActivateTermWindow(team_id id);
59 		bool _IsSwitchTarget(team_id id);
60 		void _SanitizeIDs(BMessage* data, uint8* windows, ssize_t length);
61 		bool _UpdateIDs(bool set, uint8* windows, ssize_t maxLength,
62 			ssize_t* _length);
63 		void _UpdateRegistration(bool set);
64 		void _UnregisterTerminal();
65 		void _RegisterTerminal();
66 
67 		void _HandleChildCleanup();
68 		static void _SigChildHandler(int signal, void* data);
69 		static status_t _ChildCleanupThread(void* data);
70 
71 		void _Usage(char *name);
72 
73 		bool		fStartFullscreen;
74 		BString		fWindowTitle;
75 		int32		fWindowNumber;
76 
77 		BWindow*	fTermWindow;
78 		BRect		fTermFrame;
79 		Arguments	*fArgs;
80 };
81 
82 #endif	// TERM_APP_H
83