1 /* PoorManWindow.h 2 * 3 * Philip Harrison 4 * Started: 4/25/2004 5 * Version: 0.1 6 */ 7 8 #ifndef POOR_MAN_WINDOW_H 9 #define POOR_MAN_WINDOW_H 10 11 #include <Window.h> 12 #include <Point.h> 13 #include <FilePanel.h> 14 #include <Path.h> 15 #include <Message.h> 16 #include <MenuBar.h> 17 #include <Menu.h> 18 #include <MenuItem.h> 19 #include <TextView.h> 20 #include <StringView.h> 21 #include <ScrollView.h> 22 #include <String.h> 23 #include <SupportDefs.h> 24 25 #include "PoorManView.h" 26 #include "PoorManPreferencesWindow.h" 27 28 class PoorManWindow: public BWindow 29 { 30 public: 31 PoorManWindow(BRect frame); 32 virtual void MessageReceived(BMessage * message); 33 34 virtual void FrameResized(float width, float height); 35 virtual bool QuitRequested(); 36 virtual void Zoom(BPoint origin, float width, float height); 37 38 // ------------------------------------------- 39 // Public PoorMan Window Methods 40 void SetDirLabel(const char * name); 41 void SetHits(uint32 num) { hits = num;} 42 uint32 GetHits() { return hits; } 43 status_t SaveConsole(BMessage * message, bool); 44 status_t SaveSettings(); 45 46 // ------------------------------------------- 47 // Preferences and Settings 48 // Site Tab 49 bool DirListFlag() { return dir_list_flag; } 50 void SetDirListFlag(bool flag) { dir_list_flag = flag; } 51 const char * IndexFileName() { return index_file_name.String(); } 52 void SetIndexFileName(const char * str) { index_file_name.SetTo(str); } 53 const char * WebDir() { return web_directory.String(); } 54 void SetWebDir(const char * str) { web_directory.SetTo(str); } 55 // Logging Tab 56 bool LogConsoleFlag() { return log_console_flag; } 57 void SetLogConsoleFlag(bool flag) { log_console_flag = flag; } 58 bool LogFileFlag() { return log_file_flag; } 59 void SetLogFileFlag(bool flag) { log_file_flag = flag; } 60 const char * LogPath() { return log_path.String(); } 61 void SetLogPath(const char * str) { log_path.SetTo(str); } 62 // Advanced Tab 63 int32 MaxConnections() { return max_connections; } 64 void SetMaxConnections(int32 num) { max_connections = num; } 65 66 67 private: 68 // ------------------------------------------- 69 // PoorMan Window Methods 70 status_t ReadSettings(); 71 void DefaultSettings(); 72 73 void UpdateStatusLabel(bool); 74 void UpdateHitsLabel(); 75 76 private: 77 // ------------------------------------------- 78 // PoorMan Window 79 PoorManView * mainView; 80 81 // ------------------------------------------- 82 // Build Menu Methods 83 BMenu * BuildFileMenu() const; 84 BMenu * BuildEditMenu() const; 85 BMenu * BuildControlsMenu() const; 86 87 // -------------------------------------------- 88 // MenuBar & Menu items 89 BMenuBar * FileMenuBar; 90 BMenu * FileMenu; 91 BMenu * EditMenu; 92 BMenu * ControlsMenu; 93 94 // -------------------------------------------- 95 // Status, Hits, Directory 96 BStringView * statusView; 97 BStringView * hitsView; 98 BStringView * dirView; 99 100 bool status; 101 uint32 hits; 102 char hitsLabel[25]; 103 104 // -------------------------------------------- 105 // Logging View 106 BScrollView * scrollView; 107 BTextView * loggingView; 108 // use asctime() for format of [Date/Time]: 109 110 111 // ------------------------------------------- 112 // PoorMan Preference Window 113 PoorManPreferencesWindow * prefWindow; 114 115 // site tab 116 BString web_directory; 117 BString index_file_name; 118 bool dir_list_flag; 119 120 // logging tab 121 bool log_console_flag; 122 bool log_file_flag; 123 BString log_path; 124 // advanced tab 125 int32 max_connections; 126 127 bool is_zoomed; 128 float last_width; 129 float last_height; 130 BRect frame; 131 BRect setwindow_frame; 132 133 134 // File Panels 135 BFilePanel * saveConsoleFilePanel; 136 BFilePanel * saveConsoleSelectionFilePanel; 137 138 }; 139 140 #endif 141