]> git.lyx.org Git - lyx.git/blob - src/frontends/LyXView.h
Transfer createView() from Application to GuiApplication and get rid of LyXView:...
[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 "frontends/Delegates.h"
17 #include "support/strfwd.h"
18
19 namespace lyx {
20
21 namespace support { class FileName; }
22
23 class Buffer;
24 class BufferView;
25 class FuncRequest;
26 class Inset;
27
28 namespace frontend {
29
30 class Dialogs;
31
32 /**
33  * LyXView - main LyX window
34  *
35  * This class represents the main LyX window and provides
36  * accessor functions to its content.
37  *
38  * The eventual intention is that LyX will support a number
39  * of containing LyXViews. Currently a lot of code still
40  * relies on there being a single top-level view.
41  *
42  * Additionally we would like to support multiple views
43  * in a single LyXView.
44  */
45 class LyXView
46         : public GuiBufferViewDelegate, public GuiBufferDelegate
47 {
48 public:
49         ///
50         LyXView(int id) : id_(id) {}
51         ///
52         virtual ~LyXView() {}
53         ///
54         int id() const { return id_; }
55         ///
56         virtual void close() = 0;
57         ///
58         virtual void setFocus() = 0;
59
60         /**
61          * This is called after the concrete view has been created.
62          * We have to have the toolbar and the other stuff created
63          * before we can populate it with this call.
64          */
65         virtual void init() = 0;
66
67         /// show busy cursor
68         virtual void setBusy(bool) = 0;
69
70         //@{ generic accessor functions
71
72         /// \return the current buffer view.
73         virtual BufferView * view() = 0;
74
75         /// \return the buffer currently shown in this window
76         virtual Buffer * buffer() = 0;
77         virtual Buffer const * buffer() const = 0;
78         /// set a buffer to the current workarea.
79         virtual void setBuffer(Buffer * b) = 0; ///< \c Buffer to set.
80
81         ///
82         virtual bool isToolbarVisible(std::string const & id) = 0;
83
84         /// get access to the dialogs
85         virtual Dialogs & getDialogs() = 0;
86         ///
87         virtual Dialogs const & getDialogs() const = 0;
88
89         //@}
90
91         /// load a buffer into the current workarea.
92         virtual Buffer * loadLyXFile(support::FileName const &  name, ///< File to load.
93                 bool tolastfiles = true) = 0;  ///< append to the "Open recent" menu?
94
95         /// updates the possible layouts selectable
96         virtual void updateLayoutChoice(bool force) = 0;
97         /// update the toolbar
98         virtual void updateToolbars() = 0;
99         /// update the status bar
100         virtual void updateStatusBar() = 0;
101         /// display a message in the view
102         virtual void message(docstring const &) = 0;
103
104         /// dispatch to current BufferView
105         virtual void dispatch(FuncRequest const & cmd) = 0;
106
107         /** redraw \c inset in all the BufferViews in which it is currently
108          *  visible. If successful return a pointer to the owning Buffer.
109          */
110         virtual Buffer const * updateInset(Inset const *) = 0;
111
112         /// returns true if this view has the focus.
113         virtual bool hasFocus() const = 0;
114
115         ///
116         virtual void restartCursor() = 0;
117         
118         //
119         // GuiBufferDelegate
120         //
121         virtual void errors(std::string const &) = 0;
122
123 private:
124         /// noncopyable
125         LyXView(LyXView const &);
126         void operator=(LyXView const &);
127
128         ///
129         int id_;
130 };
131
132 } // namespace frontend
133 } // namespace lyx
134
135 #endif // LYXVIEW_H