]> git.lyx.org Git - lyx.git/blob - src/frontends/Application.h
This commit introduces the FontLoader interface class. In the future, I intend to...
[lyx.git] / src / frontends / Application.h
1 /**
2  * \file frontend/Application.h
3  * This file is part of LyX, the document processor.
4  * Licence details can be found in the file COPYING.
5  *
6  * \author Abdelrazak Younes
7  *
8  * Full author contact details are available in file CREDITS.
9  */
10
11 #ifndef LYX_APPLICATION_H
12 #define LYX_APPLICATION_H
13
14 #include <boost/scoped_ptr.hpp>
15
16 #include <string>
17
18 class BufferList;
19 class BufferView;
20 class LyXFunc;
21 class LyXServer;
22 class LyXServerSocket;
23 class LyXView;
24         
25 namespace lyx {
26 namespace frontend {
27
28 struct Application_pimpl;
29 class Clipboard;
30 class FontLoader;
31 class Gui;
32 class Selection;
33
34 /// The main application class
35 /**
36 There should be only one instance of this class. No Qt object
37 initialisation should be done before the instanciation of this class.
38
39 \todo The work areas handling could be moved to a base virtual class
40 comon to all frontends.
41 */
42 class Application
43 {
44 public:
45         ///
46         Application(int & argc, char ** argv);
47         ///
48         virtual ~Application() {}
49
50         /// Start the main event loop, after executing the given batch
51         /// commands.
52         int start(std::string const & batch);
53         ///
54         virtual Gui & gui() = 0;
55         ///
56         virtual int const exec() = 0;
57
58         /// Quit running LyX.
59         /**
60         * This may either quit directly or record the exit status
61         * and only stop the event loop.
62         */
63         virtual void exit(int status) = 0;
64
65         ///
66         virtual Clipboard & clipboard() = 0;
67         ///
68         virtual Selection & selection() = 0;
69         ///
70         virtual FontLoader & fontLoader() = 0;
71
72         /// return a suitable serif font name.
73         virtual std::string const romanFontName() = 0;
74
75         /// return a suitable sans serif font name.
76         virtual std::string const sansFontName() = 0;
77
78         /// return a suitable monospaced font name.
79         virtual std::string const typewriterFontName() = 0;
80
81         ///
82         LyXFunc & lyxFunc();
83         LyXFunc const & lyxFunc() const;
84         ///
85         LyXServer & server();
86         LyXServer const & server() const;
87         ///
88         LyXServerSocket & socket();
89         LyXServerSocket const & socket() const;
90         ///
91         BufferList & bufferList();
92         BufferList const & bufferList() const;
93
94         /// Create the main window with given geometry settings.
95         LyXView & createView(unsigned int width, unsigned int height,
96                 int posx, int posy, bool maximize);
97         
98         ///
99         void setBufferView(BufferView * buffer_view);
100
101 protected:
102         /// This BufferView is the one receiving Clipboard and Selection
103         /// Events
104         /// FIXME: \todo use Gui::currentView() in the future
105         BufferView * buffer_view_;
106
107 private:
108         /// Application private implementation.
109         Application_pimpl * pimpl_;
110
111 }; // Application
112
113 } // namespace frontend
114 } // namespace lyx
115
116 extern lyx::frontend::Application * theApp;
117
118
119 #endif // LYX_APPLICATION_H