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.
19 #include <boost/utility.hpp>
20 #include <boost/scoped_ptr.hpp>
21 #include <boost/shared_ptr.hpp>
22 #include <boost/signals/trackable.hpp>
23 #include <boost/signals/signal0.hpp>
29 class ControlCommandBuffer;
39 * LyXView - main LyX window
41 * This class represents the main LyX window and provides
42 * accessor functions to its content.
44 * The eventual intention is that LyX will support a number
45 * of containing LyXViews. Currently a lot of code still
46 * relies on there being a single top-level view.
48 * Additionally we would like to support multiple views
49 * in a single LyXView.
51 class LyXView : public boost::signals::trackable, boost::noncopyable {
59 * This is called after the concrete view has been created.
60 * We have to have the toolbar and the other stuff created
61 * before we can populate it with this call.
66 virtual void busy(bool) const = 0;
68 //@{ generic accessor functions
70 /** return the current buffer view
71 Returned as a shared_ptr so that anything wanting to cache the
72 buffer view can do so safely using a boost::weak_ptr.
74 boost::shared_ptr<BufferView> const & view() const;
76 /// return the buffer currently shown in this window
77 Buffer * buffer() const;
79 /// return the LyX function handler for this view
80 LyXFunc & getLyXFunc() { return *lyxfunc_.get(); }
82 LyXFunc const & getLyXFunc() const { return *lyxfunc_.get(); }
84 /// return the toolbar for this view
85 Toolbar & getToolbar() { return *toolbar_.get(); }
87 Toolbar const & getToolbar() const { return *toolbar_.get(); }
89 /// return the menubar for this view
90 Menubar & getMenubar() { return *menubar_.get(); }
92 Menubar const & getMenubar() const { return *menubar_.get(); }
94 /// get access to the dialogs
95 Dialogs & getDialogs() { return *dialogs_.get(); }
97 Dialogs const & getDialogs() const { return *dialogs_.get(); }
99 /// get this view's keyboard map handler
100 Intl & getIntl() { return *intl_.get(); }
102 Intl const & getIntl() const { return *intl_.get(); }
106 /// sets the layout in the toolbar layout selection
107 void setLayout(string const & layout);
108 /// updates the possible layouts selectable
109 void updateLayoutChoice();
111 /// update the toolbar
112 void updateToolbar();
113 /// update the menubar
114 void updateMenubar();
116 /// focus the command buffer (minibuffer)
117 boost::signal0<void> focus_command_buffer;
119 /// view state string changed
120 boost::signal0<void> view_state_changed;
122 /// display a message in the view
123 virtual void message(string const &) = 0;
125 /// clear any temporary message and replace with current status
126 virtual void clearMessage() = 0;
128 /// updates the title of the window
129 void updateWindowTitle();
131 /// reset autosave timer
132 void resetAutosaveTimer();
134 /// dispatch to current BufferView
135 void dispatch(FuncRequest const & req);
138 /// view of a buffer. Eventually there will be several.
139 boost::shared_ptr<BufferView> bufferview_;
142 boost::scoped_ptr<Menubar> menubar_;
144 boost::scoped_ptr<Toolbar> toolbar_;
148 * setWindowTitle - set title of window
149 * @param t main window title
150 * @param it iconified (short) title
152 virtual void setWindowTitle(string const & t, string const & it) = 0;
154 /// called on timeout
157 /// keyboard mapping object
158 boost::scoped_ptr<Intl> const intl_;
159 /// auto-saving of buffers
160 boost::scoped_ptr<Timeout> const autosave_timeout_;
161 /// our function handler
162 boost::scoped_ptr<LyXFunc> lyxfunc_;
163 /// dialogs for this view
164 boost::scoped_ptr<Dialogs> dialogs_;
167 /// view's command buffer controller
168 // this has to be declared _after_ lyxfunc_ as its initialization depends
170 boost::scoped_ptr<ControlCommandBuffer> const controlcommand_;