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 BMenu* _MakeEncodingMenu(); 74 static BMenu* _MakeWindowSizeMenu(); 75 76 void _GetPreferredFont(BFont &font); 77 status_t _DoPageSetup(); 78 void _DoPrint(); 79 void _AddTab(Arguments *args); 80 void _RemoveTab(int32 index); 81 TermViewContainerView* _ActiveTermViewContainerView() const; 82 TermViewContainerView* _TermViewContainerViewAt(int32 index) const; 83 TermView* _ActiveTermView() const; 84 TermView* _TermViewAt(int32 index) const; 85 int32 _IndexOfTermView(TermView* termView) const; 86 void _CheckChildren(); 87 void _ResizeView(TermView *view); 88 89 int32 _NewSessionID(); 90 91 BString fInitialTitle; 92 BList fSessions; 93 94 TabView *fTabView; 95 TermView *fTermView; 96 97 BMenuBar *fMenubar; 98 BMenu *fFilemenu; 99 BMenu *fEditmenu; 100 BMenu *fEncodingmenu; 101 BMenu *fHelpmenu; 102 BMenu *fWindowSizeMenu; 103 BMenu *fSizeMenu; 104 105 BMessage *fPrintSettings; 106 PrefWindow *fPrefWindow; 107 FindWindow *fFindPanel; 108 BRect fSavedFrame; 109 window_look fSavedLook; 110 111 // Saved search parameters 112 BString fFindString; 113 BMenuItem *fFindNextMenuItem; 114 BMenuItem *fFindPreviousMenuItem; 115 BMenuItem *fIncreaseFontSizeMenuItem; 116 BMenuItem *fDecreaseFontSizeMenuItem; 117 118 bool fFindSelection; 119 bool fForwardSearch; 120 bool fMatchCase; 121 bool fMatchWord; 122 123 bool fFullScreen; 124 }; 125 126 #endif // __TERMWINDOW_H 127