]> git.lyx.org Git - lyx.git/blob - src/frontends/qt4/GuiApplication.h
* Application: new createView() method
[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 private:
69         ///
70         GuiImplementation gui_;
71         ///
72         GuiClipboard clipboard_;
73         ///
74         GuiSelection selection_;
75         ///
76         FontLoader font_loader_;
77         ///
78         ColorCache color_cache_;
79
80 #ifdef Q_WS_X11
81 public:
82         bool x11EventFilter (XEvent * ev);
83 #endif
84
85 #ifdef Q_WS_MACX
86 public:
87         bool macEventFilter(EventRef event);
88 private:
89 //      static OSStatus handleOpenDocuments(
90         static pascal OSErr     handleOpenDocuments(
91                 const AppleEvent* inEvent, AppleEvent*, long);
92 #endif
93 }; // GuiApplication
94
95 } // namespace frontend
96 } // namespace lyx
97
98 extern lyx::frontend::GuiApplication * guiApp;
99
100
101 #endif // QT4_APPLICATION_H