xref: /haiku/src/apps/terminal/TermWindow.h (revision 3be9edf8da228afd9fec0390f408c964766122aa)
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 	virtual void	FrameResized(float newWidth, float newHeight);
64 
65 private:
66 	struct Session;
67 	class TabView;
68 	friend class TabView;
69 
70 	void			_SetTermColors(TermViewContainerView *termView);
71 	void			_InitWindow();
72 	void			_SetupMenu();
73 	static void		_MakeEncodingMenu(BMenu *eMenu, bool withShortcuts);
74 	void			_GetPreferredFont(BFont &font);
75 	status_t		_DoPageSetup();
76 	void			_DoPrint();
77 	void			_AddTab(Arguments *args);
78 	void			_RemoveTab(int32 index);
79 	TermViewContainerView* _ActiveTermViewContainerView() const;
80 	TermViewContainerView* _TermViewContainerViewAt(int32 index) const;
81 	TermView*		_ActiveTermView() const;
82 	TermView*		_TermViewAt(int32 index) const;
83 	int32			_IndexOfTermView(TermView* termView) const;
84 	void			_CheckChildren();
85 	void			_ResizeView(TermView *view);
86 	void			_BuildWindowSizeMenu(BMenu *menu);
87 	int32			_NewSessionID();
88 
89 	BString			fInitialTitle;
90 	BList			fSessions;
91 
92 	TabView			*fTabView;
93 	TermView		*fTermView;
94 
95 	BMenuBar		*fMenubar;
96 	BMenu			*fFilemenu;
97 	BMenu			*fEditmenu;
98 	BMenu			*fEncodingmenu;
99 	BMenu			*fHelpmenu;
100 	BMenu			*fWindowSizeMenu;
101 	BMenu			*fSizeMenu;
102 
103 	BMessage		*fPrintSettings;
104 	PrefWindow		*fPrefWindow;
105 	FindWindow		*fFindPanel;
106 	BRect			fSavedFrame;
107 	window_look		fSavedLook;
108 
109 	// Saved search parameters
110 	BString			fFindString;
111 	BMenuItem		*fFindNextMenuItem;
112 	BMenuItem 		*fFindPreviousMenuItem;
113 	BMenuItem		*fIncreaseFontSizeMenuItem;
114 	BMenuItem		*fDecreaseFontSizeMenuItem;
115 
116 	bool			fFindSelection;
117 	bool			fForwardSearch;
118 	bool			fMatchCase;
119 	bool			fMatchWord;
120 
121 	bool			fFullScreen;
122 };
123 
124 #endif // __TERMWINDOW_H
125