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>
27 class ControlCommandBuffer;
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.
49 class LyXView : public boost::signals::trackable, boost::noncopyable {
57 * This is called after the concrete view has been created.
58 * We have to have the toolbar and the other stuff created
59 * before we can populate it with this call.
64 virtual void busy(bool) const = 0;
66 //@{ generic accessor functions
68 /** return the current buffer view
69 Returned as a shared_ptr so that anything wanting to cache the
70 buffer view can do so safely using a boost::weak_ptr.
72 boost::shared_ptr<BufferView> const & view() const;
74 /// return the buffer currently shown in this window
75 Buffer * buffer() const;
77 /// return the LyX function handler for this view
78 LyXFunc & getLyXFunc() { return *lyxfunc_.get(); }
80 LyXFunc const & getLyXFunc() const { return *lyxfunc_.get(); }
82 /// return the toolbar for this view
83 Toolbar & getToolbar() { return *toolbar_.get(); }
85 Toolbar const & getToolbar() const { return *toolbar_.get(); }
87 /// return the menubar for this view
88 Menubar & getMenubar() { return *menubar_.get(); }
90 Menubar const & getMenubar() const { return *menubar_.get(); }
92 /// get access to the dialogs
93 Dialogs & getDialogs() { return *dialogs_.get(); }
95 Dialogs const & getDialogs() const { return *dialogs_.get(); }
97 /// get this view's keyboard map handler
98 Intl & getIntl() { return *intl_.get(); }
100 Intl const & getIntl() const { return *intl_.get(); }
104 /// sets the layout in the toolbar layout selection
105 void setLayout(std::string const & layout);
106 /// updates the possible layouts selectable
107 void updateLayoutChoice();
109 /// update the toolbar
110 void updateToolbar();
111 /// update the menubar
112 void updateMenubar();
114 /// focus the command buffer (minibuffer)
115 boost::signal0<void> focus_command_buffer;
117 /// view state string changed
118 boost::signal0<void> view_state_changed;
120 /// display a message in the view
121 virtual void message(std::string const &) = 0;
123 /// clear any temporary message and replace with current status
124 virtual void clearMessage() = 0;
126 /// updates the title of the window
127 void updateWindowTitle();
129 /// reset autosave timer
130 void resetAutosaveTimer();
132 /// dispatch to current BufferView
133 void dispatch(FuncRequest const & req);
135 /** redraw \c inset in all the BufferViews in which it is currently
136 * visible. If successful return a pointer to the owning Buffer.
138 Buffer const * const updateInset(InsetOld const *) const;
141 /// view of a buffer. Eventually there will be several.
142 boost::shared_ptr<BufferView> bufferview_;
145 boost::scoped_ptr<Menubar> menubar_;
147 boost::scoped_ptr<Toolbar> toolbar_;
151 * setWindowTitle - set title of window
152 * @param t main window title
153 * @param it iconified (short) title
155 virtual void setWindowTitle(std::string const & t, std::string const & it) = 0;
157 /// called on timeout
160 /// keyboard mapping object
161 boost::scoped_ptr<Intl> const intl_;
162 /// auto-saving of buffers
163 boost::scoped_ptr<Timeout> const autosave_timeout_;
164 /// our function handler
165 boost::scoped_ptr<LyXFunc> lyxfunc_;
166 /// dialogs for this view
167 boost::scoped_ptr<Dialogs> dialogs_;
170 /// view's command buffer controller
171 // this has to be declared _after_ lyxfunc_ as its initialization depends
173 boost::scoped_ptr<ControlCommandBuffer> const controlcommand_;