17 #ifndef _GAZEBO_GUI_KEYEVENTHANDLER_HH_ 18 #define _GAZEBO_GUI_KEYEVENTHANDLER_HH_ 23 #include <boost/function.hpp> 37 class KeyEventHandlerPrivate;
41 class GZ_GUI_VISIBLE KeyEventHandler :
public SingletonT<KeyEventHandler>
45 public:
typedef boost::function<bool (const common::KeyEvent &_event)>
55 public: Filter(
const std::string &_name,
57 : name(_name), func(_func) {}
62 public:
bool operator==(
const Filter &_f)
const 64 return this->name == _f.name;
70 public:
bool operator==(
const std::string &_f)
const 72 return this->name == _f;
76 public: std::string name;
79 public: KeyEventFilter func;
83 private: KeyEventHandler();
86 private:
virtual ~KeyEventHandler();
91 public:
void AddPressFilter(
const std::string &_name,
92 KeyEventFilter _filter);
97 public:
void AddReleaseFilter(
const std::string &_name,
98 KeyEventFilter _filter);
102 public:
void RemovePressFilter(
const std::string &_name);
106 public:
void RemoveReleaseFilter(
const std::string &_name);
111 public:
bool HandlePress(
const common::KeyEvent &_event);
116 public:
bool HandleRelease(
const common::KeyEvent &_event);
120 public:
bool AutoRepeat()
const;
124 public:
void SetAutoRepeat(
const bool _autorepeat);
130 private:
void Add(
const std::string &_name, KeyEventFilter _filter,
131 std::list<Filter> &_list);
136 private:
void Remove(
const std::string &_name, std::list<Filter> &_list);
142 private:
bool Handle(
const common::KeyEvent &_event,
143 std::list<Filter> &_list);
146 private:
friend class SingletonT<KeyEventHandler>;
150 private: std::unique_ptr<KeyEventHandlerPrivate> dataPtr;
Forward declarations for the common classes.
Definition: Animation.hh:26
Singleton template class.
Definition: SingletonT.hh:33