Main Page   Namespace List   Class Hierarchy   Compound List   File List   Namespace Members   Compound Members   File Members  

/otk/eventdispatcher.hh

Go to the documentation of this file.
00001 // -*- mode: C++; indent-tabs-mode: nil; c-basic-offset: 2; -*-
00002 #ifndef __eventdispatcher
00003 #define __eventdispatcher
00004 
00005 #include "eventhandler.hh"
00006 #include <map>
00007 #include <utility>
00008 
00009 namespace otk {
00010 
00011 typedef std::map<unsigned int, EventHandler *> EventMap;
00012 
00013 class EventDispatcher {
00014 public:
00015 
00016   EventDispatcher();
00017   virtual ~EventDispatcher();
00018 
00019   virtual void clearAllHandlers(void);
00020   virtual void registerHandler(Window id, EventHandler *handler);
00021   virtual void clearHandler(Window id);
00022   virtual void dispatchEvents(void);
00023 
00024   inline void setFallbackHandler(EventHandler *fallback)
00025   { _fallback = fallback; }
00026   EventHandler *getFallbackHandler(void) const { return _fallback; }
00027 
00028   //! Sets an event handler that gets all events for all handlers after
00029   //! any specific handlers have received them
00030   inline void setMasterHandler(EventHandler *master)
00031   { _master = master; }
00032   EventHandler *getMasterHandler(void) const { return _master; }
00033 
00034   EventHandler *findHandler(Window win);
00035 
00036   inline Time lastTime() const { return _lasttime; }
00037   
00038 private:
00039   EventMap _map;
00040   EventHandler *_fallback;
00041   EventHandler *_master;
00042 
00043   //! The time at which the last XEvent with a time was received
00044   Time _lasttime;
00045 
00046   void dispatch(Window win, const XEvent &e);
00047   void dispatchFocus(const XEvent &e);
00048 };
00049 
00050 }
00051 
00052 #endif

Generated on Tue Feb 4 22:58:55 2003 for Openbox by doxygen1.3-rc2