libyui-ncurses
2.44.1
|
00001 /* 00002 Copyright (C) 2000-2012 Novell, Inc 00003 This library is free software; you can redistribute it and/or modify 00004 it under the terms of the GNU Lesser General Public License as 00005 published by the Free Software Foundation; either version 2.1 of the 00006 License, or (at your option) version 3.0 of the License. This library 00007 is distributed in the hope that it will be useful, but WITHOUT ANY 00008 WARRANTY; without even the implied warranty of MERCHANTABILITY or 00009 FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public 00010 License for more details. You should have received a copy of the GNU 00011 Lesser General Public License along with this library; if not, write 00012 to the Free Software Foundation, Inc., 51 Franklin Street, Fifth 00013 Floor, Boston, MA 02110-1301 USA 00014 */ 00015 00016 00017 /*-/ 00018 00019 File: NCApplication.h 00020 00021 Author: Gabriele Mohr <gs@suse.de> 00022 00023 /-*/ 00024 00025 #ifndef NCApplication_h 00026 #define NCApplication_h 00027 00028 #include <yui/YApplication.h> 00029 00030 00031 class NCApplication: public YApplication 00032 { 00033 00034 protected: 00035 00036 friend class YNCursesUI; 00037 00038 /** 00039 * Constructor. 00040 * 00041 * Use YUI::app() to get the singleton for this class. 00042 **/ 00043 NCApplication(); 00044 00045 /** 00046 * Destructor. 00047 **/ 00048 virtual ~NCApplication(); 00049 00050 public: 00051 00052 /** 00053 * Set language and encoding for the locale environment ($LANG). 00054 * 00055 * 'language' is the ISO short code ("de_DE", "en_US", ...). 00056 * 00057 * 'encoding' an (optional) encoding ("utf8", ...) that will be appended if 00058 * present. 00059 * 00060 * Reimplemented from YApplication. 00061 **/ 00062 virtual void setLanguage( const std::string & language, 00063 const std::string & encoding = std::string() ); 00064 00065 /** 00066 * Open a directory selection box and prompt the user for an existing 00067 * directory. 00068 * 00069 * 'startDir' is the initial directory that is displayed. 00070 * 00071 * 'headline' is an explanatory text for the directory selection box. 00072 * Graphical UIs may omit that if no window manager is running. 00073 * 00074 * Returns the selected directory name 00075 * or an empty std::string if the user canceled the operation. 00076 * 00077 * Implemented from YApplication. 00078 **/ 00079 virtual std::string askForExistingDirectory( const std::string & startDir, 00080 const std::string & headline ); 00081 00082 /** 00083 * Open a file selection box and prompt the user for an existing file. 00084 * 00085 * 'startWith' is the initial directory or file. 00086 * 00087 * 'filter' is one or more blank-separated file patterns, e.g. 00088 * "*.png *.jpg" 00089 * 00090 * 'headline' is an explanatory text for the file selection box. 00091 * Graphical UIs may omit that if no window manager is running. 00092 * 00093 * Returns the selected file name 00094 * or an empty std::string if the user canceled the operation. 00095 * 00096 * Implemented from YApplication. 00097 **/ 00098 virtual std::string askForExistingFile( const std::string & startWith, 00099 const std::string & filter, 00100 const std::string & headline ); 00101 00102 /** 00103 * Open a file selection box and prompt the user for a file to save data 00104 * to. Automatically asks for confirmation if the user selects an existing 00105 * file. 00106 * 00107 * 'startWith' is the initial directory or file. 00108 * 00109 * 'filter' is one or more blank-separated file patterns, e.g. 00110 * "*.png *.jpg" 00111 * 00112 * 'headline' is an explanatory text for the file selection box. 00113 * Graphical UIs may omit that if no window manager is running. 00114 * 00115 * Returns the selected file name 00116 * or an empty std::string if the user canceled the operation. 00117 * 00118 * Implemented from YApplication. 00119 **/ 00120 virtual std::string askForSaveFileName( const std::string & startWith, 00121 const std::string & filter, 00122 const std::string & headline ); 00123 00124 /** 00125 * Beep. 00126 * 00127 * Reimplemented from YApplication. 00128 **/ 00129 virtual void beep(); 00130 00131 /** 00132 * Redraw the screen. 00133 * 00134 * Reimplemented from YApplication. 00135 **/ 00136 virtual void redrawScreen(); 00137 00138 /** 00139 * Initialize the (text) console keyboard. 00140 * 00141 * Reimplemented from YApplication. 00142 **/ 00143 virtual void initConsoleKeyboard(); 00144 00145 /** 00146 * Set the (text) console font according to the current encoding etc. 00147 * See the setfont(8) command and the console HowTo for details. 00148 * 00149 * Reimplemented from YApplication. 00150 **/ 00151 virtual void setConsoleFont( const std::string & console_magic, 00152 const std::string & font, 00153 const std::string & screen_map, 00154 const std::string & unicode_map, 00155 const std::string & language ); 00156 00157 /** 00158 * Run a shell command (typically an interactive program using NCurses) 00159 * in a terminal (window). 00160 * 00161 * Here in the NCurses UI, this shuts down the NCurses lib, runs the 00162 * command and then restores the status of the NCurses lib so that the next 00163 * instance of the NCurses lib from the started command doesn't interfere 00164 * with the NCurses UI's instance. 00165 * 00166 * Reimplemented from YApplication. 00167 **/ 00168 virtual int runInTerminal( const std::string & command ); 00169 00170 00171 // Display information and UI capabilities. 00172 // 00173 // All implemented from YApplication. 00174 00175 virtual int displayWidth(); 00176 virtual int displayHeight(); 00177 virtual int displayDepth(); 00178 virtual long displayColors(); 00179 00180 virtual int defaultWidth(); 00181 virtual int defaultHeight(); 00182 00183 virtual bool isTextMode() { return true; } 00184 00185 virtual bool hasImageSupport() { return false; } 00186 00187 virtual bool hasIconSupport() { return false; } 00188 00189 virtual bool hasAnimationSupport() { return false; } 00190 00191 virtual bool hasFullUtf8Support(); 00192 virtual bool richTextSupportsTable() { return false; } 00193 00194 virtual bool leftHandedMouse() { return false; } 00195 00196 /** 00197 * Set the application title 00198 * 00199 * Reimplemented from YApplication. 00200 **/ 00201 virtual void setApplicationTitle(const std::string& title); 00202 }; 00203 00204 00205 #endif // NCApplication_h