]> git.lyx.org Git - lyx.git/blob - src/frontends/qt4/GuiApplication.h
This commit introduces the FontLoader interface class. In the future, I intend to...
[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
36 namespace lyx {
37 namespace frontend {
38
39 class GuiWorkArea;
40
41 /// The Qt main application class
42 /**
43 There should be only one instance of this class. No Qt object
44 initialisation should be done before the instanciation of this class.
45
46 \todo The work areas handling could be moved to a base virtual class
47 comon to all frontends.
48 */
49 class GuiApplication : public QApplication, public Application
50 {
51 public:
52         GuiApplication(int & argc, char ** argv);
53         ///
54         virtual ~GuiApplication() {}
55
56         /// Method inherited from \c Application class
57         //@{
58         virtual Clipboard& clipboard();
59         virtual Selection& selection();
60         virtual FontLoader & fontLoader() { return font_loader_; }
61         virtual int const exec();
62         virtual Gui & gui() { return gui_; }
63         virtual void exit(int status);
64         virtual std::string const romanFontName();
65         virtual std::string const sansFontName();
66         virtual std::string const typewriterFontName();
67         //@}
68
69         ///
70         ColorCache & colorCache() { return color_cache_; }
71         ///
72         ///
73         GuiFontLoader & guiFontLoader() { return font_loader_; }
74
75 private:
76         ///
77         GuiImplementation gui_;
78         ///
79         GuiClipboard clipboard_;
80         ///
81         GuiSelection selection_;
82         ///
83         GuiFontLoader font_loader_;
84         ///
85         ColorCache color_cache_;
86
87 #ifdef Q_WS_X11
88 public:
89         bool x11EventFilter (XEvent * ev);
90 #endif
91
92 #ifdef Q_WS_MACX
93 public:
94         bool macEventFilter(EventRef event);
95 private:
96 //      static OSStatus handleOpenDocuments(
97         static pascal OSErr     handleOpenDocuments(
98                 const AppleEvent* inEvent, AppleEvent*, long);
99 #endif
100 }; // GuiApplication
101
102 } // namespace frontend
103 } // namespace lyx
104
105 extern lyx::frontend::GuiApplication * guiApp;
106
107
108 #endif // QT4_APPLICATION_H