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 <boost/utility.hpp>
17 #include <boost/scoped_ptr.hpp>
18 #include <boost/shared_ptr.hpp>
19 #include <boost/signals/trackable.hpp>
20 #include <boost/signals/signal0.hpp>
37 class ControlCommandBuffer;
38 } // namespace frontend
42 * LyXView - main LyX window
44 * This class represents the main LyX window and provides
45 * accessor functions to its content.
47 * The eventual intention is that LyX will support a number
48 * of containing LyXViews. Currently a lot of code still
49 * relies on there being a single top-level view.
51 * Additionally we would like to support multiple views
52 * in a single LyXView.
54 class LyXView : public boost::signals::trackable, boost::noncopyable {
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.
69 virtual void busy(bool) const = 0;
71 //@{ generic accessor functions
73 /** return the current buffer view
74 Returned as a shared_ptr so that anything wanting to cache the
75 buffer view can do so safely using a boost::weak_ptr.
77 boost::shared_ptr<BufferView> const & view() const;
79 /// return the buffer currently shown in this window
80 Buffer * buffer() const;
82 /// return the LyX function handler for this view
83 LyXFunc & getLyXFunc() { return *lyxfunc_.get(); }
85 LyXFunc const & getLyXFunc() const { return *lyxfunc_.get(); }
87 /// return the toolbar for this view
88 Toolbars & getToolbars() { return *toolbars_.get(); }
90 Toolbars const & getToolbasr() const { return *toolbars_.get(); }
92 /// return the menubar for this view
93 Menubar & getMenubar() { return *menubar_.get(); }
95 Menubar const & getMenubar() const { return *menubar_.get(); }
97 /// get access to the dialogs
98 Dialogs & getDialogs() { return *dialogs_.get(); }
100 Dialogs const & getDialogs() const { return *dialogs_.get(); }
102 /// get this view's keyboard map handler
103 Intl & getIntl() { return *intl_.get(); }
105 Intl const & getIntl() const { return *intl_.get(); }
109 /// sets the layout in the toolbar layout selection
110 void setLayout(std::string const & layout);
111 /// updates the possible layouts selectable
112 void updateLayoutChoice();
114 /// update the toolbar
115 void updateToolbars();
116 /// update the menubar
117 void updateMenubar();
119 /// focus the command buffer (minibuffer)
120 boost::signal0<void> focus_command_buffer;
122 /// view state string changed
123 boost::signal0<void> view_state_changed;
125 /// display a message in the view
126 virtual void message(std::string const &) = 0;
128 /// clear any temporary message and replace with current status
129 virtual void clearMessage() = 0;
131 /// updates the title of the window
132 void updateWindowTitle();
134 /// reset autosave timer
135 void resetAutosaveTimer();
137 /// dispatch to current BufferView
138 void dispatch(FuncRequest const & cmd);
140 /** redraw \c inset in all the BufferViews in which it is currently
141 * visible. If successful return a pointer to the owning Buffer.
143 Buffer const * const updateInset(InsetBase const *) const;
146 /// view of a buffer. Eventually there will be several.
147 boost::shared_ptr<BufferView> bufferview_;
150 boost::scoped_ptr<Menubar> menubar_;
154 * setWindowTitle - set title of window
155 * @param t main window title
156 * @param it iconified (short) title
158 virtual void setWindowTitle(std::string const & t, std::string const & it) = 0;
160 /// called on timeout
164 boost::scoped_ptr<Toolbars> toolbars_;
165 /// keyboard mapping object
166 boost::scoped_ptr<Intl> const intl_;
167 /// auto-saving of buffers
168 boost::scoped_ptr<Timeout> const autosave_timeout_;
169 /// our function handler
170 boost::scoped_ptr<LyXFunc> lyxfunc_;
171 /// dialogs for this view
172 boost::scoped_ptr<Dialogs> dialogs_;
175 /// view's command buffer controller
176 // this has to be declared _after_ lyxfunc_ as its initialization depends
178 typedef boost::scoped_ptr<lyx::frontend::ControlCommandBuffer>
181 CommandBufferPtr const controlcommand_;