4 * Copyright 1995-2002 the LyX Team
5 * Read the file COPYING
7 * \author Lars Gullik Bjønnes <larsbj@lyx.org>
8 * \author John Levon <moz@compsoc.man.ac.uk>
20 #include "support/types.h"
22 #include <boost/utility.hpp>
23 #include <boost/scoped_ptr.hpp>
24 #include <boost/shared_ptr.hpp>
25 #include <boost/signals/trackable.hpp>
26 #include <boost/signals/signal0.hpp>
32 class ControlCommandBuffer;
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.
68 /// start modal operation
69 virtual void prohibitInput() const = 0;
70 /// end modal operation
71 virtual void allowInput() const = 0;
73 //@{ generic accessor functions
75 /** return the current buffer view
76 Returned as a shared_ptr so that anything wanting to cache the
77 buffer view can do so safely using a boost::weak_ptr.
79 boost::shared_ptr<BufferView> const & view() const;
81 /// return the buffer currently shown in this window
82 Buffer * buffer() const;
84 /// return the LyX function handler for this view
85 LyXFunc & getLyXFunc() { return *lyxfunc_.get(); }
87 LyXFunc const & getLyXFunc() const { return *lyxfunc_.get(); }
89 /// return the toolbar for this view
90 Toolbar & getToolbar() { return *toolbar_.get(); }
92 Toolbar const & getToolbar() const { return *toolbar_.get(); }
94 /// return the menubar for this view
95 Menubar & getMenubar() { return *menubar_.get(); }
97 Menubar const & getMenubar() const { return *menubar_.get(); }
99 /// get access to the dialogs
100 Dialogs & getDialogs() { return *dialogs_.get(); }
102 Dialogs const & getDialogs() const { return *dialogs_.get(); }
104 /// get this view's keyboard map handler
105 Intl & getIntl() { return *intl_.get(); }
107 Intl const & getIntl() const { return *intl_.get(); }
111 /// sets the layout in the toolbar layout selection
112 void setLayout(string const & layout);
113 /// updates the possible layouts selectable
114 void updateLayoutChoice();
116 /// update the toolbar
117 void updateToolbar();
118 /// update the menubar
119 void updateMenubar();
121 /// focus the command buffer (minibuffer)
122 boost::signal0<void> focus_command_buffer;
124 /// view state string changed
125 boost::signal0<void> view_state_changed;
127 /// display a message in the view
128 virtual void message(string const &) = 0;
130 /// updates the title of the window
131 void updateWindowTitle();
133 /// reset autosave timer
134 void resetAutosaveTimer();
136 /// dispatch to current BufferView
137 void dispatch(FuncRequest const & req);
140 /// view of a buffer. Eventually there will be several.
141 boost::shared_ptr<BufferView> bufferview_;
144 boost::scoped_ptr<Menubar> menubar_;
146 boost::scoped_ptr<Toolbar> toolbar_;
150 * setWindowTitle - set title of window
151 * @param t main window title
152 * @param it iconified (short) title
154 virtual void setWindowTitle(string const & t, string const & it) = 0;
156 /// called on timeout
159 /// keyboard mapping object
160 boost::scoped_ptr<Intl> const intl_;
161 /// auto-saving of buffers
162 boost::scoped_ptr<Timeout> const autosave_timeout_;
163 /// our function handler
164 boost::scoped_ptr<LyXFunc> lyxfunc_;
165 /// dialogs for this view
166 boost::scoped_ptr<Dialogs> dialogs_;
169 /// view's command buffer controller
170 // this has to be declared _after_ lyxfunc_ as its initialization depends
172 boost::scoped_ptr<ControlCommandBuffer> const controlcommand_;