1 2 /************************************************************************** 3 * Copyright (C) 2007-2015 Ruben Pollan Bella <meskio@sindominio.net> * 4 * * 5 * This file is part of TuDu. * 6 * * 7 * TuDu is free software; you can redistribute it and/or modify * 8 * it under the terms of the GNU General Public License as published by * 9 * the Free Software Foundation; version 3 of the License. * 10 * * 11 * TuDu is distributed in the hope that it will be useful, * 12 * but WITHOUT ANY WARRANTY; without even the implied warranty of * 13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * 14 * GNU General Public License for more details. * 15 * * 16 * You should have received a copy of the GNU General Public License * 17 * along with this program. If not, see <http://www.gnu.org/licenses/>. * 18 **************************************************************************/ 19 20 #ifndef SCREEN_H 21 #define SCREEN_H 22 23 #include "includes.h" 24 #include "window.h" 25 #include "text.h" 26 #include "data.h" 27 #include "config.h" 28 #include "editor.h" 29 #include "scheduler.h" 30 31 class Screen 32 { 33 public: 34 Screen(Config& c); 35 ~Screen(); 36 37 void resizeTerm(); 38 void drawTask(int line, int depth, ToDo& t, bool isCursor=false); 39 void drawTitle(int line, int depth, wstring& title, int startLine=0); 40 void drawText(Text &t); 41 void drawSched(Sched &sched, pToDo cursor = NULL); 42 void scrollUpText(Text &t); 43 void scrollDownText(Text &t); 44 void deadlineClear(int line); 45 void priorityClear(int line); 46 Editor::return_t editTitle(int line, int depth, bool haveChild, wstring& str, int cursorPos = -1); 47 void editText(Text& t); 48 Editor::return_t editDeadline(int line, Date& deadline, bool done, int cursorPos = -1); 49 Editor::return_t editSched(Date& s, int cursorPos = -1); 50 Editor::return_t setPriority(int line, int& priority); 51 Editor::return_t setCategory(int line, wstring& category, int cursorPos = -1); 52 void treeClear(); 53 int treeLines(); 54 /* number of lines the task needs on the screen */ 55 int taskLines(int depth, ToDo &t); 56 Editor::return_t searchText(wstring& pattern, int cursorPos = -1); 57 Editor::return_t cmd(wstring& command, int cursorPos = -1); 58 bool confirmQuit(); 59 void infoMsg(const char str[]); 60 void infoClear(); 61 void infoPercent(int percent); 62 void helpPopUp(wstring str[], int len); 63 private: 64 Window *whelp; 65 Window *wtree; 66 Window *wpriority; 67 Window *wcategory; 68 Window *wdeadline; 69 Window *wtext; 70 Window *winfo; 71 Window *wschedule; 72 vector<Window *> pipes; 73 Config &config; 74 TitleEditor titleEditor; 75 CategoryEditor categoryEditor; 76 DateEditor dateEditor; 77 PriorityEditor priorityEditor; 78 HistoryEditor searchEditor; 79 CmdEditor cmdEditor; 80 windows_defs coor; 81 82 void draw_helpbar(window_coor c); 83 void draw(); 84 wstring date2str(Date& date); 85 Date str2date(wstring str); 86 87 /* col where the title text starts */ 88 int startTitle(int depth); 89 }; 90 91 #endif 92