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