libyui-ncurses  2.44.1
 All Classes Functions Variables
NCApplication.h
1 /*
2  Copyright (C) 2000-2012 Novell, Inc
3  This library is free software; you can redistribute it and/or modify
4  it under the terms of the GNU Lesser General Public License as
5  published by the Free Software Foundation; either version 2.1 of the
6  License, or (at your option) version 3.0 of the License. This library
7  is distributed in the hope that it will be useful, but WITHOUT ANY
8  WARRANTY; without even the implied warranty of MERCHANTABILITY or
9  FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
10  License for more details. You should have received a copy of the GNU
11  Lesser General Public License along with this library; if not, write
12  to the Free Software Foundation, Inc., 51 Franklin Street, Fifth
13  Floor, Boston, MA 02110-1301 USA
14 */
15 
16 
17 /*-/
18 
19  File: NCApplication.h
20 
21  Author: Gabriele Mohr <gs@suse.de>
22 
23 /-*/
24 
25 #ifndef NCApplication_h
26 #define NCApplication_h
27 
28 #include <yui/YApplication.h>
29 
30 
31 class NCApplication: public YApplication
32 {
33 
34 protected:
35 
36  friend class YNCursesUI;
37 
38  /**
39  * Constructor.
40  *
41  * Use YUI::app() to get the singleton for this class.
42  **/
43  NCApplication();
44 
45  /**
46  * Destructor.
47  **/
48  virtual ~NCApplication();
49 
50 public:
51 
52  /**
53  * Set language and encoding for the locale environment ($LANG).
54  *
55  * 'language' is the ISO short code ("de_DE", "en_US", ...).
56  *
57  * 'encoding' an (optional) encoding ("utf8", ...) that will be appended if
58  * present.
59  *
60  * Reimplemented from YApplication.
61  **/
62  virtual void setLanguage( const std::string & language,
63  const std::string & encoding = std::string() );
64 
65  /**
66  * Open a directory selection box and prompt the user for an existing
67  * directory.
68  *
69  * 'startDir' is the initial directory that is displayed.
70  *
71  * 'headline' is an explanatory text for the directory selection box.
72  * Graphical UIs may omit that if no window manager is running.
73  *
74  * Returns the selected directory name
75  * or an empty std::string if the user canceled the operation.
76  *
77  * Implemented from YApplication.
78  **/
79  virtual std::string askForExistingDirectory( const std::string & startDir,
80  const std::string & headline );
81 
82  /**
83  * Open a file selection box and prompt the user for an existing file.
84  *
85  * 'startWith' is the initial directory or file.
86  *
87  * 'filter' is one or more blank-separated file patterns, e.g.
88  * "*.png *.jpg"
89  *
90  * 'headline' is an explanatory text for the file selection box.
91  * Graphical UIs may omit that if no window manager is running.
92  *
93  * Returns the selected file name
94  * or an empty std::string if the user canceled the operation.
95  *
96  * Implemented from YApplication.
97  **/
98  virtual std::string askForExistingFile( const std::string & startWith,
99  const std::string & filter,
100  const std::string & headline );
101 
102  /**
103  * Open a file selection box and prompt the user for a file to save data
104  * to. Automatically asks for confirmation if the user selects an existing
105  * file.
106  *
107  * 'startWith' is the initial directory or file.
108  *
109  * 'filter' is one or more blank-separated file patterns, e.g.
110  * "*.png *.jpg"
111  *
112  * 'headline' is an explanatory text for the file selection box.
113  * Graphical UIs may omit that if no window manager is running.
114  *
115  * Returns the selected file name
116  * or an empty std::string if the user canceled the operation.
117  *
118  * Implemented from YApplication.
119  **/
120  virtual std::string askForSaveFileName( const std::string & startWith,
121  const std::string & filter,
122  const std::string & headline );
123 
124  /**
125  * Beep.
126  *
127  * Reimplemented from YApplication.
128  **/
129  virtual void beep();
130 
131  /**
132  * Redraw the screen.
133  *
134  * Reimplemented from YApplication.
135  **/
136  virtual void redrawScreen();
137 
138  /**
139  * Initialize the (text) console keyboard.
140  *
141  * Reimplemented from YApplication.
142  **/
143  virtual void initConsoleKeyboard();
144 
145  /**
146  * Set the (text) console font according to the current encoding etc.
147  * See the setfont(8) command and the console HowTo for details.
148  *
149  * Reimplemented from YApplication.
150  **/
151  virtual void setConsoleFont( const std::string & console_magic,
152  const std::string & font,
153  const std::string & screen_map,
154  const std::string & unicode_map,
155  const std::string & language );
156 
157  /**
158  * Run a shell command (typically an interactive program using NCurses)
159  * in a terminal (window).
160  *
161  * Here in the NCurses UI, this shuts down the NCurses lib, runs the
162  * command and then restores the status of the NCurses lib so that the next
163  * instance of the NCurses lib from the started command doesn't interfere
164  * with the NCurses UI's instance.
165  *
166  * Reimplemented from YApplication.
167  **/
168  virtual int runInTerminal( const std::string & command );
169 
170 
171  // Display information and UI capabilities.
172  //
173  // All implemented from YApplication.
174 
175  virtual int displayWidth();
176  virtual int displayHeight();
177  virtual int displayDepth();
178  virtual long displayColors();
179 
180  virtual int defaultWidth();
181  virtual int defaultHeight();
182 
183  virtual bool isTextMode() { return true; }
184 
185  virtual bool hasImageSupport() { return false; }
186 
187  virtual bool hasIconSupport() { return false; }
188 
189  virtual bool hasAnimationSupport() { return false; }
190 
191  virtual bool hasFullUtf8Support();
192  virtual bool richTextSupportsTable() { return false; }
193 
194  virtual bool leftHandedMouse() { return false; }
195 
196  /**
197  * Set the application title
198  *
199  * Reimplemented from YApplication.
200  **/
201  virtual void setApplicationTitle(const std::string& title);
202 };
203 
204 
205 #endif // NCApplication_h
virtual std::string askForSaveFileName(const std::string &startWith, const std::string &filter, const std::string &headline)
virtual void setApplicationTitle(const std::string &title)
virtual void redrawScreen()
virtual ~NCApplication()
virtual int runInTerminal(const std::string &command)
virtual void initConsoleKeyboard()
virtual void setLanguage(const std::string &language, const std::string &encoding=std::string())
virtual void beep()
virtual std::string askForExistingDirectory(const std::string &startDir, const std::string &headline)
virtual std::string askForExistingFile(const std::string &startWith, const std::string &filter, const std::string &headline)
virtual void setConsoleFont(const std::string &console_magic, const std::string &font, const std::string &screen_map, const std::string &unicode_map, const std::string &language)