]> git.lyx.org Git - lyx.git/blob - src/frontends/LyXView.h
dispatch changes ...
[lyx.git] / src / frontends / LyXView.h
1 // -*- C++ -*-
2 /**
3  * \file LyXView.h
4  * Copyright 1995-2002 the LyX Team
5  * Read the file COPYING
6  *
7  * \author Lars Gullik Bjornes <larsbj@lyx.org>
8  * \author John Levon <moz@compsoc.man.ac.uk>
9  */
10
11 #ifndef LYXVIEW_H
12 #define LYXVIEW_H
13
14 #ifdef __GNUG__
15 #pragma interface
16 #endif
17
18 #include "LString.h"
19
20 #include "support/types.h"
21
22 #include <boost/utility.hpp>
23 #include <boost/scoped_ptr.hpp>
24 #include <boost/signals/trackable.hpp>
25 #include <boost/signals/signal0.hpp>
26
27 class Buffer;
28 class Toolbar;
29 class MiniBuffer;
30 class Intl;
31 class Menubar;
32
33 class BufferView;
34 class Dialogs;
35 class LyXFunc;
36 class LyXFont;
37 class Timeout;
38
39 /**
40  * LyXView - main LyX window
41  *
42  * This class represents the main LyX window and provides
43  * accessor functions to its content.
44  *
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.
48  *
49  * Additionally we would like to support multiple views
50  * in a single LyXView.
51  */
52 class LyXView : public boost::signals::trackable, boost::noncopyable {
53 public:
54
55         LyXView();
56
57         virtual ~LyXView();
58
59         /**
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.
63          */
64         void init();
65
66         /// start modal operation
67         virtual void prohibitInput() const = 0;
68         /// end modal operation
69         virtual void allowInput() const = 0;
70
71         //@{ generic accessor functions
72
73         /// return the current buffer view
74         BufferView * view() const;
75
76         /// return the LyX function handler for this view
77         LyXFunc * getLyXFunc() const;
78
79         /// return the buffer currently shown in this window
80         Buffer * buffer() const;
81
82         /// return the toolbar for this view
83         Toolbar * getToolbar() const;
84
85         /// return the menubar for this view
86         Menubar * getMenubar() const;
87
88         /// return the minibuffer for this view
89         /// FIXME: I'm not at all sure that LyXFunc should be
90         /// aware of a mini buffer as such
91         MiniBuffer * getMiniBuffer() const;
92
93         /// get access to the dialogs
94         Dialogs * getDialogs() { return dialogs_.get(); }
95
96         /// get this view's keyboard map handler
97         Intl * getIntl() const;
98
99         //@}
100
101         /// sets the layout in the toolbar layout selection
102         void setLayout(string const & layout);
103         /// updates the possible layouts selectable
104         void updateLayoutChoice();
105
106         /// update the toolbar
107         void updateToolbar();
108         /// update the menubar
109         void updateMenubar();
110
111         /// view state string changed
112         boost::signal0<void> view_state_changed;
113
114         /// display a message in the view
115         void message(string const &);
116
117         /// updates the title of the window
118         void updateWindowTitle();
119
120         /// reset autosave timer
121         void resetAutosaveTimer();
122
123 protected:
124         /// view of a buffer. Eventually there will be several.
125         boost::scoped_ptr<BufferView> bufferview_;
126
127         /// view's menubar
128         boost::scoped_ptr<Menubar> menubar_;
129         /// view's toolbar
130         boost::scoped_ptr<Toolbar> toolbar_;
131         /// view's minibuffer
132         boost::scoped_ptr<MiniBuffer> minibuffer_;
133
134         /// keyboard mapping object
135         boost::scoped_ptr<Intl> intl_;
136
137         /// auto-saving of buffers
138         boost::scoped_ptr<Timeout> autosave_timeout_;
139
140         /// called on timeout
141         void autoSave();
142
143 private:
144         /**
145          * setWindowTitle - set title of window
146          * @param t main window title
147          * @param it iconified (short) title
148          */
149         virtual void setWindowTitle(string const & t, string const & it) = 0;
150
151         /// our function handler
152         boost::scoped_ptr<LyXFunc> lyxfunc_;
153         /// dialogs for this view
154         boost::scoped_ptr<Dialogs> dialogs_;
155 };
156
157 #endif // LYXVIEW_H