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>
22 #include "support/std_string.h"
28 class ControlCommandBuffer;
38 * LyXView - main LyX window
40 * This class represents the main LyX window and provides
41 * accessor functions to its content.
43 * The eventual intention is that LyX will support a number
44 * of containing LyXViews. Currently a lot of code still
45 * relies on there being a single top-level view.
47 * Additionally we would like to support multiple views
48 * in a single LyXView.
50 class LyXView : public boost::signals::trackable, boost::noncopyable {
58 * This is called after the concrete view has been created.
59 * We have to have the toolbar and the other stuff created
60 * before we can populate it with this call.
65 virtual void busy(bool) const = 0;
67 //@{ generic accessor functions
69 /** return the current buffer view
70 Returned as a shared_ptr so that anything wanting to cache the
71 buffer view can do so safely using a boost::weak_ptr.
73 boost::shared_ptr<BufferView> const & view() const;
75 /// return the buffer currently shown in this window
76 Buffer * buffer() const;
78 /// return the LyX function handler for this view
79 LyXFunc & getLyXFunc() { return *lyxfunc_.get(); }
81 LyXFunc const & getLyXFunc() const { return *lyxfunc_.get(); }
83 /// return the toolbar for this view
84 Toolbar & getToolbar() { return *toolbar_.get(); }
86 Toolbar const & getToolbar() const { return *toolbar_.get(); }
88 /// return the menubar for this view
89 Menubar & getMenubar() { return *menubar_.get(); }
91 Menubar const & getMenubar() const { return *menubar_.get(); }
93 /// get access to the dialogs
94 Dialogs & getDialogs() { return *dialogs_.get(); }
96 Dialogs const & getDialogs() const { return *dialogs_.get(); }
98 /// get this view's keyboard map handler
99 Intl & getIntl() { return *intl_.get(); }
101 Intl const & getIntl() const { return *intl_.get(); }
105 /// sets the layout in the toolbar layout selection
106 void setLayout(string const & layout);
107 /// updates the possible layouts selectable
108 void updateLayoutChoice();
110 /// update the toolbar
111 void updateToolbar();
112 /// update the menubar
113 void updateMenubar();
115 /// focus the command buffer (minibuffer)
116 boost::signal0<void> focus_command_buffer;
118 /// view state string changed
119 boost::signal0<void> view_state_changed;
121 /// display a message in the view
122 virtual void message(string const &) = 0;
124 /// clear any temporary message and replace with current status
125 virtual void clearMessage() = 0;
127 /// updates the title of the window
128 void updateWindowTitle();
130 /// reset autosave timer
131 void resetAutosaveTimer();
133 /// dispatch to current BufferView
134 void dispatch(FuncRequest const & req);
137 /// view of a buffer. Eventually there will be several.
138 boost::shared_ptr<BufferView> bufferview_;
141 boost::scoped_ptr<Menubar> menubar_;
143 boost::scoped_ptr<Toolbar> toolbar_;
147 * setWindowTitle - set title of window
148 * @param t main window title
149 * @param it iconified (short) title
151 virtual void setWindowTitle(string const & t, string const & it) = 0;
153 /// called on timeout
156 /// keyboard mapping object
157 boost::scoped_ptr<Intl> const intl_;
158 /// auto-saving of buffers
159 boost::scoped_ptr<Timeout> const autosave_timeout_;
160 /// our function handler
161 boost::scoped_ptr<LyXFunc> lyxfunc_;
162 /// dialogs for this view
163 boost::scoped_ptr<Dialogs> dialogs_;
166 /// view's command buffer controller
167 // this has to be declared _after_ lyxfunc_ as its initialization depends
169 boost::scoped_ptr<ControlCommandBuffer> const controlcommand_;