]> git.lyx.org Git - lyx.git/blob - src/funcrequest.C
are optional arguments really only alowed in a declaration?
[lyx.git] / src / funcrequest.C
1 /**
2  * \file funcrequest.C
3  * Copyright 2002 the LyX Team
4  * Read the file COPYING
5  *
6  * \author André Pönitz
7  */
8
9 #include "funcrequest.h"
10 #include "BufferView.h"
11 #include "lyxfunc.h" // only for setMessage()
12 #include "frontends/LyXView.h"
13 #include "debug.h"
14
15
16 FuncRequest::FuncRequest()
17         : view_(0), action(LFUN_UNKNOWN_ACTION)
18 {}
19
20
21 FuncRequest::FuncRequest(kb_action act)
22         : view_(0), action(act)
23 {}
24
25
26 FuncRequest::FuncRequest(kb_action act, string const & arg)
27         : view_(0), action(act), argument(arg)
28 {}
29
30
31 FuncRequest::FuncRequest(BufferView * view, kb_action act)
32         : view_(view), action(act)
33 {}
34
35
36 FuncRequest::FuncRequest(BufferView * view, kb_action act, string const & arg)
37         : view_(view), action(act), argument(arg)
38 {}
39
40
41 FuncRequest::FuncRequest
42                 (BufferView * view, kb_action act, int ax, int ay, mouse_button::state but)
43         : view_(view), action(act), argument(), x(ax), y(ay), button_(but)
44 {}
45
46
47
48 FuncRequest::FuncRequest(FuncRequest const & cmd, string const & arg)
49         : view_(cmd.view_), action(cmd.action), argument(arg),
50           x(cmd.x), y(cmd.y), button_(cmd.button_)
51 {}
52         
53
54 BufferView * FuncRequest::view() const
55 {
56         return view_;
57 }
58
59
60 void FuncRequest::setView(BufferView * view)
61 {
62         view_ = view;
63 }
64
65
66 mouse_button::state FuncRequest::button() const
67 {
68         return button_;
69 }
70
71
72 void FuncRequest::message(string const & msg) const
73 {
74         if (view_)
75                 view_->owner()->getLyXFunc().setMessage(msg);
76         else
77                 lyxerr  << "Dropping message '" << msg << "'\n";
78 }
79
80
81 void FuncRequest::errorMessage(string const & msg) const
82 {
83         if (view_)
84                 view_->owner()->getLyXFunc().setErrorMessage(msg);
85         else
86                 lyxerr  << "Dropping error message '" << msg << "'\n";
87 }