]> git.lyx.org Git - lyx.git/blob - src/frontends/LyXView.h
Transfer some LFUNs from LyXFunc to GuiView and get rid of GuiView methods.
[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         enum Maximized {
68                 NotMaximized,
69                 VerticallyMaximized,
70                 HorizontallyMaximized,
71                 CompletelyMaximized
72         };
73
74         ///
75         virtual void setGeometry(
76                 unsigned int width,
77                 unsigned int height,
78                 int posx, int posy,
79                 Maximized maximize,
80                 unsigned int iconSizeXY,
81                 const std::string & geometryArg) = 0;
82
83         /// show busy cursor
84         virtual void setBusy(bool) = 0;
85
86         //@{ generic accessor functions
87
88         /// \return the current buffer view.
89         virtual BufferView * view() = 0;
90
91         /// \return the buffer currently shown in this window
92         virtual Buffer * buffer() = 0;
93         virtual Buffer const * buffer() const = 0;
94         /// set a buffer to the current workarea.
95         virtual void setBuffer(Buffer * b) = 0; ///< \c Buffer to set.
96
97         ///
98         virtual bool isToolbarVisible(std::string const & id) = 0;
99
100         /// get access to the dialogs
101         virtual Dialogs & getDialogs() = 0;
102         ///
103         virtual Dialogs const & getDialogs() const = 0;
104
105         //@}
106
107         /// load a buffer into the current workarea.
108         virtual Buffer * loadLyXFile(support::FileName const &  name, ///< File to load.
109                 bool tolastfiles = true) = 0;  ///< append to the "Open recent" menu?
110
111         /// updates the possible layouts selectable
112         virtual void updateLayoutChoice(bool force) = 0;
113         /// update the toolbar
114         virtual void updateToolbars() = 0;
115         /// update the status bar
116         virtual void updateStatusBar() = 0;
117         /// display a message in the view
118         virtual void message(docstring const &) = 0;
119
120         /// dispatch to current BufferView
121         virtual void dispatch(FuncRequest const & cmd) = 0;
122
123         /** redraw \c inset in all the BufferViews in which it is currently
124          *  visible. If successful return a pointer to the owning Buffer.
125          */
126         virtual Buffer const * updateInset(Inset const *) = 0;
127
128         /// returns true if this view has the focus.
129         virtual bool hasFocus() const = 0;
130
131         ///
132         virtual void restartCursor() = 0;
133         
134         //
135         // GuiBufferDelegate
136         //
137         virtual void errors(std::string const &) = 0;
138
139 private:
140         /// noncopyable
141         LyXView(LyXView const &);
142         void operator=(LyXView const &);
143
144         ///
145         int id_;
146 };
147
148 } // namespace frontend
149 } // namespace lyx
150
151 #endif // LYXVIEW_H