]> git.lyx.org Git - lyx.git/blob - src/frontends/LyXView.h
File->Close All now really closes all buffers. That is, all visible buffers in all...
[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 Cursor;
25 class FuncStatus;
26 class FuncRequest;
27 class Inset;
28
29 namespace frontend {
30
31 /**
32  * LyXView - main LyX window
33  *
34  * This class represents the main LyX window and provides
35  * accessor functions to its content.
36  *
37  * The eventual intention is that LyX will support a number
38  * of containing LyXViews. Currently a lot of code still
39  * relies on there being a single top-level view.
40  *
41  * Additionally we would like to support multiple views
42  * in a single LyXView.
43  */
44 class LyXView
45 {
46 public:
47         ///
48         LyXView() {}
49         ///
50         virtual ~LyXView() {}
51         ///
52         virtual int id() const = 0;
53
54         /// show busy cursor
55         virtual void setBusy(bool) = 0;
56
57         //@{ generic accessor functions
58
59         /// \return the current buffer view.
60         virtual BufferView * view() = 0;
61
62         /// \return the buffer currently shown in this window
63         virtual Buffer * buffer() = 0;
64         virtual Buffer const * buffer() const = 0;
65         /// set a buffer to the current workarea.
66         virtual void setBuffer(Buffer * b) = 0; ///< \c Buffer to set.
67         ///
68         virtual bool closeBuffer() = 0;
69         ///
70         virtual bool closeBufferAll() = 0;
71         ///
72         virtual bool hasFocus() const = 0;
73
74         /// load a document into the current workarea.
75         virtual Buffer * loadDocument(
76                 support::FileName const &  name, ///< File to load.
77                 bool tolastfiles = true  ///< append to the "Open recent" menu?
78                 ) = 0;
79         ///
80         virtual void newDocument(std::string const & filename,
81                 bool fromTemplate) = 0;
82
83         //@}
84
85         /// display a message in the view
86         virtual void message(docstring const &) = 0;
87
88         ///
89         virtual bool getStatus(FuncRequest const & cmd, FuncStatus & flag) = 0;
90         /// dispatch command.
91         /// \return true if the \c FuncRequest has been dispatched.
92         virtual bool dispatch(FuncRequest const & cmd) = 0;
93
94         ///
95         virtual void restartCursor() = 0;
96
97         /// Update the completion popup and the inline completion state.
98         /// If \c start is true, then a new completion might be started.
99         /// If \c keep is true, an active completion will be kept active
100         /// even though the cursor moved. The update flags of \c cur might
101         /// be changed.
102         virtual void updateCompletion(Cursor & cur, bool start, bool keep) = 0;
103
104 private:
105         /// noncopyable
106         LyXView(LyXView const &);
107         void operator=(LyXView const &);
108 };
109
110 } // namespace frontend
111 } // namespace lyx
112
113 #endif // LYXVIEW_H