]> git.lyx.org Git - lyx.git/blob - src/frontends/LyXView.h
Cosmetics.
[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 class ToolbarInfo;
28
29 namespace frontend {
30
31 class Dialogs;
32
33 /**
34  * LyXView - main LyX window
35  *
36  * This class represents the main LyX window and provides
37  * accessor functions to its content.
38  *
39  * The eventual intention is that LyX will support a number
40  * of containing LyXViews. Currently a lot of code still
41  * relies on there being a single top-level view.
42  *
43  * Additionally we would like to support multiple views
44  * in a single LyXView.
45  */
46 class LyXView
47         : public GuiBufferViewDelegate, public GuiBufferDelegate
48 {
49 public:
50         ///
51         LyXView(int id) : id_(id) {}
52         ///
53         virtual ~LyXView() {}
54         ///
55         int id() const { return id_; }
56         ///
57         virtual void close() = 0;
58         ///
59         virtual void setFocus() = 0;
60
61         /**
62          * This is called after the concrete view has been created.
63          * We have to have the toolbar and the other stuff created
64          * before we can populate it with this call.
65          */
66         virtual void init() = 0;
67
68         enum Maximized {
69                 NotMaximized,
70                 VerticallyMaximized,
71                 HorizontallyMaximized,
72                 CompletelyMaximized
73         };
74
75         ///
76         virtual void setGeometry(
77                 unsigned int width,
78                 unsigned int height,
79                 int posx, int posy,
80                 Maximized maximize,
81                 unsigned int iconSizeXY,
82                 const std::string & geometryArg) = 0;
83
84         /// show busy cursor
85         virtual void setBusy(bool) = 0;
86
87         //@{ generic accessor functions
88
89         /// \return the current buffer view.
90         virtual BufferView * view() = 0;
91
92         /// \return the buffer currently shown in this window
93         virtual Buffer * buffer() = 0;
94         virtual Buffer const * buffer() const = 0;
95         /// set a buffer to the current workarea.
96         virtual void setBuffer(Buffer * b) = 0; ///< \c Buffer to set.
97
98         ///
99         virtual void openLayoutList() = 0;
100         ///
101         virtual bool isToolbarVisible(std::string const & id) = 0;
102         ///
103         virtual void showMiniBuffer(bool visible) = 0;
104         virtual void openMenu(docstring const & name) = 0;
105
106         /// get access to the dialogs
107         virtual Dialogs & getDialogs() = 0;
108         ///
109         virtual Dialogs const & getDialogs() const = 0;
110
111         //@}
112
113         /// load a buffer into the current workarea.
114         virtual Buffer * loadLyXFile(support::FileName const &  name, ///< File to load.
115                 bool tolastfiles = true) = 0;  ///< append to the "Open recent" menu?
116
117         /// updates the possible layouts selectable
118         virtual void updateLayoutChoice(bool force) = 0;
119
120         /// update the toolbar
121         virtual void updateToolbars() = 0;
122         /// get toolbar info
123         virtual ToolbarInfo * getToolbarInfo(std::string const & name) = 0;
124         /// toggle toolbar state
125         virtual void toggleToolbarState(std::string const & name, bool allowauto) = 0;
126         /// update the status bar
127         virtual void updateStatusBar() = 0;
128
129         /// display a message in the view
130         virtual void message(docstring const &) = 0;
131
132         /// clear any temporary message and replace with current status
133         virtual void clearMessage() = 0;
134
135         /// dispatch to current BufferView
136         virtual void dispatch(FuncRequest const & cmd) = 0;
137
138         /** redraw \c inset in all the BufferViews in which it is currently
139          *  visible. If successful return a pointer to the owning Buffer.
140          */
141         virtual Buffer const * updateInset(Inset const *) = 0;
142
143         /// returns true if this view has the focus.
144         virtual bool hasFocus() const = 0;
145
146
147         ///
148         virtual void restartCursor() = 0;
149         
150         //
151         // GuiBufferDelegate
152         //
153         virtual void errors(std::string const &) = 0;
154
155 private:
156         /// noncopyable
157         LyXView(LyXView const &);
158         void operator=(LyXView const &);
159
160         ///
161         int id_;
162 };
163
164 } // namespace frontend
165 } // namespace lyx
166
167 #endif // LYXVIEW_H