xref: /haiku/src/apps/terminal/TermApp.h (revision 702e4be807966ff71d1c6d71b46f93d3e83314c9)
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 
38d3dc729fSAxel Dörfler class BRect;
39*702e4be8SStefano Ceccherini class BWindow;
407f108511SAxel Dörfler class TermApp : public BApplication {
41d3dc729fSAxel Dörfler 	public:
4276649c03SAxel Dörfler 		TermApp();
437f108511SAxel Dörfler 		virtual ~TermApp();
44d3dc729fSAxel Dörfler 
457f108511SAxel Dörfler 	protected:
4676649c03SAxel Dörfler 		void ReadyToRun();
4776649c03SAxel Dörfler 		void Quit();
4876649c03SAxel Dörfler 		void AboutRequested();
497f108511SAxel Dörfler 		void MessageReceived(BMessage* message);
50d3dc729fSAxel Dörfler 		void RefsReceived(BMessage* message);
51d3dc729fSAxel Dörfler 		void ArgvReceived(int32 argc, char** argv);
52d3dc729fSAxel Dörfler 
53d3dc729fSAxel Dörfler 	private:
547f108511SAxel Dörfler 		status_t _MakeTermWindow(BRect& frame);
557f108511SAxel Dörfler 		void _SwitchTerm();
567f108511SAxel Dörfler 		void _ActivateTermWindow(team_id id);
577f108511SAxel Dörfler 		bool _IsMinimized(team_id id);
58d1c710a7SAxel Dörfler 		void _SanitizeIDs(BMessage* data, uint8* windows, ssize_t length);
59d1c710a7SAxel Dörfler 		bool _UpdateIDs(bool set, uint8* windows, ssize_t maxLength,
60d1c710a7SAxel Dörfler 			ssize_t* _length);
617f108511SAxel Dörfler 		void _UpdateRegistration(bool set);
627f108511SAxel Dörfler 		void _UnregisterTerminal();
637f108511SAxel Dörfler 		void _RegisterTerminal();
64d3dc729fSAxel Dörfler 
657f108511SAxel Dörfler 		void _Usage(char *name);
667f108511SAxel Dörfler 
67265fea4aSFrançois Revol 		bool		fStartFullscreen;
680d5dea62SAxel Dörfler 		BString		fWindowTitle;
697f108511SAxel Dörfler 		int32		fWindowNumber;
7085f69514SStefano Ceccherini 
71*702e4be8SStefano Ceccherini 		BWindow*	fTermWindow;
72d3dc729fSAxel Dörfler 		BRect		fTermFrame;
7385f69514SStefano Ceccherini 		BString		fCommandLine;
74d3dc729fSAxel Dörfler };
75d3dc729fSAxel Dörfler 
767f108511SAxel Dörfler #endif	// TERM_APP_H
77