4 * This file is part of LyX, the document processor.
5 * Licence details can be found in the file COPYING.
7 * \author Lars Gullik Bjønnes
10 * Full author contact details are available in file CREDITS.
16 #include "frontends/Delegates.h"
17 #include "support/strfwd.h"
23 namespace support { class FileName; }
37 * LyXView - main LyX window
39 * This class represents the main LyX window and provides
40 * accessor functions to its content.
42 * The eventual intention is that LyX will support a number
43 * of containing LyXViews. Currently a lot of code still
44 * relies on there being a single top-level view.
46 * Additionally we would like to support multiple views
47 * in a single LyXView.
50 : public GuiBufferViewDelegate, public GuiBufferDelegate
54 LyXView(int id) : id_(id) {}
58 int id() const { return id_; }
60 virtual void close() = 0;
62 virtual void setFocus() = 0;
65 virtual WorkArea * workArea(Buffer & buffer) = 0;
67 virtual WorkArea * addWorkArea(Buffer & buffer) = 0;
69 virtual void setCurrentWorkArea(WorkArea * work_area) = 0;
71 virtual void removeWorkArea(WorkArea * work_area) = 0;
72 /// return the current WorkArea (the one that has the focus).
73 virtual WorkArea const * currentWorkArea() const = 0;
74 /// FIXME: This non-const access is needed because of
75 /// a mis-designed \c ControlSpellchecker.
76 virtual WorkArea * currentWorkArea() = 0;
79 * This is called after the concrete view has been created.
80 * We have to have the toolbar and the other stuff created
81 * before we can populate it with this call.
83 virtual void init() = 0;
88 HorizontallyMaximized,
93 virtual void setGeometry(
98 unsigned int iconSizeXY,
99 const std::string & geometryArg) = 0;
101 /// save the geometry state in the session manager.
102 virtual void saveGeometry() = 0;
105 virtual void setBusy(bool) = 0;
107 //@{ generic accessor functions
109 /// \return the current buffer view.
110 virtual BufferView * view() = 0;
112 /// \return the buffer currently shown in this window
113 virtual Buffer * buffer() = 0;
114 virtual Buffer const * buffer() const = 0;
115 /// set a buffer to the current workarea.
116 virtual void setBuffer(Buffer * b) = 0; ///< \c Buffer to set.
119 virtual void openLayoutList() = 0;
121 virtual bool isToolbarVisible(std::string const & id) = 0;
123 virtual void showMiniBuffer(bool visible) = 0;
124 virtual void openMenu(docstring const & name) = 0;
126 /// get access to the dialogs
127 virtual Dialogs & getDialogs() = 0;
129 virtual Dialogs const & getDialogs() const = 0;
133 /// load a buffer into the current workarea.
134 virtual Buffer * loadLyXFile(support::FileName const & name, ///< File to load.
135 bool tolastfiles = true) = 0; ///< append to the "Open recent" menu?
137 /// updates the possible layouts selectable
138 virtual void updateLayoutChoice(bool force) = 0;
140 /// update the toolbar
141 virtual void updateToolbars() = 0;
143 virtual ToolbarInfo * getToolbarInfo(std::string const & name) = 0;
144 /// toggle toolbar state
145 virtual void toggleToolbarState(std::string const & name, bool allowauto) = 0;
146 /// update the status bar
147 virtual void updateStatusBar() = 0;
149 /// display a message in the view
150 virtual void message(docstring const &) = 0;
152 /// clear any temporary message and replace with current status
153 virtual void clearMessage() = 0;
155 /// reset autosave timer
156 virtual void resetAutosaveTimer() = 0;
158 /// dispatch to current BufferView
159 virtual void dispatch(FuncRequest const & cmd) = 0;
161 /** redraw \c inset in all the BufferViews in which it is currently
162 * visible. If successful return a pointer to the owning Buffer.
164 virtual Buffer const * updateInset(Inset const *) = 0;
166 /// returns true if this view has the focus.
167 virtual bool hasFocus() const = 0;
169 /// show the error list to the user
170 virtual void showErrorList(std::string const &) = 0;
176 /// This function is called when the buffer structure is changed.
177 virtual void structureChanged() = 0;
178 /// This function is called when some parsing error shows up.
179 void errors(std::string const & err) { showErrorList(err); }
180 /// Reset autosave timers for all users.
181 void resetAutosaveTimers() { resetAutosaveTimer(); }
183 /// connect to signals in the given BufferView
184 virtual void connectBufferView(BufferView & bv) = 0;
185 /// disconnect from signals in the given BufferView
186 virtual void disconnectBufferView() = 0;
187 /// connect to signals in the given buffer
188 virtual void connectBuffer(Buffer & buf) = 0;
189 /// disconnect from signals in the given buffer
190 virtual void disconnectBuffer() = 0;
194 LyXView(LyXView const &);
195 void operator=(LyXView const &);
201 } // namespace frontend