]> git.lyx.org Git - lyx.git/blob - src/frontends/qt4/GuiApplication.h
replace colorcache global variable with GuiApplication::colorCache().
[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 "FontLoader.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         /// Method inherited from \c Application class
55         //@{
56         virtual Clipboard& clipboard();
57         virtual Selection& selection();
58         virtual int const exec();
59         virtual Gui & gui() { return gui_; }
60         virtual void exit(int status);
61         //@}
62
63         ///
64         ColorCache & colorCache() { return color_cache_; }
65         ///
66         FontLoader & fontLoader() { return font_loader_; }
67
68         ///
69         LyXView & createView(unsigned int width, unsigned int height,
70                 int posx, int posy, bool maximize);
71
72 private:
73         ///
74         GuiImplementation gui_;
75         ///
76         GuiClipboard clipboard_;
77         ///
78         GuiSelection selection_;
79         ///
80         FontLoader font_loader_;
81         ///
82         ColorCache color_cache_;
83
84 #ifdef Q_WS_X11
85 public:
86         bool x11EventFilter (XEvent * ev);
87 #endif
88
89 #ifdef Q_WS_MACX
90 public:
91         bool macEventFilter(EventRef event);
92 private:
93 //      static OSStatus handleOpenDocuments(
94         static pascal OSErr     handleOpenDocuments(
95                 const AppleEvent* inEvent, AppleEvent*, long);
96 #endif
97 }; // GuiApplication
98
99 } // namespace frontend
100 } // namespace lyx
101
102 extern lyx::frontend::GuiApplication * guiApp;
103
104
105 #endif // QT4_APPLICATION_H