4 * This file is part of LyX, the document processor.
5 * Licence details can be found in the file COPYING.
9 * Full author contact details are available in file CREDITS.
17 #include "support/docstring.h"
19 #include "frontends/mouse_state.h"
25 * This class encapsulates a LyX action and its argument
26 * in order to pass it around easily.
31 /// Where the request came from
35 TOOLBAR, // A toolbar icon
36 KEYBOARD, // a keyboard binding
41 /// just for putting these things in std::container
42 explicit FuncRequest(Origin o = INTERNAL);
43 /// actions without extra argument
44 explicit FuncRequest(FuncCode act, Origin o = INTERNAL);
45 /// actions without extra argument
46 FuncRequest(FuncCode act, int x, int y, mouse_button::state button,
48 /// actions with extra argument
49 FuncRequest(FuncCode act, docstring const & arg,
51 /// actions with extra argument. FIXME: remove this
52 FuncRequest(FuncCode act, std::string const & arg,
54 /// for changing requests a bit
55 FuncRequest(FuncRequest const & cmd, docstring const & arg,
57 /// for changing requests a bit. FIXME: remove this
58 FuncRequest(FuncRequest const & cmd, std::string const & arg,
62 mouse_button::state button() const;
64 /// argument parsing, extract argument i as std::string
65 std::string getArg(unsigned int i) const;
67 /// argument parsing, extract argument i as std::string,
68 /// eating all characters up to the end of the command line
69 std::string getLongArg(unsigned int i) const;
71 /// access the whole argument
72 docstring const & argument() const { return argument_; }
75 static FuncRequest const unknown;
77 static FuncRequest const noaction;
78 public: // should be private
82 /// the action's string argument
84 public: // should be private
85 /// who initiated the action
87 /// the x coordinate of a mouse press
89 /// the y coordinate of a mouse press
91 /// some extra information (like button number)
92 mouse_button::state button_;
96 bool operator==(FuncRequest const & lhs, FuncRequest const & rhs);
98 std::ostream & operator<<(std::ostream &, FuncRequest const &);
103 #endif // FUNCREQUEST_H