17 #ifndef _MOUSE_EVENT_HANDLER_HH_ 18 #define _MOUSE_EVENT_HANDLER_HH_ 20 #include <boost/function.hpp> 37 class GZ_GUI_VISIBLE MouseEventHandler
42 public:
typedef boost::function<bool (const common::MouseEvent &_event)>
52 public: Filter(
const std::string &_name,
53 MouseEventFilter _func)
54 : name(_name), func(_func) {}
59 public:
bool operator==(
const Filter &_f)
const 61 return this->name == _f.name;
67 public:
bool operator==(
const std::string &_f)
const 69 return this->name == _f;
73 public: std::string name;
76 public: MouseEventFilter func;
80 private: MouseEventHandler();
83 private:
virtual ~MouseEventHandler();
88 public:
void AddPressFilter(
const std::string &_name,
89 MouseEventFilter _filter);
94 public:
void AddReleaseFilter(
const std::string &_name,
95 MouseEventFilter _filter);
100 public:
void AddMoveFilter(
const std::string &_name,
101 MouseEventFilter _filter);
106 public:
void AddDoubleClickFilter(
const std::string &_name,
107 MouseEventFilter _filter);
111 public:
void RemovePressFilter(
const std::string &_name);
115 public:
void RemoveReleaseFilter(
const std::string &_name);
119 public:
void RemoveMoveFilter(
const std::string &_name);
123 public:
void RemoveDoubleClickFilter(
const std::string &_name);
127 public:
void HandlePress(
const common::MouseEvent &_event);
131 public:
void HandleRelease(
const common::MouseEvent &_event);
135 public:
void HandleMove(
const common::MouseEvent &_event);
139 public:
void HandleDoubleClick(
const common::MouseEvent &_event);
145 private:
void Add(
const std::string &_name, MouseEventFilter _filter,
146 std::list<Filter> &_list);
151 private:
void Remove(
const std::string &_name, std::list<Filter> &_list);
156 private:
void Handle(
const common::MouseEvent &_event,
157 std::list<Filter> &_list);
160 private: std::list<Filter> pressFilters;
163 private: std::list<Filter> releaseFilters;
166 private: std::list<Filter> moveFilters;
169 private: std::list<Filter> doubleClickFilters;
172 private:
friend class SingletonT<MouseEventHandler>;
Forward declarations for the common classes.
Definition: Animation.hh:26
Singleton template class.
Definition: SingletonT.hh:33
gui
Definition: MouseEventHandler.hh:29
#define GZ_SINGLETON_DECLARE(visibility, n1, n2, singletonType)
Helper to declare typed SingletonT.
Definition: SingletonT.hh:61