]> git.lyx.org Git - lyx.git/blob - src/frontends/LyXView.h
More work towards type safety regarding TextClass's. A couple bugs have been fixed...
[lyx.git] / src / frontends / LyXView.h
1 // -*- C++ -*-
2 /**
3  * \file LyXView.h
4  * This file is part of LyX, the document processor.
5  * Licence details can be found in the file COPYING.
6  *
7  * \author Lars Gullik Bjønnes
8  * \author John Levon
9  *
10  * Full author contact details are available in file CREDITS.
11  */
12
13 #ifndef LYXVIEW_H
14 #define LYXVIEW_H
15
16 #include "support/strfwd.h"
17
18 namespace lyx {
19
20 namespace support { class FileName; }
21
22 class Buffer;
23 class BufferView;
24 class FuncStatus;
25 class FuncRequest;
26 class Inset;
27
28 namespace frontend {
29
30 /**
31  * LyXView - main LyX window
32  *
33  * This class represents the main LyX window and provides
34  * accessor functions to its content.
35  *
36  * The eventual intention is that LyX will support a number
37  * of containing LyXViews. Currently a lot of code still
38  * relies on there being a single top-level view.
39  *
40  * Additionally we would like to support multiple views
41  * in a single LyXView.
42  */
43 class LyXView
44 {
45 public:
46         ///
47         LyXView() {}
48         ///
49         virtual ~LyXView() {}
50         ///
51         virtual int id() const = 0;
52
53         /// show busy cursor
54         virtual void setBusy(bool) = 0;
55
56         //@{ generic accessor functions
57
58         /// \return the current buffer view.
59         virtual BufferView * view() = 0;
60
61         /// \return the buffer currently shown in this window
62         virtual Buffer * buffer() = 0;
63         virtual Buffer const * buffer() const = 0;
64         /// set a buffer to the current workarea.
65         virtual void setBuffer(Buffer * b) = 0; ///< \c Buffer to set.
66         ///
67         virtual bool closeBuffer() = 0;
68
69         /// load a document into the current workarea.
70         virtual Buffer * loadDocument(
71                 support::FileName const &  name, ///< File to load.
72                 bool tolastfiles = true  ///< append to the "Open recent" menu?
73                 ) = 0;
74         ///
75         virtual void newDocument(std::string const & filename,
76                 bool fromTemplate) = 0;
77
78         //@}
79
80         /// display a message in the view
81         virtual void message(docstring const &) = 0;
82
83         ///
84         virtual FuncStatus getStatus(FuncRequest const & cmd) = 0;
85         /// dispatch command.
86         /// \return true if the \c FuncRequest has been dispatched.
87         virtual bool dispatch(FuncRequest const & cmd) = 0;
88
89         ///
90         virtual void restartCursor() = 0;
91
92         /// Update the completion popup and the inline completion state.
93         /// If \c start is true, then a new completion might be started.
94         /// If \c keep is true, an active completion will be kept active
95         /// even though the cursor moved.
96         virtual void updateCompletion(bool start, bool keep) = 0;
97
98 private:
99         /// noncopyable
100         LyXView(LyXView const &);
101         void operator=(LyXView const &);
102 };
103
104 } // namespace frontend
105 } // namespace lyx
106
107 #endif // LYXVIEW_H