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(int fd, SocketCallback func);
73 void unregisterSocketCallback(int fd);
76 /// Methods inherited from \c QApplication class
78 bool notify(QObject * receiver, QEvent * event);
79 void commitData(QSessionManager & sm);
83 ColorCache & colorCache() { return color_cache_; }
86 GuiFontLoader & guiFontLoader() { return font_loader_; }
90 void execBatchCommands();
92 void socketDataReceived(int fd);
96 GuiImplementation gui_;
98 GuiClipboard clipboard_;
100 GuiSelection selection_;
102 GuiFontLoader font_loader_;
104 ColorCache color_cache_;
106 QTranslator qt_trans_;
108 std::map<int, SocketNotifier *> socket_notifiers_;
112 bool x11EventFilter(XEvent * ev);
115 /// A translator suitable for the entries in the LyX menu.
116 /// Only needed with Qt/Mac.
117 void addMenuTranslator();
119 MenuTranslator * menu_trans_;
122 extern GuiApplication * guiApp;
124 } // namespace frontend
127 #endif // GUIAPPLICATION_H