00001 /* 00002 * synergy -- mouse and keyboard sharing utility 00003 * Copyright (C) 2004 Chris Schoeneman 00004 * 00005 * This package is free software; you can redistribute it and/or 00006 * modify it under the terms of the GNU General Public License 00007 * found in the file COPYING that should have accompanied this file. 00008 * 00009 * This package is distributed in the hope that it will be useful, 00010 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00011 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00012 * GNU General Public License for more details. 00013 */ 00014 00015 #ifndef IEVENTQUEUE_H 00016 #define IEVENTQUEUE_H 00017 00018 #include "IInterface.h" 00019 #include "CEvent.h" 00020 00021 #define EVENTQUEUE IEventQueue::getInstance() 00022 00023 class IEventJob; 00024 class IEventQueueBuffer; 00025 00026 // Opaque type for timer info. This is defined by subclasses of 00027 // IEventQueueBuffer. 00028 class CEventQueueTimer; 00029 00031 00037 class IEventQueue : public IInterface { 00038 public: 00039 class CTimerEvent { 00040 public: 00041 CEventQueueTimer* m_timer; 00042 UInt32 m_count; 00043 }; 00044 00046 00047 00049 00053 virtual void adoptBuffer(IEventQueueBuffer*) = 0; 00054 00056 00061 virtual bool getEvent(CEvent& event, double timeout = -1.0) = 0; 00062 00064 00068 virtual bool dispatchEvent(const CEvent& event) = 0; 00069 00071 00074 virtual void addEvent(const CEvent& event) = 0; 00075 00077 00092 virtual CEventQueueTimer* 00093 newTimer(double duration, void* target) = 0; 00094 00096 00106 virtual CEventQueueTimer* 00107 newOneShotTimer(double duration, 00108 void* target) = 0; 00109 00111 00115 virtual void deleteTimer(CEventQueueTimer*) = 0; 00116 00118 00125 virtual void adoptHandler(CEvent::Type type, 00126 void* target, IEventJob* handler) = 0; 00127 00129 00133 virtual void removeHandler(CEvent::Type type, void* target) = 0; 00134 00136 00139 virtual void removeHandlers(void* target) = 0; 00140 00142 00145 virtual CEvent::Type 00146 registerType(const char* name) = 0; 00147 00149 00154 virtual CEvent::Type 00155 registerTypeOnce(CEvent::Type& type, 00156 const char* name) = 0; 00157 00159 00160 00161 00163 00167 virtual bool isEmpty() const = 0; 00168 00170 00174 virtual IEventJob* getHandler(CEvent::Type type, void* target) const = 0; 00175 00177 00181 virtual const char* getTypeName(CEvent::Type type) = 0; 00182 00184 00187 static void* getSystemTarget(); 00188 00190 00193 static IEventQueue* getInstance(); 00194 00196 00197 protected: 00199 00200 00202 00205 static void setInstance(IEventQueue*); 00206 00208 00209 private: 00210 static IEventQueue* s_instance; 00211 }; 00212 00213 #endif