]> git.lyx.org Git - lyx.git/blob - src/frontends/qt4/GuiApplication.h
remove some old cruft (unused OS X specific code)
[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 "GuiFontLoader.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 namespace lyx {
27
28 class BufferView;
29 class socket_callback;
30
31 namespace frontend {
32
33 class GuiWorkArea;
34
35 /// The Qt main application class
36 /**
37 There should be only one instance of this class. No Qt object
38 initialisation should be done before the instanciation of this class.
39
40 \todo The work areas handling could be moved to a base virtual class
41 comon to all frontends.
42 */
43 class GuiApplication : public QApplication, public Application
44 {
45         Q_OBJECT
46
47 public:
48         GuiApplication(int & argc, char ** argv);
49         ///
50         virtual ~GuiApplication();
51
52         /// Method inherited from \c Application class
53         //@{
54         virtual Clipboard& clipboard();
55         virtual Selection& selection();
56         virtual FontLoader & fontLoader() { return font_loader_; }
57         virtual int const exec();
58         virtual Gui & gui() { return gui_; }
59         virtual void exit(int status);
60         virtual bool event(QEvent * e);
61         void syncEvents();
62         virtual std::string const romanFontName();
63         virtual std::string const sansFontName();
64         virtual std::string const typewriterFontName();
65         virtual bool getRgbColor(LColor_color col, lyx::RGBColor & rgbcol);
66         virtual std::string const hexName(LColor_color col);
67         virtual void updateColor(LColor_color col);
68         virtual void registerSocketCallback(
69                 int fd, boost::function<void()> func);
70         void unregisterSocketCallback(int fd);
71         //@}
72
73         ///
74         ColorCache & colorCache() { return color_cache_; }
75         ///
76         ///
77         GuiFontLoader & guiFontLoader() { return font_loader_; }
78
79 private Q_SLOTS:
80         ///
81         void execBatchCommands();
82
83 private:
84         ///
85         GuiImplementation gui_;
86         ///
87         GuiClipboard clipboard_;
88         ///
89         GuiSelection selection_;
90         ///
91         GuiFontLoader font_loader_;
92         ///
93         ColorCache color_cache_;
94         ///
95         std::map<int, boost::shared_ptr<socket_callback> > socket_callbacks_;
96
97 #ifdef Q_WS_X11
98 public:
99         bool x11EventFilter (XEvent * ev);
100 #endif
101
102 }; // GuiApplication
103
104 extern GuiApplication * guiApp;
105
106 } // namespace frontend
107
108 } // namespace lyx
109
110
111 #endif // QT4_APPLICATION_H