libyui-ncurses  2.44.1
/usr/src/RPM/BUILD/libyui-ncurses-2.44.1/src/YNCursesUI.h
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:       YNCursesUI.h
00020 
00021    Authors:    Michael Andres <ma@suse.de>
00022                Stefan Hundhammer <sh@suse.de>
00023 
00024 /-*/
00025 
00026 #ifndef YNCursesUI_h
00027 #define YNCursesUI_h
00028 
00029 #include <iosfwd>
00030 
00031 #include <yui/YUI.h>
00032 #include "NCApplication.h"
00033 #include "NCurses.h"
00034 
00035 class NCPackageSelectorPluginStub;
00036 
00037 
00038 class YNCursesUI : public NCurses, public YUI
00039 {
00040 public:
00041     /**
00042      * Constructor
00043      **/
00044     YNCursesUI( bool withThreads );
00045 
00046     /**
00047      * Destructor
00048      **/
00049     ~YNCursesUI();
00050 
00051 
00052 protected:
00053     /**
00054      * Create the widget factory that provides all the createXY() methods for
00055      * standard (mandatory, i.e. non-optional) widgets.
00056      *
00057      * Reimplemented from YUI.
00058      **/
00059     virtual YWidgetFactory * createWidgetFactory();
00060 
00061     /**
00062      * Create the widget factory that provides all the createXY() methods for
00063      * optional ("special") widgets and the corresponding hasXYWidget()
00064      * methods.
00065      *
00066      * Reimplemented from YUI.
00067      **/
00068     virtual YOptionalWidgetFactory * createOptionalWidgetFactory();
00069 
00070     /*
00071      * Create the YApplication object that provides global methods.
00072      *
00073      * Reimplemented from YUI.
00074      **/
00075     virtual YApplication * createApplication();
00076 
00077 
00078     virtual bool want_colors();
00079     virtual void init_title();
00080 
00081     /**
00082      * Global reference to the UI
00083      **/
00084     static YNCursesUI * _ui;
00085 
00086 public:
00087 
00088     /**
00089      * Access the global Y2NCursesUI.
00090      */
00091     static YNCursesUI * ui() { return _ui; }
00092 
00093     /**
00094      * Idle around until fd_ycp is readable
00095      */
00096     virtual void idleLoop( int fd_ycp );
00097 
00098     /**
00099      * Set the (text) console font according to the current encoding etc.
00100      * See the setfont(8) command and the console HowTo for details.
00101      *
00102      * This should really be in NCApplication, but it uses so many non-exported
00103      * member variables that it's not easy to move it there.
00104      **/
00105     virtual void setConsoleFont( const std::string & console_magic,
00106                                  const std::string & font,
00107                                  const std::string & screen_map,
00108                                  const std::string & unicode_map,
00109                                  const std::string & lang );
00110 
00111     /**
00112      * Fills the PackageSelector widget and runs package selection.
00113      */
00114     virtual YEvent * runPkgSelection( YWidget * packageSelector );
00115 
00116     /**
00117      * Returns the package selector plugin singleton of this UI or creates it
00118      * (including loading the plugin lib) if it does not exist yet.
00119      **/
00120     NCPackageSelectorPluginStub * packageSelectorPlugin();
00121 };
00122 
00123 
00124 /**
00125  * Create a new UI if there is none yet or return the existing one if there is.
00126  *
00127  * This is the UI plugin's interface to the outside world, so don't change the
00128  * name or signature!
00129  **/
00130 YUI * createUI( bool withThreads );
00131 
00132 
00133 #endif // YNCursesUI_h
00134 
 All Classes Functions Variables