]> git.lyx.org Git - lyx.git/blob - src/frontends/qt4/GuiApplication.h
This commit is purely mechanical and get rid of lyx_gui.[Ch].
[lyx.git] / src / frontends / qt4 / GuiApplication.h
1 /**
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.
5  *
6  * \author unknown
7  * \author John Levon
8  * \author Abdelrazak Younes
9  *
10  * Full author contact details are available in file CREDITS.
11  */
12
13 #ifndef QT4_APPLICATION_H
14 #define QT4_APPLICATION_H
15
16 #include "ColorCache.h"
17 #include "GuiFontLoader.h"
18 #include "GuiClipboard.h"
19 #include "GuiImplementation.h"
20 #include "GuiSelection.h"
21
22 #include "frontends/Application.h"
23
24 #include <QApplication>
25
26 ///////////////////////////////////////////////////////////////
27 // Specific stuff
28
29 #ifdef Q_WS_MACX
30 #include <Carbon/Carbon.h>
31 #endif
32 ///////////////////////////////////////////////////////////////
33
34 class BufferView;
35 class socket_callback;
36
37 namespace lyx {
38 namespace frontend {
39
40 class GuiWorkArea;
41
42 /// The Qt main application class
43 /**
44 There should be only one instance of this class. No Qt object
45 initialisation should be done before the instanciation of this class.
46
47 \todo The work areas handling could be moved to a base virtual class
48 comon to all frontends.
49 */
50 class GuiApplication : public QApplication, public Application
51 {
52 public:
53         GuiApplication(int & argc, char ** argv);
54         ///
55         virtual ~GuiApplication() {}
56
57         /// Method inherited from \c Application class
58         //@{
59         virtual Clipboard& clipboard();
60         virtual Selection& selection();
61         virtual FontLoader & fontLoader() { return font_loader_; }
62         virtual int const exec();
63         virtual Gui & gui() { return gui_; }
64         virtual void exit(int status);
65         void syncEvents();
66         virtual std::string const romanFontName();
67         virtual std::string const sansFontName();
68         virtual std::string const typewriterFontName();
69         virtual bool getRgbColor(LColor_color col, lyx::RGBColor & rgbcol);
70         virtual std::string const hexName(LColor_color col);
71         virtual void updateColor(LColor_color col);
72         virtual void registerSocketCallback(
73                 int fd, boost::function<void()> func);
74         virtual void unregisterSocketCallback(int fd);
75         //@}
76
77         ///
78         ColorCache & colorCache() { return color_cache_; }
79         ///
80         ///
81         GuiFontLoader & guiFontLoader() { return font_loader_; }
82
83 private:
84         ///
85         GuiImplementation gui_;
86         ///
87         GuiClipboard clipboard_;
88         ///
89         GuiSelection selection_;
90         ///
91         GuiFontLoader font_loader_;
92         ///
93         ColorCache color_cache_;
94         ///
95         std::map<int, boost::shared_ptr<socket_callback> > socket_callbacks_;
96
97 #ifdef Q_WS_X11
98 public:
99         bool x11EventFilter (XEvent * ev);
100 #endif
101
102 #ifdef Q_WS_MACX
103 public:
104         bool macEventFilter(EventRef event);
105 private:
106 //      static OSStatus handleOpenDocuments(
107         static pascal OSErr     handleOpenDocuments(
108                 const AppleEvent* inEvent, AppleEvent*, long);
109 #endif
110 }; // GuiApplication
111
112 } // namespace frontend
113 } // namespace lyx
114
115 extern lyx::frontend::GuiApplication * guiApp;
116
117
118 #endif // QT4_APPLICATION_H