4 * Read the file COPYING
6 * \author Lars Gullik Bjønnes
9 * Full author contact details are available in file CREDITS
21 #include "support/types.h"
23 #include <boost/utility.hpp>
24 #include <boost/scoped_ptr.hpp>
25 #include <boost/shared_ptr.hpp>
26 #include <boost/signals/trackable.hpp>
27 #include <boost/signals/signal0.hpp>
33 class ControlCommandBuffer;
43 * LyXView - main LyX window
45 * This class represents the main LyX window and provides
46 * accessor functions to its content.
48 * The eventual intention is that LyX will support a number
49 * of containing LyXViews. Currently a lot of code still
50 * relies on there being a single top-level view.
52 * Additionally we would like to support multiple views
53 * in a single LyXView.
55 class LyXView : public boost::signals::trackable, boost::noncopyable {
63 * This is called after the concrete view has been created.
64 * We have to have the toolbar and the other stuff created
65 * before we can populate it with this call.
69 /// start modal operation
70 virtual void prohibitInput() const = 0;
71 /// end modal operation
72 virtual void allowInput() const = 0;
74 //@{ generic accessor functions
76 /** return the current buffer view
77 Returned as a shared_ptr so that anything wanting to cache the
78 buffer view can do so safely using a boost::weak_ptr.
80 boost::shared_ptr<BufferView> const & view() const;
82 /// return the buffer currently shown in this window
83 Buffer * buffer() const;
85 /// return the LyX function handler for this view
86 LyXFunc & getLyXFunc() { return *lyxfunc_.get(); }
88 LyXFunc const & getLyXFunc() const { return *lyxfunc_.get(); }
90 /// return the toolbar for this view
91 Toolbar & getToolbar() { return *toolbar_.get(); }
93 Toolbar const & getToolbar() const { return *toolbar_.get(); }
95 /// return the menubar for this view
96 Menubar & getMenubar() { return *menubar_.get(); }
98 Menubar const & getMenubar() const { return *menubar_.get(); }
100 /// get access to the dialogs
101 Dialogs & getDialogs() { return *dialogs_.get(); }
103 Dialogs const & getDialogs() const { return *dialogs_.get(); }
105 /// get this view's keyboard map handler
106 Intl & getIntl() { return *intl_.get(); }
108 Intl const & getIntl() const { return *intl_.get(); }
112 /// sets the layout in the toolbar layout selection
113 void setLayout(string const & layout);
114 /// updates the possible layouts selectable
115 void updateLayoutChoice();
117 /// update the toolbar
118 void updateToolbar();
119 /// update the menubar
120 void updateMenubar();
122 /// focus the command buffer (minibuffer)
123 boost::signal0<void> focus_command_buffer;
125 /// view state string changed
126 boost::signal0<void> view_state_changed;
128 /// display a message in the view
129 virtual void message(string const &) = 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 & req);
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(string const & t, 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_;