]> git.lyx.org Git - lyx.git/blob - src/frontends/LyXView.h
Transfer some LFUNs from LyXFunc to GuiView.
[lyx.git] / src / frontends / LyXView.h
1 // -*- C++ -*-
2 /**
3  * \file LyXView.h
4  * This file is part of LyX, the document processor.
5  * Licence details can be found in the file COPYING.
6  *
7  * \author Lars Gullik Bjønnes
8  * \author John Levon
9  *
10  * Full author contact details are available in file CREDITS.
11  */
12
13 #ifndef LYXVIEW_H
14 #define LYXVIEW_H
15
16 #include "frontends/Delegates.h"
17 #include "support/strfwd.h"
18
19 namespace lyx {
20
21 namespace support { class FileName; }
22
23 class Buffer;
24 class BufferView;
25 class FuncStatus;
26 class FuncRequest;
27 class Inset;
28
29 namespace frontend {
30
31 /**
32  * LyXView - main LyX window
33  *
34  * This class represents the main LyX window and provides
35  * accessor functions to its content.
36  *
37  * The eventual intention is that LyX will support a number
38  * of containing LyXViews. Currently a lot of code still
39  * relies on there being a single top-level view.
40  *
41  * Additionally we would like to support multiple views
42  * in a single LyXView.
43  */
44 class LyXView
45         : public GuiBufferViewDelegate, public GuiBufferDelegate
46 {
47 public:
48         ///
49         LyXView() {}
50         ///
51         virtual ~LyXView() {}
52         ///
53         virtual int id() const = 0;
54         ///
55         virtual void close() = 0;
56
57         /// show busy cursor
58         virtual void setBusy(bool) = 0;
59
60         //@{ generic accessor functions
61
62         /// \return the current buffer view.
63         virtual BufferView * view() = 0;
64
65         /// \return the buffer currently shown in this window
66         virtual Buffer * buffer() = 0;
67         virtual Buffer const * buffer() const = 0;
68         /// set a buffer to the current workarea.
69         virtual void setBuffer(Buffer * b) = 0; ///< \c Buffer to set.
70
71         //@}
72
73         /// updates the possible layouts selectable
74         virtual void updateLayoutChoice(bool force) = 0;
75         /// update the toolbar
76         virtual void updateToolbars() = 0;
77         /// update the status bar
78         virtual void updateStatusBar() = 0;
79         /// display a message in the view
80         virtual void message(docstring const &) = 0;
81
82         ///
83         virtual FuncStatus getStatus(FuncRequest const & cmd) = 0;
84         /// dispatch to current BufferView
85         virtual void dispatch(FuncRequest const & cmd) = 0;
86
87         /** redraw \c inset in all the BufferViews in which it is currently
88          *  visible. If successful return a pointer to the owning Buffer.
89          */
90         virtual Buffer const * updateInset(Inset const *) = 0;
91
92         /// returns true if this view has the focus.
93         virtual bool hasFocus() const = 0;
94
95         ///
96         virtual void restartCursor() = 0;
97         
98         //
99         // GuiBufferDelegate
100         //
101         virtual void errors(std::string const &) = 0;
102
103
104         //
105         // This View's Dialogs
106         //
107         
108         /// Hide all visible dialogs
109         virtual void hideAll() const = 0;
110
111         /** \param name == "bibtex", "citation" etc; an identifier used to
112             launch a particular dialog.
113             \param data is a string representation of the Inset contents.
114             It is often little more than the output from Inset::write.
115             It is passed to, and parsed by, the frontend dialog.
116             Several of these dialogs do not need any data,
117             so it defaults to string().
118             \param inset ownership is _not_ passed to the frontend dialog.
119             It is stored internally and used by the kernel to ascertain
120             what to do with the FuncRequest dispatched from the frontend
121             dialog on 'Apply'; should it be used to create a new inset at
122             the current cursor position or modify an existing, 'open' inset?
123         */
124         virtual void showDialog(std::string const & name,
125                 std::string const & data, Inset * inset = 0) = 0;
126
127         ///
128         virtual void disconnectDialog(std::string const & name) = 0;
129         ///
130         virtual Inset * getOpenInset(std::string const & name) const = 0;
131
132 private:
133         /// noncopyable
134         LyXView(LyXView const &);
135         void operator=(LyXView const &);
136 };
137
138 } // namespace frontend
139 } // namespace lyx
140
141 #endif // LYXVIEW_H