]> git.lyx.org Git - lyx.git/blob - src/frontends/LyXView.h
- Cleanup and simplify the layout list GUI handling.
[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         /// display a message in the view
74         virtual void message(docstring const &) = 0;
75
76         ///
77         virtual FuncStatus getStatus(FuncRequest const & cmd) = 0;
78         /// dispatch to current BufferView
79         virtual void dispatch(FuncRequest const & cmd) = 0;
80
81         ///
82         virtual void restartCursor() = 0;
83         
84         //
85         // GuiBufferDelegate
86         //
87         virtual void errors(std::string const &) = 0;
88
89         //
90         // This View's Dialogs
91         //
92         
93         /** \param name == "bibtex", "citation" etc; an identifier used to
94             launch a particular dialog.
95             \param data is a string representation of the Inset contents.
96             It is often little more than the output from Inset::write.
97             It is passed to, and parsed by, the frontend dialog.
98             Several of these dialogs do not need any data,
99             so it defaults to string().
100             \param inset ownership is _not_ passed to the frontend dialog.
101             It is stored internally and used by the kernel to ascertain
102             what to do with the FuncRequest dispatched from the frontend
103             dialog on 'Apply'; should it be used to create a new inset at
104             the current cursor position or modify an existing, 'open' inset?
105         */
106         virtual void showDialog(std::string const & name,
107                 std::string const & data, Inset * inset = 0) = 0;
108
109         ///
110         virtual void disconnectDialog(std::string const & name) = 0;
111         ///
112         virtual Inset * getOpenInset(std::string const & name) const = 0;
113
114 private:
115         /// noncopyable
116         LyXView(LyXView const &);
117         void operator=(LyXView const &);
118 };
119
120 } // namespace frontend
121 } // namespace lyx
122
123 #endif // LYXVIEW_H