openbox/otk/eventdispatcher.hh

51 lines
1.2 KiB
C++
Raw Normal View History

2002-11-16 02:11:44 +00:00
#ifndef __eventdispatcher
#define __eventdispatcher
#include "eventhandler.hh"
#include <map>
#include <utility>
namespace otk {
typedef std::map<unsigned int, OtkEventHandler *> OtkEventMap;
class OtkEventDispatcher {
public:
OtkEventDispatcher();
virtual ~OtkEventDispatcher();
virtual void clearAllHandlers(void);
2002-12-24 21:27:16 +00:00
virtual void registerHandler(Window id, otk::OtkEventHandler *handler);
2002-11-16 02:11:44 +00:00
virtual void clearHandler(Window id);
virtual void dispatchEvents(void);
2002-12-24 21:27:16 +00:00
inline void setFallbackHandler(otk::OtkEventHandler *fallback)
2002-11-16 02:11:44 +00:00
{ _fallback = fallback; }
2002-12-24 21:27:16 +00:00
otk::OtkEventHandler *getFallbackHandler(void) const { return _fallback; }
2002-11-16 02:11:44 +00:00
2002-12-04 07:55:52 +00:00
//! Sets an event handler that gets all events for all handlers after
//! any specific handlers have received them
2002-12-24 21:27:16 +00:00
inline void setMasterHandler(otk::OtkEventHandler *master)
2002-12-04 07:55:52 +00:00
{ _master = master; }
2002-12-24 21:27:16 +00:00
otk::OtkEventHandler *getMasterHandler(void) const { return _master; }
2002-12-18 11:34:29 +00:00
2002-12-24 21:27:16 +00:00
otk::OtkEventHandler *findHandler(Window win);
inline Time lastTime() const { return _lasttime; }
2002-12-04 07:55:52 +00:00
2002-11-16 02:11:44 +00:00
private:
OtkEventMap _map;
OtkEventHandler *_fallback;
2002-12-04 07:55:52 +00:00
OtkEventHandler *_master;
2002-11-16 02:11:44 +00:00
//! The time at which the last XEvent with a time was received
Time _lasttime;
void dispatch(Window win, const XEvent &e);
2002-11-16 02:11:44 +00:00
};
}
#endif