17 #ifndef _GAZEBO_GUI_KEYEVENTHANDLER_HH_ 18 #define _GAZEBO_GUI_KEYEVENTHANDLER_HH_ 23 #include <boost/function.hpp> 40 class KeyEventHandlerPrivate;
44 class GZ_GUI_VISIBLE KeyEventHandler :
public SingletonT<KeyEventHandler>
48 public:
typedef boost::function<bool (const common::KeyEvent &_event)>
58 public: Filter(
const std::string &_name,
60 : name(_name), func(_func) {}
65 public:
bool operator==(
const Filter &_f)
const 67 return this->name == _f.name;
73 public:
bool operator==(
const std::string &_f)
const 75 return this->name == _f;
79 public: std::string name;
82 public: KeyEventFilter func;
86 private: KeyEventHandler();
89 private:
virtual ~KeyEventHandler();
94 public:
void AddPressFilter(
const std::string &_name,
95 KeyEventFilter _filter);
100 public:
void AddReleaseFilter(
const std::string &_name,
101 KeyEventFilter _filter);
105 public:
void RemovePressFilter(
const std::string &_name);
109 public:
void RemoveReleaseFilter(
const std::string &_name);
114 public:
bool HandlePress(
const common::KeyEvent &_event);
119 public:
bool HandleRelease(
const common::KeyEvent &_event);
123 public:
bool AutoRepeat()
const;
127 public:
void SetAutoRepeat(
const bool _autorepeat);
133 private:
void Add(
const std::string &_name, KeyEventFilter _filter,
134 std::list<Filter> &_list);
139 private:
void Remove(
const std::string &_name, std::list<Filter> &_list);
145 private:
bool Handle(
const common::KeyEvent &_event,
146 std::list<Filter> &_list);
149 private:
friend class SingletonT<KeyEventHandler>;
153 private: std::unique_ptr<KeyEventHandlerPrivate> dataPtr;
Forward declarations for the common classes.
Definition: Animation.hh:26
Singleton template class.
Definition: SingletonT.hh:33
gui
Definition: KeyEventHandler.hh:29
common
Definition: FuelModelDatabase.hh:37
#define GZ_SINGLETON_DECLARE(visibility, n1, n2, singletonType)
Helper to declare typed SingletonT.
Definition: SingletonT.hh:61