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