]> git.lyx.org Git - lyx.git/blob - src/frontends/LyXView.h
Cleanup LyXFunc::dispatch() following JMarc advice.
[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 {
46 public:
47         ///
48         LyXView() {}
49         ///
50         virtual ~LyXView() {}
51         ///
52         virtual int id() const = 0;
53         ///
54         virtual void close() = 0;
55
56         /// show busy cursor
57         virtual void setBusy(bool) = 0;
58
59         //@{ generic accessor functions
60
61         /// \return the current buffer view.
62         virtual BufferView * view() = 0;
63
64         /// \return the buffer currently shown in this window
65         virtual Buffer * buffer() = 0;
66         virtual Buffer const * buffer() const = 0;
67         /// set a buffer to the current workarea.
68         virtual void setBuffer(Buffer * b) = 0; ///< \c Buffer to set.
69
70         //@}
71
72         /// display a message in the view
73         virtual void message(docstring const &) = 0;
74
75         ///
76         virtual FuncStatus getStatus(FuncRequest const & cmd) = 0;
77         /// dispatch command.
78         /// \param propagate: indicate if the dispatch should be probagated to
79         /// the main lyx::dispatch().
80         /// \return true if the \c FuncRequest has been dispatched.
81         virtual bool dispatch(FuncRequest const & cmd, bool propagate) = 0;
82
83         ///
84         virtual void restartCursor() = 0;
85
86 private:
87         /// noncopyable
88         LyXView(LyXView const &);
89         void operator=(LyXView const &);
90 };
91
92 } // namespace frontend
93 } // namespace lyx
94
95 #endif // LYXVIEW_H