17 #ifndef _MOUSE_EVENT_HANDLER_HH_
18 #define _MOUSE_EVENT_HANDLER_HH_
20 #include <boost/function.hpp>
39 public:
typedef boost::function<bool (const common::MouseEvent &_event)>
49 public: Filter(
const std::string &_name,
50 MouseEventFilter _func)
51 : name(_name), func(_func) {}
56 public:
bool operator==(
const Filter &_f)
const
58 return this->name == _f.name;
64 public:
bool operator==(
const std::string &_f)
const
66 return this->name == _f;
70 public: std::string name;
73 public: MouseEventFilter func;
77 private: MouseEventHandler();
80 private:
virtual ~MouseEventHandler();
85 public:
void AddPressFilter(
const std::string &_name,
86 MouseEventFilter _filter);
91 public:
void AddReleaseFilter(
const std::string &_name,
92 MouseEventFilter _filter);
97 public:
void AddMoveFilter(
const std::string &_name,
98 MouseEventFilter _filter);
103 public:
void AddDoubleClickFilter(
const std::string &_name,
104 MouseEventFilter _filter);
108 public:
void RemovePressFilter(
const std::string &_name);
112 public:
void RemoveReleaseFilter(
const std::string &_name);
116 public:
void RemoveMoveFilter(
const std::string &_name);
120 public:
void RemoveDoubleClickFilter(
const std::string &_name);
124 public:
void HandlePress(
const common::MouseEvent &_event);
128 public:
void HandleRelease(
const common::MouseEvent &_event);
132 public:
void HandleMove(
const common::MouseEvent &_event);
136 public:
void HandleDoubleClick(
const common::MouseEvent &_event);
142 private:
void Add(
const std::string &_name, MouseEventFilter _filter,
143 std::list<Filter> &_list);
148 private:
void Remove(
const std::string &_name, std::list<Filter> &_list);
153 private:
void Handle(
const common::MouseEvent &_event,
154 std::list<Filter> &_list);
157 private: std::list<Filter> pressFilters;
160 private: std::list<Filter> releaseFilters;
163 private: std::list<Filter> moveFilters;
166 private: std::list<Filter> doubleClickFilters;
169 private:
friend class SingletonT<MouseEventHandler>;
Singleton template class.
Definition: SingletonT.hh:33
#define GAZEBO_VISIBLE
Use to represent "symbol visible" if supported.
Definition: system.hh:48