]> git.lyx.org Git - lyx.git/blob - src/frontends/qt4/GuiApplication.h
This commit introduces frontends/Application.[Ch] and makes qt4/GuiApplication (renam...
[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 "GuiImplementation.h"
17 #include "FontLoader.h"
18
19 #include "frontends/Application.h"
20
21 #include <QApplication>
22
23 ///////////////////////////////////////////////////////////////
24 // Specific stuff
25
26 #ifdef Q_WS_MACX
27 #include <Carbon/Carbon.h>
28 #endif
29 ///////////////////////////////////////////////////////////////
30
31 class BufferView;
32
33 namespace lyx {
34 namespace frontend {
35
36 class GuiWorkArea;
37
38 /// The Qt main application class
39 /**
40 There should be only one instance of this class. No Qt object
41 initialisation should be done before the instanciation of this class.
42
43 \todo The work areas handling could be moved to a base virtual class
44 comon to all frontends.
45 */
46 class GuiApplication : public QApplication, public Application
47 {
48 public:
49         GuiApplication(int & argc, char ** argv);
50
51         /// Method inherited from \c Application class
52         //@{
53         virtual int const exec();
54         virtual Gui & gui() { return gui_; }
55         virtual void exit(int status);
56         //@}
57
58         ///
59         FontLoader & fontLoader() { return font_loader_; }
60
61         ///
62         LyXView & createView(unsigned int width, unsigned int height,
63                 int posx, int posy, bool maximize);
64
65 private:
66         ///
67         GuiImplementation gui_;
68
69         ///
70         FontLoader font_loader_;
71
72 #ifdef Q_WS_X11
73 public:
74         bool x11EventFilter (XEvent * ev);
75 #endif
76
77 #ifdef Q_WS_MACX
78 public:
79         bool macEventFilter(EventRef event);
80 private:
81 //      static OSStatus handleOpenDocuments(
82         static pascal OSErr     handleOpenDocuments(
83                 const AppleEvent* inEvent, AppleEvent*, long);
84 #endif
85 }; // GuiApplication
86
87 } // namespace frontend
88 } // namespace lyx
89
90 extern lyx::frontend::GuiApplication * guiApp;
91
92
93 #endif // QT4_APPLICATION_H