]> git.lyx.org Git - lyx.git/blob - src/funcrequest.h
copy some code over to allow work to start on prefs
[lyx.git] / src / funcrequest.h
1 /**
2  * \file funcrequest.h
3  * Copyright 2002 the LyX Team
4  * Read the file COPYING
5  *
6  * \author André Pönitz
7  */
8
9 #ifndef FUNCREQUEST_H
10 #define FUNCREQUEST_H
11
12 #include "commandtags.h"
13 #include "frontends/mouse_state.h"
14 #include "LString.h"
15
16 class BufferView;
17
18 /** 
19  * This class encapsulates a LyX action and its argument
20  * in order to pass it around easily.
21  */
22 class FuncRequest {
23 public:
24         /// just for putting thes things in std::container
25         FuncRequest();
26         /// actions without extra argument
27         explicit FuncRequest(kb_action act);
28         /// actions without extra argument
29         FuncRequest(kb_action act, int x, int y, mouse_button::state button);
30         /// actions with extra argument
31         FuncRequest(kb_action act, string const & arg);
32         /// actions without extra argument
33         FuncRequest(BufferView * bv, kb_action act);
34         /// actions with extra argument
35         FuncRequest(BufferView * bv, kb_action act, string const & arg);
36         /// for mouse events
37         FuncRequest(BufferView * bv, kb_action act,
38                 int x, int y, mouse_button::state button);
39         /// for changing requests a bit
40         FuncRequest(FuncRequest const & cmd, string const & arg);
41         /// for changing requests a bit
42         FuncRequest(FuncRequest const & cmd, BufferView * bv);
43
44         /// access to the view
45         BufferView * view() const;
46         /// access to the view
47         void setView(BufferView * bv);
48         /// access to button
49         mouse_button::state button() const;
50
51         /// output a message
52         void message(string const & msg) const;
53         /// output an error message
54         void errorMessage(string const & msg) const;
55
56 private:
57         /// the BufferView we are talking to
58         BufferView * view_;
59 public:  // should be private, too...
60         /// the action
61         kb_action action;
62         /// the action's string argument
63         string argument;
64         /// the x coordinate of a mouse press
65         int x;
66         /// the y coordinate of a mouse press
67         int y;
68         /// some extra information (like button number)
69         mouse_button::state button_;
70 };
71
72 #endif // FUNCREQUEST_H