2 * \file qt4/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 QT4_APPLICATION_H
14 #define QT4_APPLICATION_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>
26 ///////////////////////////////////////////////////////////////
30 #include <Carbon/Carbon.h>
32 ///////////////////////////////////////////////////////////////
37 class socket_callback;
43 /// The Qt main application class
45 There should be only one instance of this class. No Qt object
46 initialisation should be done before the instanciation of this class.
48 \todo The work areas handling could be moved to a base virtual class
49 comon to all frontends.
51 class GuiApplication : public QApplication, public Application
56 GuiApplication(int & argc, char ** argv);
58 virtual ~GuiApplication();
60 /// Method inherited from \c Application class
62 virtual Clipboard& clipboard();
63 virtual Selection& selection();
64 virtual FontLoader & fontLoader() { return font_loader_; }
65 virtual int const exec();
66 virtual Gui & gui() { return gui_; }
67 virtual void exit(int status);
69 virtual std::string const romanFontName();
70 virtual std::string const sansFontName();
71 virtual std::string const typewriterFontName();
72 virtual bool getRgbColor(LColor_color col, lyx::RGBColor & rgbcol);
73 virtual std::string const hexName(LColor_color col);
74 virtual void updateColor(LColor_color col);
75 virtual void registerSocketCallback(
76 int fd, boost::function<void()> func);
77 virtual void unregisterSocketCallback(int fd);
81 ColorCache & colorCache() { return color_cache_; }
84 GuiFontLoader & guiFontLoader() { return font_loader_; }
88 void execBatchCommands();
92 GuiImplementation gui_;
94 GuiClipboard clipboard_;
96 GuiSelection selection_;
98 GuiFontLoader font_loader_;
100 ColorCache color_cache_;
102 std::map<int, boost::shared_ptr<socket_callback> > socket_callbacks_;
106 bool x11EventFilter (XEvent * ev);
111 bool macEventFilter(EventRef event);
113 // static OSStatus handleOpenDocuments(
114 static pascal OSErr handleOpenDocuments(
115 const AppleEvent* inEvent, AppleEvent*, long);
119 extern GuiApplication * guiApp;
121 } // namespace frontend
126 #endif // QT4_APPLICATION_H