]> git.lyx.org Git - lyx.git/blob - src/frontends/LyXView.h
New lyx_gui namespace. Some working out to be done still ..
[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
26 class Buffer;
27 class Toolbar;
28 class MiniBuffer;
29 class Intl;
30 class Menubar;
31
32 class BufferView;
33 class Dialogs;
34 class LyXFunc;
35 class LyXFont;
36 class Timeout;
37
38 /**
39  * LyXView - main LyX window
40  *
41  * This class represents the main LyX window and provides
42  * accessor functions to its content.
43  *
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.
47  *
48  * Additionally we would like to support multiple views
49  * in a single LyXView.
50  */
51 class LyXView : public boost::signals::trackable, boost::noncopyable {
52 public:
53         ///
54         LyXView();
55         ///
56         virtual ~LyXView();
57         /// Redraw the main form.
58         virtual void redraw() = 0;
59
60         /// Resize all BufferViews in this LyXView (because the width changed)
61         void resize();
62
63         /// returns the buffer currently shown in the main form.
64         Buffer * buffer() const;
65
66         ///
67         BufferView * view() const;
68
69         /// return the toolbar for this view
70         Toolbar * getToolbar() const;
71
72         /// sets the layout in the toolbar layout combox
73         void setLayout(string const & layout);
74         /// update the toolbar
75         void updateToolbar();
76
77         /// return a pointer to the lyxfunc
78         LyXFunc * getLyXFunc() const;
79
80         /// return a pointer to the minibuffer
81         MiniBuffer * getMiniBuffer() const;
82
83         ///
84         void message(string const &);
85         ///
86         void messagePush(string const & str);
87         ///
88         void messagePop();
89
90         /// return the menubar for this view
91         Menubar * getMenubar() const;
92
93         ///
94         void updateMenubar();
95
96         ///
97         Intl * getIntl() const;
98
99         /// get access to the dialogs
100         Dialogs * getDialogs() { return dialogs_.get(); }
101
102         ///
103         void updateLayoutChoice();
104
105         /// Updates the title of the window
106         void updateWindowTitle();
107
108         /// Show state (toolbar and font in minibuffer)
109         void showState();
110
111         /// Reset autosave timer
112         void resetAutosaveTimer();
113         ///
114         virtual void prohibitInput() const = 0;
115         ///
116         virtual void allowInput() const = 0;
117  
118 protected:
119         /// view of a buffer. Eventually there will be several.
120         boost::scoped_ptr<BufferView> bufferview_;
121
122         /// view's menubar
123         boost::scoped_ptr<Menubar> menubar_;
124         /// view's toolbar
125         boost::scoped_ptr<Toolbar> toolbar_;
126         /// view's minibuffer
127         boost::scoped_ptr<MiniBuffer> minibuffer_;
128
129         /// keyboard mapping object
130         boost::scoped_ptr<Intl> intl_;
131
132         /// auto-saving of buffers
133         boost::scoped_ptr<Timeout> autosave_timeout_;
134
135         /// called on timeout
136         void AutoSave();
137
138         /// FIXME: GUII - toolbar property
139         void invalidateLayoutChoice();
140
141 private:
142         /**
143          * setWindowTitle - set title of window
144          * @param t main window title
145          * @param it iconified (short) title
146          */
147         virtual void setWindowTitle(string const & t, string const & it) = 0;
148
149         /// our function handler
150         boost::scoped_ptr<LyXFunc> lyxfunc_;
151         /// dialogs for this view
152         boost::scoped_ptr<Dialogs> dialogs_;
153
154         /**
155          * The last textclass layout list in the layout choice selector
156          * This should probably be moved to the toolbar, but for now it's
157          * here. (Asger)
158          *
159          * FIXME: GUII
160          */
161         int last_textclass_;
162 };
163
164 #endif // LYXVIEW_H