17 #ifndef _KEY_EVENT_HANDLER_HH_
18 #define _KEY_EVENT_HANDLER_HH_
20 #include <boost/function.hpp>
38 public:
typedef boost::function<bool (const common::KeyEvent &_event)>
48 public: Filter(
const std::string &_name,
50 : name(_name), func(_func) {}
55 public:
bool operator==(
const Filter &_f)
const
57 return this->name == _f.name;
63 public:
bool operator==(
const std::string &_f)
const
65 return this->name == _f;
69 public: std::string name;
72 public: KeyEventFilter func;
76 private: KeyEventHandler();
79 private:
virtual ~KeyEventHandler();
84 public:
void AddPressFilter(
const std::string &_name,
85 KeyEventFilter _filter);
90 public:
void AddReleaseFilter(
const std::string &_name,
91 KeyEventFilter _filter);
95 public:
void RemovePressFilter(
const std::string &_name);
99 public:
void RemoveReleaseFilter(
const std::string &_name);
104 public:
bool HandlePress(
const common::KeyEvent &_event);
109 public:
bool HandleRelease(
const common::KeyEvent &_event);
113 public:
bool GetAutoRepeat()
const;
117 public:
void SetAutoRepeat(
const bool _autorepeat);
123 private:
void Add(
const std::string &_name, KeyEventFilter _filter,
124 std::list<Filter> &_list);
129 private:
void Remove(
const std::string &_name, std::list<Filter> &_list);
135 private:
bool Handle(
const common::KeyEvent &_event,
136 std::list<Filter> &_list);
139 private: std::list<Filter> pressFilters;
142 private: std::list<Filter> releaseFilters;
145 private:
friend class SingletonT<KeyEventHandler>;
149 private:
bool autoRepeat;
Singleton template class.
Definition: SingletonT.hh:33
#define GAZEBO_VISIBLE
Use to represent "symbol visible" if supported.
Definition: system.hh:48