libyui  3.0.10
 All Classes Functions Variables Enumerations Friends
YUILoader.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: YUILoader.h
20 
21  Author: Stefan Hundhammer <sh@suse.de>
22 
23 /-*/
24 
25 
26 #ifndef YUILoader_h
27 #define YUILoader_h
28 
29 
30 #include <string>
31 
32 #include "YUI.h"
33 
34 
35 
36 #define YUIPlugin_Qt "qt"
37 #define YUIPlugin_NCurses "ncurses"
38 #define YUIPlugin_Gtk "gtk"
39 
40 
41 /**
42  * Class to load one of the concrete UI plug-ins: Qt, NCurses, Gtk.
43  **/
44 class YUILoader
45 {
46 public:
47  /**
48  * Load any of the available UI plug-ins in this order:
49  * - Qt if $DISPLAY is set
50  * - NCurses if stdout is a tty
51  **/
52  static void loadUI( bool withThreads = false );
53 
54  /**
55  * Load a UI plug-in. 'name' is one of the YUIPlugin_ -defines above.
56  *
57  * This might throw exceptions.
58  **/
59  static void loadPlugin( const std::string & name, bool withThreads = false );
60 
61  static bool pluginExists( const std::string & pluginBaseName );
62 
63 private:
64  YUILoader() {}
65  ~YUILoader() {}
66 };
67 
68 
69 /**
70  * Every UI plug-in has to provide a function
71  *
72  * YUI * createUI( bool withThreads )
73  *
74  * that creates a UI of that specific type upon the first call and returns that
75  * singleton for all subsequent calls.
76  **/
77 typedef YUI * (*createUIFunction_t)( bool );
78 
79 
80 #endif // YUILoader_h