17 #ifndef _GAZEBO_GUI_KEYEVENTHANDLER_HH_
18 #define _GAZEBO_GUI_KEYEVENTHANDLER_HH_
23 #include <boost/function.hpp>
38 class KeyEventHandlerPrivate;
42 class GZ_GUI_VISIBLE KeyEventHandler :
public SingletonT<KeyEventHandler>
46 public:
typedef boost::function<bool (const common::KeyEvent &_event)>
56 public: Filter(
const std::string &_name,
58 : name(_name), func(_func) {}
63 public:
bool operator==(
const Filter &_f)
const
65 return this->name == _f.name;
71 public:
bool operator==(
const std::string &_f)
const
73 return this->name == _f;
77 public: std::string name;
80 public: KeyEventFilter func;
84 private: KeyEventHandler();
87 private:
virtual ~KeyEventHandler();
92 public:
void AddPressFilter(
const std::string &_name,
93 KeyEventFilter _filter);
98 public:
void AddReleaseFilter(
const std::string &_name,
99 KeyEventFilter _filter);
103 public:
void RemovePressFilter(
const std::string &_name);
107 public:
void RemoveReleaseFilter(
const std::string &_name);
112 public:
bool HandlePress(
const common::KeyEvent &_event);
117 public:
bool HandleRelease(
const common::KeyEvent &_event);
126 public:
bool AutoRepeat() const;
130 public:
void SetAutoRepeat(const
bool _autorepeat);
136 private:
void Add(const std::
string &_name, KeyEventFilter _filter,
137 std::list<Filter> &_list);
142 private:
void Remove(const std::
string &_name, std::list<Filter> &_list);
148 private:
bool Handle(const common::KeyEvent &_event,
149 std::list<Filter> &_list);
152 private: friend class
SingletonT<KeyEventHandler>;
156 private: std::unique_ptr<KeyEventHandlerPrivate> dataPtr;
#define GAZEBO_DEPRECATED(version)
Definition: CommonTypes.hh:48
Singleton template class.
Definition: SingletonT.hh:33