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"
21 namespace support { class FileName; }
31 * LyXView - main LyX window
33 * This class represents the main LyX window and provides
34 * accessor functions to its content.
36 * The eventual intention is that LyX will support a number
37 * of containing LyXViews. Currently a lot of code still
38 * relies on there being a single top-level view.
40 * Additionally we would like to support multiple views
41 * in a single LyXView.
44 : public GuiBufferViewDelegate, public GuiBufferDelegate
48 LyXView(int id) : id_(id) {}
52 int id() const { return id_; }
54 virtual void close() = 0;
57 virtual void setBusy(bool) = 0;
59 //@{ generic accessor functions
61 /// \return the current buffer view.
62 virtual BufferView * view() = 0;
64 /// \return the buffer currently shown in this window
65 virtual Buffer * buffer() = 0;
66 virtual Buffer const * buffer() const = 0;
67 /// set a buffer to the current workarea.
68 virtual void setBuffer(Buffer * b) = 0; ///< \c Buffer to set.
71 virtual bool isToolbarVisible(std::string const & id) = 0;
75 /// load a buffer into the current workarea.
76 virtual Buffer * loadLyXFile(support::FileName const & name, ///< File to load.
77 bool tolastfiles = true) = 0; ///< append to the "Open recent" menu?
79 /// updates the possible layouts selectable
80 virtual void updateLayoutChoice(bool force) = 0;
81 /// update the toolbar
82 virtual void updateToolbars() = 0;
83 /// update the status bar
84 virtual void updateStatusBar() = 0;
85 /// display a message in the view
86 virtual void message(docstring const &) = 0;
88 /// dispatch to current BufferView
89 virtual void dispatch(FuncRequest const & cmd) = 0;
91 /** redraw \c inset in all the BufferViews in which it is currently
92 * visible. If successful return a pointer to the owning Buffer.
94 virtual Buffer const * updateInset(Inset const *) = 0;
96 /// returns true if this view has the focus.
97 virtual bool hasFocus() const = 0;
100 virtual void restartCursor() = 0;
105 virtual void errors(std::string const &) = 0;
109 // This View's Dialogs
112 /// Hide all visible dialogs
113 virtual void hideAll() const = 0;
115 /** \param name == "bibtex", "citation" etc; an identifier used to
116 launch a particular dialog.
117 \param data is a string representation of the Inset contents.
118 It is often little more than the output from Inset::write.
119 It is passed to, and parsed by, the frontend dialog.
120 Several of these dialogs do not need any data,
121 so it defaults to string().
122 \param inset ownership is _not_ passed to the frontend dialog.
123 It is stored internally and used by the kernel to ascertain
124 what to do with the FuncRequest dispatched from the frontend
125 dialog on 'Apply'; should it be used to create a new inset at
126 the current cursor position or modify an existing, 'open' inset?
128 virtual void showDialog(std::string const & name,
129 std::string const & data, Inset * inset = 0) = 0;
131 /** \param name == "citation", "bibtex" etc; an identifier used
132 to update the contents of a particular dialog with \param data.
133 See the comments to 'show', above.
135 virtual void updateDialog(std::string const & name, std::string const & data) = 0;
137 /// Is the dialog currently visible?
138 virtual bool isDialogVisible(std::string const & name) const = 0;
140 /** All Dialogs of the given \param name will be closed if they are
141 connected to the given \param inset.
143 virtual void hideDialog(std::string const & name, Inset * inset) = 0;
145 virtual void disconnectDialog(std::string const & name) = 0;
147 virtual Inset * getOpenInset(std::string const & name) const = 0;
151 LyXView(LyXView const &);
152 void operator=(LyXView const &);
158 } // namespace frontend