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;
41 * LyXView - main LyX window
43 * This class represents the main LyX window and provides
44 * accessor functions to its content.
46 * The eventual intention is that LyX will support a number
47 * of containing LyXViews. Currently a lot of code still
48 * relies on there being a single top-level view.
50 * Additionally we would like to support multiple views
51 * in a single LyXView.
53 class LyXView : public boost::signals::trackable, boost::noncopyable {
61 * This is called after the concrete view has been created.
62 * We have to have the toolbar and the other stuff created
63 * before we can populate it with this call.
67 /// start modal operation
68 virtual void prohibitInput() const = 0;
69 /// end modal operation
70 virtual void allowInput() const = 0;
72 //@{ generic accessor functions
74 /** return the current buffer view
75 Returned as a shared_ptr so that anything wanting to cache the
76 buffer view can do so safely using a boost::weak_ptr.
78 boost::shared_ptr<BufferView> const & view() const;
80 /// return the LyX function handler for this view
81 LyXFunc * getLyXFunc() const;
83 /// return the buffer currently shown in this window
84 Buffer * buffer() const;
86 /// return the toolbar for this view
87 Toolbar * getToolbar() const;
89 /// return the menubar for this view
90 Menubar * getMenubar() const;
92 /// get access to the dialogs
93 Dialogs * getDialogs() { return dialogs_.get(); }
95 /// get this view's keyboard map handler
96 Intl * getIntl() const;
100 /// sets the layout in the toolbar layout selection
101 void setLayout(string const & layout);
102 /// updates the possible layouts selectable
103 void updateLayoutChoice();
105 /// update the toolbar
106 void updateToolbar();
107 /// update the menubar
108 void updateMenubar();
110 /// focus the command buffer (minibuffer)
111 boost::signal0<void> focus_command_buffer;
113 /// view state string changed
114 boost::signal0<void> view_state_changed;
116 /// display a message in the view
117 virtual void message(string const &) = 0;
119 /// updates the title of the window
120 void updateWindowTitle();
122 /// reset autosave timer
123 void resetAutosaveTimer();
126 /// view of a buffer. FuncRequestually there will be several.
127 boost::shared_ptr<BufferView> bufferview_;
130 boost::scoped_ptr<Menubar> menubar_;
132 boost::scoped_ptr<Toolbar> toolbar_;
133 /// view's command buffer controller
134 boost::scoped_ptr<ControlCommandBuffer> controlcommand_;
136 /// keyboard mapping object
137 boost::scoped_ptr<Intl> intl_;
139 /// auto-saving of buffers
140 boost::scoped_ptr<Timeout> autosave_timeout_;
142 /// called on timeout
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 /// our function handler
154 boost::scoped_ptr<LyXFunc> lyxfunc_;
155 /// dialogs for this view
156 boost::scoped_ptr<Dialogs> dialogs_;