2 * \file GuiApplication.h
3 * This file is part of LyX, the document processor.
4 * Licence details can be found in the file COPYING.
8 * \author Abdelrazak Younes
10 * Full author contact details are available in file CREDITS.
13 #ifndef GUIAPPLICATION_H
14 #define GUIAPPLICATION_H
16 #include "ColorCache.h"
17 #include "GuiFontLoader.h"
18 #include "GuiClipboard.h"
19 #include "GuiImplementation.h"
20 #include "GuiSelection.h"
22 #include "frontends/Application.h"
24 #include <QApplication>
25 #include <QTranslator>
27 class QSessionManager;
39 /// The Qt main application class
41 There should be only one instance of this class. No Qt object
42 initialisation should be done before the instanciation of this class.
44 \todo The work areas handling could be moved to a base virtual class
45 comon to all frontends.
47 class GuiApplication : public QApplication, public Application
52 GuiApplication(int & argc, char ** argv);
54 virtual ~GuiApplication();
56 /// Method inherited from \c Application class
58 virtual Clipboard & clipboard();
59 virtual Selection & selection();
60 virtual FontLoader & fontLoader() { return font_loader_; }
62 virtual Gui & gui() { return gui_; }
63 virtual void exit(int status);
64 virtual bool event(QEvent * e);
66 virtual std::string const romanFontName();
67 virtual std::string const sansFontName();
68 virtual std::string const typewriterFontName();
69 virtual bool getRgbColor(Color_color col, RGBColor & rgbcol);
70 virtual std::string const hexName(Color_color col);
71 virtual void updateColor(Color_color col);
72 virtual void registerSocketCallback(
73 int fd, boost::function<void()> func);
74 void unregisterSocketCallback(int fd);
77 /// Methods inherited from \c QApplication class
79 bool notify(QObject * receiver, QEvent * event);
80 void commitData(QSessionManager & sm);
84 ColorCache & colorCache() { return color_cache_; }
87 GuiFontLoader & guiFontLoader() { return font_loader_; }
91 void execBatchCommands();
95 GuiImplementation gui_;
97 GuiClipboard clipboard_;
99 GuiSelection selection_;
101 GuiFontLoader font_loader_;
103 ColorCache color_cache_;
105 QTranslator qt_trans_;
107 std::map<int, SocketCallback *> socket_callbacks_;
111 bool x11EventFilter(XEvent * ev);
114 /// A translator suitable for the entries in the LyX menu.
115 /// Only needed with Qt/Mac.
116 void addMenuTranslator();
118 MenuTranslator * menu_trans_;
121 extern GuiApplication * guiApp;
123 } // namespace frontend
126 #endif // GUIAPPLICATION_H