3 * This file is part of LyX, the document processor.
4 * Licence details can be found in the file COPYING.
8 * Full author contact details are available in file CREDITS.
13 #include "funcrequest.h"
23 using std::istringstream;
28 FuncRequest::FuncRequest(Origin o)
29 : action(LFUN_NOACTION), origin(o), x(0), y(0),
30 button_(mouse_button::none)
34 FuncRequest::FuncRequest(kb_action act, Origin o)
35 : action(act), origin(o), x(0), y(0), button_(mouse_button::none)
39 FuncRequest::FuncRequest(kb_action act, docstring const & arg, Origin o)
40 : action(act), argument_(arg), origin(o), x(0), y(0),
41 button_(mouse_button::none)
45 FuncRequest::FuncRequest(kb_action act, string const & arg, Origin o)
46 : action(act), argument_(from_utf8(arg)), origin(o), x(0), y(0),
47 button_(mouse_button::none)
51 FuncRequest::FuncRequest(kb_action act, int ax, int ay,
52 mouse_button::state but, Origin o)
53 : action(act), origin(o), x(ax), y(ay), button_(but)
57 FuncRequest::FuncRequest(FuncRequest const & cmd, docstring const & arg, Origin o)
58 : action(cmd.action), argument_(arg), origin(o),
59 x(cmd.x), y(cmd.y), button_(cmd.button_)
63 FuncRequest::FuncRequest(FuncRequest const & cmd, string const & arg, Origin o)
64 : action(cmd.action), argument_(from_utf8(arg)), origin(o),
65 x(cmd.x), y(cmd.y), button_(cmd.button_)
69 mouse_button::state FuncRequest::button() const
75 void split(vector<string> & args, string const & str)
77 istringstream is(str);
95 string FuncRequest::getArg(unsigned int i) const
98 split(args, to_utf8(argument_));
99 return i < args.size() ? args[i] : string();
103 bool operator==(FuncRequest const & lhs, FuncRequest const & rhs)
105 return lhs.action == rhs.action && lhs.argument() == rhs.argument();
109 std::ostream & operator<<(std::ostream & os, FuncRequest const & cmd)
112 << " action: " << cmd.action
113 << " arg: '" << to_utf8(cmd.argument()) << "'"