00001 // -*- c++ -*- 00002 // 00003 // $Id: mainwindow.h 2360 2009-06-11 15:06:24Z rafi $ 00004 // 00005 // Copyright (C) 2008, 2009 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 YAPETUI::BaseWindow { 00060 private: 00061 WINDOW* toprightwin; 00062 WINDOW* bottomrightwin; 00063 YAPETUI::ListWidget<YAPET::PartDec>* recordlist; 00064 StatusBar statusbar; 00065 bool records_changed; 00066 00067 YAPET::Key* key; 00068 YAPET::File* file; 00069 00070 inline MainWindow(const MainWindow&) {} 00071 inline const MainWindow& operator=(const MainWindow&) { return *this;} 00072 00073 protected: 00074 void printTitle() throw (YAPETUI::UIException); 00075 00076 void topRightWinContent() throw(YAPETUI::UIException); 00077 00078 void bottomRightWinContent() throw(YAPETUI::UIException); 00079 00080 void createWindow() throw(YAPETUI::UIException); 00081 00082 void refresh() throw(YAPETUI::UIException); 00083 00084 void createFile(std::string& filename) throw(YAPETUI::UIException); 00085 void openFile(std::string filename) throw(YAPETUI::UIException); 00086 void saveFile(); 00087 void closeFile(); 00088 00089 void addNewRecord(); 00090 void editSelectedRecord(); 00091 void deleteSelectedRecord() throw(YAPETUI::UIException); 00092 void setSortOrder(); 00093 void searchTerm(); 00094 void searchNext(); 00095 bool quit(); 00096 void lockScreen() const throw(YAPETUI::UIException); 00097 void changePassword() throw(YAPETUI::UIException); 00098 public: 00099 MainWindow() throw(YAPETUI::UIException); 00100 virtual ~MainWindow(); 00101 00102 void run() throw(YAPETUI::UIException); 00103 void run(std::string fn); 00104 void resize() throw(YAPETUI::UIException); 00105 00106 #if defined(HAVE_SIGACTION) && defined(HAVE_SIGNAL_H) 00107 void handle_signal(int signo); 00108 #endif // defined(HAVE_SIGACTION) && defined(HAVE_SIGNAL_H) 00109 }; 00110 00111 #endif // _MAINWINDOW_H