00001 // -*- c++ -*- 00002 // 00003 // $Id: mainwindow.h 3342 2010-09-17 18:32:00Z java $ 00004 // 00005 // Copyright (C) 2008-2010 Rafael Ostertag 00006 // 00007 // This file is part of YAPET. 00008 // 00009 // YAPET is free software: you can redistribute it and/or modify it under the 00010 // terms of the GNU General Public License as published by the Free Software 00011 // Foundation, either version 3 of the License, or (at your option) any later 00012 // version. 00013 // 00014 // YAPET is distributed in the hope that it will be useful, but WITHOUT ANY 00015 // WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS 00016 // FOR A PARTICULAR PURPOSE. See the GNU General Public License for more 00017 // details. 00018 // 00019 // You should have received a copy of the GNU General Public License along with 00020 // YAPET. If not, see <http://www.gnu.org/licenses/>. 00021 // 00022 00023 #ifndef _MAINWINDOW_H 00024 #define _MAINWINDOW_H 00025 00026 00027 #ifdef HAVE_CONFIG_H 00028 #include <config.h> 00029 #endif 00030 00031 #ifdef HAVE_NCURSES_H 00032 # include <ncurses.h> 00033 #else // HAVE_NCURSES_H 00034 # ifdef HAVE_CURSES_H 00035 # include <curses.h> 00036 # else 00037 # error "Neither curses.h nor ncurses.h available" 00038 # endif // HAVE_CURSES_H 00039 #endif // HAVE_NCURSES_H 00040 #include "curswa.h" // Leave this here. It depends on the above includes. 00041 00042 #include <file.h> 00043 #include <basewindow.h> 00044 #include <uiexception.h> 00045 #include <statusbar.h> 00046 #include <listwidget.h> 00047 00059 class MainWindow : protected YAPET::UI::BaseWindow { 00060 private: 00061 WINDOW* toprightwin; 00062 WINDOW* bottomrightwin; 00063 YAPET::UI::ListWidget<YAPET::PartDec>* recordlist; 00064 StatusBar statusbar; 00065 bool records_changed; 00066 00067 YAPET::Key* key; 00068 YAPET::File* file; 00069 00070 unsigned int locktimeout; 00071 00072 bool usefsecurity; 00073 00074 inline MainWindow (const MainWindow&) {} 00075 inline const MainWindow& operator= (const MainWindow&) { 00076 return *this; 00077 } 00078 00079 protected: 00080 void printTitle() throw (YAPET::UI::UIException); 00081 00082 void topRightWinContent() throw (YAPET::UI::UIException); 00083 00084 void bottomRightWinContent() throw (YAPET::UI::UIException); 00085 00086 void createWindow() throw (YAPET::UI::UIException); 00087 00088 void refresh() throw (YAPET::UI::UIException); 00089 00090 void createFile (std::string& filename) throw (YAPET::UI::UIException); 00091 void openFile (std::string filename) throw (YAPET::UI::UIException); 00092 void saveFile(); 00093 void closeFile(); 00094 00095 void addNewRecord(); 00096 void editSelectedRecord(); 00097 void deleteSelectedRecord() throw (YAPET::UI::UIException); 00098 void setSortOrder(); 00099 void searchTerm(); 00100 void searchNext(); 00101 bool quit(); 00102 void lockScreen() const throw (YAPET::UI::UIException); 00103 void changePassword() throw (YAPET::UI::UIException); 00104 public: 00105 MainWindow (unsigned int timeout, bool fsecurity) throw (YAPET::UI::UIException); 00106 virtual ~MainWindow(); 00107 00108 void run() throw (YAPET::UI::UIException); 00109 void run (std::string fn); 00110 void resize() throw (YAPET::UI::UIException); 00111 00112 #if defined(HAVE_SIGACTION) && defined(HAVE_SIGNAL_H) 00113 void handle_signal (int signo); 00114 #endif // defined(HAVE_SIGACTION) && defined(HAVE_SIGNAL_H) 00115 }; 00116 00117 #endif // _MAINWINDOW_H
1.7.1