]> git.lyx.org Git - lyx.git/blob - src/frontends/qt3/GuiApplication.h
9684b958532f6c7623afa767ba9d57996a414d9e
[lyx.git] / src / frontends / qt3 / GuiApplication.h
1 /**
2  * \file qt3/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 QT3_APPLICATION_H
14 #define QT3_APPLICATION_H
15
16 #include "frontends/Application.h"
17
18 #include "qfont_loader.h"
19 #include "GuiClipboard.h"
20 #include "GuiImplementation.h"
21 #include "GuiSelection.h"
22
23 #include <qapplication.h>
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         virtual ~GuiApplication() {}
54
55         /// Method inherited from \c Application class
56         //@{
57         virtual Clipboard& clipboard();
58         virtual Selection& selection();
59         virtual FontLoader & fontLoader() { return font_loader_; }
60         virtual int const exec();
61         virtual Gui & gui() { return gui_; }
62         virtual void exit(int status);
63         virtual std::string const romanFontName();
64         virtual std::string const sansFontName();
65         virtual std::string const typewriterFontName();
66         virtual bool getRgbColor(LColor_color col, lyx::RGBColor & rgbcol);
67         virtual std::string const hexName(LColor_color col);
68         virtual void updateColor(LColor_color col);
69         virtual void registerSocketCallback(
70                 int fd, boost::function<void()> func);
71         virtual void unregisterSocketCallback(int fd);
72         //@}
73
74         ///
75 private:
76         ///
77         GuiImplementation gui_;
78         ///
79         GuiClipboard clipboard_;
80         ///
81         GuiSelection selection_;
82         ///
83         GuiFontLoader font_loader_;
84
85 #ifdef Q_WS_X11
86 public:
87         bool x11EventFilter (XEvent * ev);
88 #endif
89
90 #ifdef Q_WS_MACX
91 public:
92         bool macEventFilter(EventRef event);
93 private:
94 //      static OSStatus handleOpenDocuments(
95         static pascal OSErr     handleOpenDocuments(
96                 const AppleEvent* inEvent, AppleEvent*, long);
97 #endif
98 }; // GuiApplication
99
100 } // namespace frontend
101 } // namespace lyx
102
103 extern lyx::frontend::GuiApplication * guiApp;
104
105
106 #endif // QT3_APPLICATION_H