2003-08-23 00:17:00 +00:00
|
|
|
|
// -*- C++ -*-
|
2002-08-07 23:43:38 +00:00
|
|
|
|
/**
|
|
|
|
|
* \file funcrequest.h
|
2003-08-23 00:17:00 +00:00
|
|
|
|
* This file is part of LyX, the document processor.
|
|
|
|
|
* Licence details can be found in the file COPYING.
|
2002-08-07 23:43:38 +00:00
|
|
|
|
*
|
|
|
|
|
* \author Andr<EFBFBD> P<EFBFBD>nitz
|
2003-08-23 00:17:00 +00:00
|
|
|
|
*
|
|
|
|
|
* Full author contact details are available in file CREDITS.
|
2002-08-07 23:43:38 +00:00
|
|
|
|
*/
|
|
|
|
|
|
2002-08-07 08:11:41 +00:00
|
|
|
|
#ifndef FUNCREQUEST_H
|
|
|
|
|
#define FUNCREQUEST_H
|
|
|
|
|
|
2003-03-19 17:15:32 +00:00
|
|
|
|
#include "lfuns.h"
|
2002-08-19 10:11:13 +00:00
|
|
|
|
#include "frontends/mouse_state.h"
|
2003-10-06 15:43:21 +00:00
|
|
|
|
|
|
|
|
|
#include <string>
|
2003-11-10 09:06:48 +00:00
|
|
|
|
#include <iosfwd>
|
2002-08-07 08:11:41 +00:00
|
|
|
|
|
2002-12-01 22:59:25 +00:00
|
|
|
|
/**
|
2002-08-07 23:43:38 +00:00
|
|
|
|
* This class encapsulates a LyX action and its argument
|
|
|
|
|
* in order to pass it around easily.
|
2002-08-07 08:11:41 +00:00
|
|
|
|
*/
|
2002-08-13 17:43:40 +00:00
|
|
|
|
class FuncRequest {
|
|
|
|
|
public:
|
|
|
|
|
/// just for putting thes things in std::container
|
|
|
|
|
FuncRequest();
|
|
|
|
|
/// actions without extra argument
|
|
|
|
|
explicit FuncRequest(kb_action act);
|
2002-08-28 08:30:27 +00:00
|
|
|
|
/// actions without extra argument
|
|
|
|
|
FuncRequest(kb_action act, int x, int y, mouse_button::state button);
|
2002-08-13 17:43:40 +00:00
|
|
|
|
/// actions with extra argument
|
2003-10-06 15:43:21 +00:00
|
|
|
|
FuncRequest(kb_action act, std::string const & arg);
|
2002-08-20 13:00:25 +00:00
|
|
|
|
/// for changing requests a bit
|
2003-10-06 15:43:21 +00:00
|
|
|
|
FuncRequest(FuncRequest const & cmd, std::string const & arg);
|
2002-08-20 13:00:25 +00:00
|
|
|
|
|
2002-08-19 10:11:13 +00:00
|
|
|
|
/// access to button
|
|
|
|
|
mouse_button::state button() const;
|
2002-08-13 17:43:40 +00:00
|
|
|
|
|
2002-08-20 13:00:25 +00:00
|
|
|
|
/// output a message
|
2003-10-06 15:43:21 +00:00
|
|
|
|
void message(std::string const & msg) const;
|
2002-08-20 13:00:25 +00:00
|
|
|
|
/// output an error message
|
2003-10-06 15:43:21 +00:00
|
|
|
|
void errorMessage(std::string const & msg) const;
|
2002-08-20 13:00:25 +00:00
|
|
|
|
|
2003-10-06 15:43:21 +00:00
|
|
|
|
/// argument parsing, extract argument i as std::string
|
|
|
|
|
std::string getArg(unsigned int i) const;
|
2003-02-26 18:03:48 +00:00
|
|
|
|
|
2004-01-15 17:34:44 +00:00
|
|
|
|
public: // should be private
|
2002-08-07 23:43:38 +00:00
|
|
|
|
/// the action
|
2002-08-07 08:11:41 +00:00
|
|
|
|
kb_action action;
|
2003-10-06 15:43:21 +00:00
|
|
|
|
/// the action's std::string argument
|
|
|
|
|
std::string argument;
|
2002-08-12 09:53:04 +00:00
|
|
|
|
/// the x coordinate of a mouse press
|
|
|
|
|
int x;
|
|
|
|
|
/// the y coordinate of a mouse press
|
|
|
|
|
int y;
|
|
|
|
|
/// some extra information (like button number)
|
2002-08-19 10:11:13 +00:00
|
|
|
|
mouse_button::state button_;
|
2002-08-07 08:11:41 +00:00
|
|
|
|
};
|
|
|
|
|
|
2003-09-21 23:00:47 +00:00
|
|
|
|
|
2003-11-10 09:06:48 +00:00
|
|
|
|
bool operator==(FuncRequest const & lhs, FuncRequest const & rhs);
|
|
|
|
|
|
|
|
|
|
std::ostream & operator<<(std::ostream &, FuncRequest const &);
|
2003-09-21 23:00:47 +00:00
|
|
|
|
|
2002-08-07 23:43:38 +00:00
|
|
|
|
#endif // FUNCREQUEST_H
|