xref: /haiku/src/apps/terminal/TermWindow.h (revision 03187b607b2b5eec7ee059f1ead09bdba14991fb)
1 /*
2  * Copyright 2001-2007, 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 __TERMWINDOW_H
32 #define __TERMWINDOW_H
33 
34 
35 #include <String.h>
36 #include <Window.h>
37 
38 class Arguments;
39 class BFont;
40 class BMenu;
41 class BMenuBar;
42 class FindWindow;
43 class PrefWindow;
44 class SmartTabView;
45 class TermView;
46 class TermViewContainerView;
47 
48 
49 class TermWindow : public BWindow {
50 public:
51 	TermWindow(BRect frame, const char* title, Arguments *args);
52 	virtual ~TermWindow();
53 
54 			void	SetSessionWindowTitle(TermView* termView,
55 						const char* title);
56 			void	SessionChanged();
57 
58 protected:
59 	virtual void	MessageReceived(BMessage *message);
60 	virtual void	WindowActivated(bool);
61 	virtual void	MenusBeginning();
62 	virtual	void	Zoom(BPoint leftTop, float width, float height);
63 
64 private:
65 	struct Session;
66 	class TabView;
67 	friend class TabView;
68 
69 	void			_SetTermColors(TermViewContainerView *termView);
70 	void			_InitWindow();
71 	void			_SetupMenu();
72 	void			_GetPreferredFont(BFont &font);
73 	status_t		_DoPageSetup();
74 	void			_DoPrint();
75 	void			_AddTab(Arguments *args);
76 	void			_RemoveTab(int32 index);
77 	TermViewContainerView* _ActiveTermViewContainerView() const;
78 	TermViewContainerView* _TermViewContainerViewAt(int32 index) const;
79 	TermView*		_ActiveTermView() const;
80 	TermView*		_TermViewAt(int32 index) const;
81 	int32			_IndexOfTermView(TermView* termView) const;
82 	void			_CheckChildren();
83 	void			_ResizeView(TermView *view);
84 	void			_BuildWindowSizeMenu(BMenu *menu);
85 	int32			_NewSessionID();
86 
87 	BString			fInitialTitle;
88 	BList			fSessions;
89 
90 	TabView			*fTabView;
91 	TermView		*fTermView;
92 
93 	BMenuBar		*fMenubar;
94 	BMenu			*fFilemenu;
95 	BMenu			*fEditmenu;
96 	BMenu			*fEncodingmenu;
97 	BMenu			*fHelpmenu;
98 	BMenu			*fWindowSizeMenu;
99 	BMenu			*fSizeMenu;
100 
101 	BMessage		*fPrintSettings;
102 	PrefWindow		*fPrefWindow;
103 	FindWindow		*fFindPanel;
104 	BRect			fSavedFrame;
105 	window_look		fSavedLook;
106 
107 	// Saved search parameters
108 	BString			fFindString;
109 	BMenuItem		*fFindNextMenuItem;
110 	BMenuItem 		*fFindPreviousMenuItem;
111 	BMenuItem		*fIncreaseFontSizeMenuItem;
112 	BMenuItem		*fDecreaseFontSizeMenuItem;
113 
114 	bool			fFindSelection;
115 	bool			fForwardSearch;
116 	bool			fMatchCase;
117 	bool			fMatchWord;
118 
119 	bool			fFullScreen;
120 };
121 
122 #endif // __TERMWINDOW_H
123