]> git.lyx.org Git - lyx.git/blob - src/LyXFunc.h
* FindAndReplaceUi.ui: adapt tooltips
[lyx.git] / src / LyXFunc.h
1 // -*- C++ -*-
2 /**
3  * \file LyXFunc.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 Jean-Marc Lasgouttes
9  * \author John Levon
10  * \author André Pönitz
11  *
12  * Full author contact details are available in file CREDITS.
13  */
14
15 #ifndef LYXFUNC_H
16 #define LYXFUNC_H
17
18 #include "FuncCode.h"
19 #include "KeySequence.h"
20
21 #include "support/docstring.h"
22
23 namespace lyx {
24
25 class Buffer;
26 class BufferView;
27 class DispatchResult;
28 class DocumentClass;
29 class FuncRequest;
30 class FuncStatus;
31 class KeySymbol;
32 class Text;
33
34 namespace support {
35 class FileName;
36 }
37
38 /** This class encapsulates all the LyX command operations.
39     This is the class of the LyX's "high level event handler".
40     Every user command is processed here, either invocated from
41     keyboard or from the GUI. All GUI objects, including buttons and
42     menus should use this class and never call kernel functions directly.
43 */
44 class LyXFunc
45 {
46 public:
47         ///
48         explicit LyXFunc();
49
50         /// LyX dispatcher: executes lyx actions and returns result.
51         void dispatch(FuncRequest const &, DispatchResult &);
52
53         /// LyX dispatcher: executes lyx actions and does necessary
54         /// screen updates depending on results.
55         void dispatch(FuncRequest const &);
56
57         ///
58         FuncStatus getStatus(FuncRequest const & action) const;
59
60         /// goto a bookmark
61         /// openFile: whether or not open a file if the file is not opened
62         /// switchToBuffer: whether or not switch to buffer if the buffer is
63         ///             not the current buffer
64         void gotoBookmark(unsigned int idx, bool openFile, bool switchToBuffer);
65
66         /// cursor x position before dispatch started
67         int cursorBeforeDispatchX() const { return cursorPosBeforeDispatchX_; }
68         /// cursor y position before dispatch started
69         int cursorBeforeDispatchY() const { return cursorPosBeforeDispatchY_; }
70
71 private:
72         /// cursor position before dispatch started
73         int cursorPosBeforeDispatchX_;
74         int cursorPosBeforeDispatchY_;
75 };
76
77 /// Implementation is in LyX.cpp
78 extern LyXFunc & theLyXFunc();
79
80 /// Implementation is in LyX.cpp
81 extern FuncStatus getStatus(FuncRequest const & action);
82
83 /// Implementation is in LyX.cpp
84 extern void dispatch(FuncRequest const & action);
85
86 /// Implementation is in LyX.cpp
87 extern void dispatch(FuncRequest const & action, DispatchResult & dr);
88
89 } // namespace lyx
90
91 #endif