]> git.lyx.org Git - lyx.git/blob - src/frontends/Application.h
0959020230e5611236345ef550f9a8ce8b62238c
[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 Gui;
31 class Selection;
32
33 /// The main application class
34 /**
35 There should be only one instance of this class. No Qt object
36 initialisation should be done before the instanciation of this class.
37
38 \todo The work areas handling could be moved to a base virtual class
39 comon to all frontends.
40 */
41 class Application
42 {
43 public:
44         ///
45         Application(int & argc, char ** argv);
46         ///
47         virtual ~Application() {}
48
49         /// Start the main event loop, after executing the given batch
50         /// commands.
51         int start(std::string const & batch);
52         ///
53         virtual Gui & gui() = 0;
54         ///
55         virtual int const exec() = 0;
56
57         /// Quit running LyX.
58         /**
59         * This may either quit directly or record the exit status
60         * and only stop the event loop.
61         */
62         virtual void exit(int status) = 0;
63
64         ///
65         virtual Clipboard & clipboard() = 0;
66         ///
67         virtual Selection & selection() = 0;
68
69         /// return a suitable serif font name.
70         virtual std::string const romanFontName() = 0;
71
72         /// return a suitable sans serif font name.
73         virtual std::string const sansFontName() = 0;
74
75         /// return a suitable monospaced font name.
76         virtual std::string const typewriterFontName() = 0;
77
78         ///
79         LyXFunc & lyxFunc();
80         LyXFunc const & lyxFunc() const;
81         ///
82         LyXServer & server();
83         LyXServer const & server() const;
84         ///
85         LyXServerSocket & socket();
86         LyXServerSocket const & socket() const;
87         ///
88         BufferList & bufferList();
89         BufferList const & bufferList() const;
90
91         /// Create the main window with given geometry settings.
92         LyXView & createView(unsigned int width, unsigned int height,
93                 int posx, int posy, bool maximize);
94         
95         ///
96         void setBufferView(BufferView * buffer_view);
97
98 protected:
99         /// This BufferView is the one receiving Clipboard and Selection
100         /// Events
101         /// FIXME: \todo use Gui::currentView() in the future
102         BufferView * buffer_view_;
103
104 private:
105         /// Application private implementation.
106         Application_pimpl * pimpl_;
107
108 }; // Application
109
110 } // namespace frontend
111 } // namespace lyx
112
113 extern lyx::frontend::Application * theApp;
114
115
116 #endif // LYX_APPLICATION_H