]> git.lyx.org Git - lyx.git/blob - src/funcrequest.h
another 100+ lines bite the dust...
[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 with extra argument
29         FuncRequest(kb_action act, string const & arg);
30         /// actions without extra argument
31         FuncRequest(BufferView * view, kb_action act);
32         /// actions with extra argument
33         FuncRequest(BufferView * view, kb_action act, string const & arg);
34         /// for mouse events
35         FuncRequest(BufferView * view, kb_action act,
36                 int x, int y, mouse_button::state button);
37         /// for changing requests a bit
38         FuncRequest(FuncRequest const & cmd, string const & arg);
39
40         /// access to the view
41         BufferView * view() const;
42         /// access to the view
43         void setView(BufferView * view);
44         /// access to button
45         mouse_button::state button() const;
46
47         /// output a message
48         void message(string const & msg) const;
49         /// output an error message
50         void errorMessage(string const & msg) const;
51
52 private:
53         /// the BufferView we are talking to
54         BufferView * view_;
55 public:  // should be private, too...
56         /// the action
57         kb_action action;
58         /// the action's string argument
59         string argument;
60         /// the x coordinate of a mouse press
61         int x;
62         /// the y coordinate of a mouse press
63         int y;
64         /// some extra information (like button number)
65         mouse_button::state button_;
66 };
67
68 #endif // FUNCREQUEST_H