4 * Copyright 1995-2002 the LyX Team
5 * Read the file COPYING
7 * \author Lars Gullik Bjornes <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/signals/trackable.hpp>
25 #include <boost/signals/signal0.hpp>
31 class ControlCommandBuffer;
40 * LyXView - main LyX window
42 * This class represents the main LyX window and provides
43 * accessor functions to its content.
45 * The eventual intention is that LyX will support a number
46 * of containing LyXViews. Currently a lot of code still
47 * relies on there being a single top-level view.
49 * Additionally we would like to support multiple views
50 * in a single LyXView.
52 class LyXView : public boost::signals::trackable, boost::noncopyable {
60 * This is called after the concrete view has been created.
61 * We have to have the toolbar and the other stuff created
62 * before we can populate it with this call.
66 /// start modal operation
67 virtual void prohibitInput() const = 0;
68 /// end modal operation
69 virtual void allowInput() const = 0;
71 //@{ generic accessor functions
73 /// return the current buffer view
74 BufferView * view() const;
76 /// return the LyX function handler for this view
77 LyXFunc * getLyXFunc() const;
79 /// return the buffer currently shown in this window
80 Buffer * buffer() const;
82 /// return the toolbar for this view
83 Toolbar * getToolbar() const;
85 /// return the menubar for this view
86 Menubar * getMenubar() const;
88 /// get access to the dialogs
89 Dialogs * getDialogs() { return dialogs_.get(); }
91 /// get this view's keyboard map handler
92 Intl * getIntl() const;
96 /// sets the layout in the toolbar layout selection
97 void setLayout(string const & layout);
98 /// updates the possible layouts selectable
99 void updateLayoutChoice();
101 /// update the toolbar
102 void updateToolbar();
103 /// update the menubar
104 void updateMenubar();
106 /// focus the command buffer (minibuffer)
107 boost::signal0<void> focus_command_buffer;
109 /// view state string changed
110 boost::signal0<void> view_state_changed;
112 /// display a message in the view
113 virtual void message(string const &) = 0;
115 /// updates the title of the window
116 void updateWindowTitle();
118 /// reset autosave timer
119 void resetAutosaveTimer();
122 /// view of a buffer. Eventually there will be several.
123 boost::scoped_ptr<BufferView> bufferview_;
126 boost::scoped_ptr<Menubar> menubar_;
128 boost::scoped_ptr<Toolbar> toolbar_;
129 /// view's command buffer controller
130 boost::scoped_ptr<ControlCommandBuffer> controlcommand_;
132 /// keyboard mapping object
133 boost::scoped_ptr<Intl> intl_;
135 /// auto-saving of buffers
136 boost::scoped_ptr<Timeout> autosave_timeout_;
138 /// called on timeout
143 * setWindowTitle - set title of window
144 * @param t main window title
145 * @param it iconified (short) title
147 virtual void setWindowTitle(string const & t, string const & it) = 0;
149 /// our function handler
150 boost::scoped_ptr<LyXFunc> lyxfunc_;
151 /// dialogs for this view
152 boost::scoped_ptr<Dialogs> dialogs_;